1package securityinsight 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/date" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "github.com/gofrs/uuid" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/securityinsight/mgmt/2020-01-01/securityinsight" 22 23// AADDataConnector represents AAD (Azure Active Directory) data connector. 24type AADDataConnector struct { 25 // AADDataConnectorProperties - AAD (Azure Active Directory) data connector properties. 26 *AADDataConnectorProperties `json:"properties,omitempty"` 27 // ID - READ-ONLY; Azure resource Id 28 ID *string `json:"id,omitempty"` 29 // Name - READ-ONLY; Azure resource name 30 Name *string `json:"name,omitempty"` 31 // Type - READ-ONLY; Azure resource type 32 Type *string `json:"type,omitempty"` 33 // Etag - Etag of the azure resource 34 Etag *string `json:"etag,omitempty"` 35 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 36 Kind KindBasicDataConnector `json:"kind,omitempty"` 37} 38 39// MarshalJSON is the custom marshaler for AADDataConnector. 40func (adc AADDataConnector) MarshalJSON() ([]byte, error) { 41 adc.Kind = KindBasicDataConnectorKindAzureActiveDirectory 42 objectMap := make(map[string]interface{}) 43 if adc.AADDataConnectorProperties != nil { 44 objectMap["properties"] = adc.AADDataConnectorProperties 45 } 46 if adc.Kind != "" { 47 objectMap["kind"] = adc.Kind 48 } 49 if adc.Etag != nil { 50 objectMap["etag"] = adc.Etag 51 } 52 return json.Marshal(objectMap) 53} 54 55// AsAADDataConnector is the BasicDataConnector implementation for AADDataConnector. 56func (adc AADDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 57 return &adc, true 58} 59 60// AsAATPDataConnector is the BasicDataConnector implementation for AADDataConnector. 61func (adc AADDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 62 return nil, false 63} 64 65// AsASCDataConnector is the BasicDataConnector implementation for AADDataConnector. 66func (adc AADDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 67 return nil, false 68} 69 70// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AADDataConnector. 71func (adc AADDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 72 return nil, false 73} 74 75// AsMCASDataConnector is the BasicDataConnector implementation for AADDataConnector. 76func (adc AADDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 77 return nil, false 78} 79 80// AsMDATPDataConnector is the BasicDataConnector implementation for AADDataConnector. 81func (adc AADDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 82 return nil, false 83} 84 85// AsOfficeDataConnector is the BasicDataConnector implementation for AADDataConnector. 86func (adc AADDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 87 return nil, false 88} 89 90// AsTIDataConnector is the BasicDataConnector implementation for AADDataConnector. 91func (adc AADDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 92 return nil, false 93} 94 95// AsDataConnector is the BasicDataConnector implementation for AADDataConnector. 96func (adc AADDataConnector) AsDataConnector() (*DataConnector, bool) { 97 return nil, false 98} 99 100// AsBasicDataConnector is the BasicDataConnector implementation for AADDataConnector. 101func (adc AADDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 102 return &adc, true 103} 104 105// UnmarshalJSON is the custom unmarshaler for AADDataConnector struct. 106func (adc *AADDataConnector) UnmarshalJSON(body []byte) error { 107 var m map[string]*json.RawMessage 108 err := json.Unmarshal(body, &m) 109 if err != nil { 110 return err 111 } 112 for k, v := range m { 113 switch k { 114 case "properties": 115 if v != nil { 116 var aADDataConnectorProperties AADDataConnectorProperties 117 err = json.Unmarshal(*v, &aADDataConnectorProperties) 118 if err != nil { 119 return err 120 } 121 adc.AADDataConnectorProperties = &aADDataConnectorProperties 122 } 123 case "kind": 124 if v != nil { 125 var kind KindBasicDataConnector 126 err = json.Unmarshal(*v, &kind) 127 if err != nil { 128 return err 129 } 130 adc.Kind = kind 131 } 132 case "id": 133 if v != nil { 134 var ID string 135 err = json.Unmarshal(*v, &ID) 136 if err != nil { 137 return err 138 } 139 adc.ID = &ID 140 } 141 case "name": 142 if v != nil { 143 var name string 144 err = json.Unmarshal(*v, &name) 145 if err != nil { 146 return err 147 } 148 adc.Name = &name 149 } 150 case "type": 151 if v != nil { 152 var typeVar string 153 err = json.Unmarshal(*v, &typeVar) 154 if err != nil { 155 return err 156 } 157 adc.Type = &typeVar 158 } 159 case "etag": 160 if v != nil { 161 var etag string 162 err = json.Unmarshal(*v, &etag) 163 if err != nil { 164 return err 165 } 166 adc.Etag = &etag 167 } 168 } 169 } 170 171 return nil 172} 173 174// AADDataConnectorProperties AAD (Azure Active Directory) data connector properties. 175type AADDataConnectorProperties struct { 176 // TenantID - The tenant id to connect to, and get the data from. 177 TenantID *string `json:"tenantId,omitempty"` 178 // DataTypes - The available data types for the connector. 179 DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` 180} 181 182// AATPDataConnector represents AATP (Azure Advanced Threat Protection) data connector. 183type AATPDataConnector struct { 184 // AATPDataConnectorProperties - AATP (Azure Advanced Threat Protection) data connector properties. 185 *AATPDataConnectorProperties `json:"properties,omitempty"` 186 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 187 Kind KindBasicDataConnector `json:"kind,omitempty"` 188 // ID - READ-ONLY; Azure resource Id 189 ID *string `json:"id,omitempty"` 190 // Name - READ-ONLY; Azure resource name 191 Name *string `json:"name,omitempty"` 192 // Type - READ-ONLY; Azure resource type 193 Type *string `json:"type,omitempty"` 194 // Etag - Etag of the azure resource 195 Etag *string `json:"etag,omitempty"` 196} 197 198// MarshalJSON is the custom marshaler for AATPDataConnector. 199func (adc AATPDataConnector) MarshalJSON() ([]byte, error) { 200 adc.Kind = KindBasicDataConnectorKindAzureAdvancedThreatProtection 201 objectMap := make(map[string]interface{}) 202 if adc.AATPDataConnectorProperties != nil { 203 objectMap["properties"] = adc.AATPDataConnectorProperties 204 } 205 if adc.Kind != "" { 206 objectMap["kind"] = adc.Kind 207 } 208 if adc.Etag != nil { 209 objectMap["etag"] = adc.Etag 210 } 211 return json.Marshal(objectMap) 212} 213 214// AsAADDataConnector is the BasicDataConnector implementation for AATPDataConnector. 215func (adc AATPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 216 return nil, false 217} 218 219// AsAATPDataConnector is the BasicDataConnector implementation for AATPDataConnector. 220func (adc AATPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 221 return &adc, true 222} 223 224// AsASCDataConnector is the BasicDataConnector implementation for AATPDataConnector. 225func (adc AATPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 226 return nil, false 227} 228 229// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AATPDataConnector. 230func (adc AATPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 231 return nil, false 232} 233 234// AsMCASDataConnector is the BasicDataConnector implementation for AATPDataConnector. 235func (adc AATPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 236 return nil, false 237} 238 239// AsMDATPDataConnector is the BasicDataConnector implementation for AATPDataConnector. 240func (adc AATPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 241 return nil, false 242} 243 244// AsOfficeDataConnector is the BasicDataConnector implementation for AATPDataConnector. 245func (adc AATPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 246 return nil, false 247} 248 249// AsTIDataConnector is the BasicDataConnector implementation for AATPDataConnector. 250func (adc AATPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 251 return nil, false 252} 253 254// AsDataConnector is the BasicDataConnector implementation for AATPDataConnector. 255func (adc AATPDataConnector) AsDataConnector() (*DataConnector, bool) { 256 return nil, false 257} 258 259// AsBasicDataConnector is the BasicDataConnector implementation for AATPDataConnector. 260func (adc AATPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 261 return &adc, true 262} 263 264// UnmarshalJSON is the custom unmarshaler for AATPDataConnector struct. 265func (adc *AATPDataConnector) UnmarshalJSON(body []byte) error { 266 var m map[string]*json.RawMessage 267 err := json.Unmarshal(body, &m) 268 if err != nil { 269 return err 270 } 271 for k, v := range m { 272 switch k { 273 case "properties": 274 if v != nil { 275 var aATPDataConnectorProperties AATPDataConnectorProperties 276 err = json.Unmarshal(*v, &aATPDataConnectorProperties) 277 if err != nil { 278 return err 279 } 280 adc.AATPDataConnectorProperties = &aATPDataConnectorProperties 281 } 282 case "kind": 283 if v != nil { 284 var kind KindBasicDataConnector 285 err = json.Unmarshal(*v, &kind) 286 if err != nil { 287 return err 288 } 289 adc.Kind = kind 290 } 291 case "id": 292 if v != nil { 293 var ID string 294 err = json.Unmarshal(*v, &ID) 295 if err != nil { 296 return err 297 } 298 adc.ID = &ID 299 } 300 case "name": 301 if v != nil { 302 var name string 303 err = json.Unmarshal(*v, &name) 304 if err != nil { 305 return err 306 } 307 adc.Name = &name 308 } 309 case "type": 310 if v != nil { 311 var typeVar string 312 err = json.Unmarshal(*v, &typeVar) 313 if err != nil { 314 return err 315 } 316 adc.Type = &typeVar 317 } 318 case "etag": 319 if v != nil { 320 var etag string 321 err = json.Unmarshal(*v, &etag) 322 if err != nil { 323 return err 324 } 325 adc.Etag = &etag 326 } 327 } 328 } 329 330 return nil 331} 332 333// AATPDataConnectorProperties AATP (Azure Advanced Threat Protection) data connector properties. 334type AATPDataConnectorProperties struct { 335 // TenantID - The tenant id to connect to, and get the data from. 336 TenantID *string `json:"tenantId,omitempty"` 337 // DataTypes - The available data types for the connector. 338 DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` 339} 340 341// ActionPropertiesBase action property bag base. 342type ActionPropertiesBase struct { 343 // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. 344 LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` 345} 346 347// ActionRequest action for alert rule. 348type ActionRequest struct { 349 // ActionRequestProperties - Action properties for put request 350 *ActionRequestProperties `json:"properties,omitempty"` 351 // ID - READ-ONLY; Azure resource Id 352 ID *string `json:"id,omitempty"` 353 // Name - READ-ONLY; Azure resource name 354 Name *string `json:"name,omitempty"` 355 // Type - READ-ONLY; Azure resource type 356 Type *string `json:"type,omitempty"` 357 // Etag - Etag of the azure resource 358 Etag *string `json:"etag,omitempty"` 359} 360 361// MarshalJSON is the custom marshaler for ActionRequest. 362func (ar ActionRequest) MarshalJSON() ([]byte, error) { 363 objectMap := make(map[string]interface{}) 364 if ar.ActionRequestProperties != nil { 365 objectMap["properties"] = ar.ActionRequestProperties 366 } 367 if ar.Etag != nil { 368 objectMap["etag"] = ar.Etag 369 } 370 return json.Marshal(objectMap) 371} 372 373// UnmarshalJSON is the custom unmarshaler for ActionRequest struct. 374func (ar *ActionRequest) UnmarshalJSON(body []byte) error { 375 var m map[string]*json.RawMessage 376 err := json.Unmarshal(body, &m) 377 if err != nil { 378 return err 379 } 380 for k, v := range m { 381 switch k { 382 case "properties": 383 if v != nil { 384 var actionRequestProperties ActionRequestProperties 385 err = json.Unmarshal(*v, &actionRequestProperties) 386 if err != nil { 387 return err 388 } 389 ar.ActionRequestProperties = &actionRequestProperties 390 } 391 case "id": 392 if v != nil { 393 var ID string 394 err = json.Unmarshal(*v, &ID) 395 if err != nil { 396 return err 397 } 398 ar.ID = &ID 399 } 400 case "name": 401 if v != nil { 402 var name string 403 err = json.Unmarshal(*v, &name) 404 if err != nil { 405 return err 406 } 407 ar.Name = &name 408 } 409 case "type": 410 if v != nil { 411 var typeVar string 412 err = json.Unmarshal(*v, &typeVar) 413 if err != nil { 414 return err 415 } 416 ar.Type = &typeVar 417 } 418 case "etag": 419 if v != nil { 420 var etag string 421 err = json.Unmarshal(*v, &etag) 422 if err != nil { 423 return err 424 } 425 ar.Etag = &etag 426 } 427 } 428 } 429 430 return nil 431} 432 433// ActionRequestProperties action property bag. 434type ActionRequestProperties struct { 435 // TriggerURI - Logic App Callback URL for this specific workflow. 436 TriggerURI *string `json:"triggerUri,omitempty"` 437 // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. 438 LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` 439} 440 441// ActionResponse action for alert rule. 442type ActionResponse struct { 443 autorest.Response `json:"-"` 444 // Etag - Etag of the action. 445 Etag *string `json:"etag,omitempty"` 446 // ActionResponseProperties - Action properties for get request 447 *ActionResponseProperties `json:"properties,omitempty"` 448 // ID - READ-ONLY; Azure resource Id 449 ID *string `json:"id,omitempty"` 450 // Name - READ-ONLY; Azure resource name 451 Name *string `json:"name,omitempty"` 452 // Type - READ-ONLY; Azure resource type 453 Type *string `json:"type,omitempty"` 454} 455 456// MarshalJSON is the custom marshaler for ActionResponse. 457func (ar ActionResponse) MarshalJSON() ([]byte, error) { 458 objectMap := make(map[string]interface{}) 459 if ar.Etag != nil { 460 objectMap["etag"] = ar.Etag 461 } 462 if ar.ActionResponseProperties != nil { 463 objectMap["properties"] = ar.ActionResponseProperties 464 } 465 return json.Marshal(objectMap) 466} 467 468// UnmarshalJSON is the custom unmarshaler for ActionResponse struct. 469func (ar *ActionResponse) UnmarshalJSON(body []byte) error { 470 var m map[string]*json.RawMessage 471 err := json.Unmarshal(body, &m) 472 if err != nil { 473 return err 474 } 475 for k, v := range m { 476 switch k { 477 case "etag": 478 if v != nil { 479 var etag string 480 err = json.Unmarshal(*v, &etag) 481 if err != nil { 482 return err 483 } 484 ar.Etag = &etag 485 } 486 case "properties": 487 if v != nil { 488 var actionResponseProperties ActionResponseProperties 489 err = json.Unmarshal(*v, &actionResponseProperties) 490 if err != nil { 491 return err 492 } 493 ar.ActionResponseProperties = &actionResponseProperties 494 } 495 case "id": 496 if v != nil { 497 var ID string 498 err = json.Unmarshal(*v, &ID) 499 if err != nil { 500 return err 501 } 502 ar.ID = &ID 503 } 504 case "name": 505 if v != nil { 506 var name string 507 err = json.Unmarshal(*v, &name) 508 if err != nil { 509 return err 510 } 511 ar.Name = &name 512 } 513 case "type": 514 if v != nil { 515 var typeVar string 516 err = json.Unmarshal(*v, &typeVar) 517 if err != nil { 518 return err 519 } 520 ar.Type = &typeVar 521 } 522 } 523 } 524 525 return nil 526} 527 528// ActionResponseProperties action property bag. 529type ActionResponseProperties struct { 530 // WorkflowID - The name of the logic app's workflow. 531 WorkflowID *string `json:"workflowId,omitempty"` 532 // LogicAppResourceID - Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. 533 LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` 534} 535 536// ActionsList list all the actions. 537type ActionsList struct { 538 autorest.Response `json:"-"` 539 // NextLink - READ-ONLY; URL to fetch the next set of actions. 540 NextLink *string `json:"nextLink,omitempty"` 541 // Value - Array of actions. 542 Value *[]ActionResponse `json:"value,omitempty"` 543} 544 545// MarshalJSON is the custom marshaler for ActionsList. 546func (al ActionsList) MarshalJSON() ([]byte, error) { 547 objectMap := make(map[string]interface{}) 548 if al.Value != nil { 549 objectMap["value"] = al.Value 550 } 551 return json.Marshal(objectMap) 552} 553 554// ActionsListIterator provides access to a complete listing of ActionResponse values. 555type ActionsListIterator struct { 556 i int 557 page ActionsListPage 558} 559 560// NextWithContext advances to the next value. If there was an error making 561// the request the iterator does not advance and the error is returned. 562func (iter *ActionsListIterator) NextWithContext(ctx context.Context) (err error) { 563 if tracing.IsEnabled() { 564 ctx = tracing.StartSpan(ctx, fqdn+"/ActionsListIterator.NextWithContext") 565 defer func() { 566 sc := -1 567 if iter.Response().Response.Response != nil { 568 sc = iter.Response().Response.Response.StatusCode 569 } 570 tracing.EndSpan(ctx, sc, err) 571 }() 572 } 573 iter.i++ 574 if iter.i < len(iter.page.Values()) { 575 return nil 576 } 577 err = iter.page.NextWithContext(ctx) 578 if err != nil { 579 iter.i-- 580 return err 581 } 582 iter.i = 0 583 return nil 584} 585 586// Next advances to the next value. If there was an error making 587// the request the iterator does not advance and the error is returned. 588// Deprecated: Use NextWithContext() instead. 589func (iter *ActionsListIterator) Next() error { 590 return iter.NextWithContext(context.Background()) 591} 592 593// NotDone returns true if the enumeration should be started or is not yet complete. 594func (iter ActionsListIterator) NotDone() bool { 595 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 596} 597 598// Response returns the raw server response from the last page request. 599func (iter ActionsListIterator) Response() ActionsList { 600 return iter.page.Response() 601} 602 603// Value returns the current value or a zero-initialized value if the 604// iterator has advanced beyond the end of the collection. 605func (iter ActionsListIterator) Value() ActionResponse { 606 if !iter.page.NotDone() { 607 return ActionResponse{} 608 } 609 return iter.page.Values()[iter.i] 610} 611 612// Creates a new instance of the ActionsListIterator type. 613func NewActionsListIterator(page ActionsListPage) ActionsListIterator { 614 return ActionsListIterator{page: page} 615} 616 617// IsEmpty returns true if the ListResult contains no values. 618func (al ActionsList) IsEmpty() bool { 619 return al.Value == nil || len(*al.Value) == 0 620} 621 622// hasNextLink returns true if the NextLink is not empty. 623func (al ActionsList) hasNextLink() bool { 624 return al.NextLink != nil && len(*al.NextLink) != 0 625} 626 627// actionsListPreparer prepares a request to retrieve the next set of results. 628// It returns nil if no more results exist. 629func (al ActionsList) actionsListPreparer(ctx context.Context) (*http.Request, error) { 630 if !al.hasNextLink() { 631 return nil, nil 632 } 633 return autorest.Prepare((&http.Request{}).WithContext(ctx), 634 autorest.AsJSON(), 635 autorest.AsGet(), 636 autorest.WithBaseURL(to.String(al.NextLink))) 637} 638 639// ActionsListPage contains a page of ActionResponse values. 640type ActionsListPage struct { 641 fn func(context.Context, ActionsList) (ActionsList, error) 642 al ActionsList 643} 644 645// NextWithContext advances to the next page of values. If there was an error making 646// the request the page does not advance and the error is returned. 647func (page *ActionsListPage) NextWithContext(ctx context.Context) (err error) { 648 if tracing.IsEnabled() { 649 ctx = tracing.StartSpan(ctx, fqdn+"/ActionsListPage.NextWithContext") 650 defer func() { 651 sc := -1 652 if page.Response().Response.Response != nil { 653 sc = page.Response().Response.Response.StatusCode 654 } 655 tracing.EndSpan(ctx, sc, err) 656 }() 657 } 658 for { 659 next, err := page.fn(ctx, page.al) 660 if err != nil { 661 return err 662 } 663 page.al = next 664 if !next.hasNextLink() || !next.IsEmpty() { 665 break 666 } 667 } 668 return nil 669} 670 671// Next advances to the next page of values. If there was an error making 672// the request the page does not advance and the error is returned. 673// Deprecated: Use NextWithContext() instead. 674func (page *ActionsListPage) Next() error { 675 return page.NextWithContext(context.Background()) 676} 677 678// NotDone returns true if the page enumeration should be started or is not yet complete. 679func (page ActionsListPage) NotDone() bool { 680 return !page.al.IsEmpty() 681} 682 683// Response returns the raw server response from the last page request. 684func (page ActionsListPage) Response() ActionsList { 685 return page.al 686} 687 688// Values returns the slice of values for the current page or nil if there are no values. 689func (page ActionsListPage) Values() []ActionResponse { 690 if page.al.IsEmpty() { 691 return nil 692 } 693 return *page.al.Value 694} 695 696// Creates a new instance of the ActionsListPage type. 697func NewActionsListPage(cur ActionsList, getNextPage func(context.Context, ActionsList) (ActionsList, error)) ActionsListPage { 698 return ActionsListPage{ 699 fn: getNextPage, 700 al: cur, 701 } 702} 703 704// BasicAlertRule alert rule. 705type BasicAlertRule interface { 706 AsFusionAlertRule() (*FusionAlertRule, bool) 707 AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) 708 AsScheduledAlertRule() (*ScheduledAlertRule, bool) 709 AsAlertRule() (*AlertRule, bool) 710} 711 712// AlertRule alert rule. 713type AlertRule struct { 714 autorest.Response `json:"-"` 715 // Kind - Possible values include: 'KindAlertRule', 'KindFusion', 'KindMicrosoftSecurityIncidentCreation', 'KindScheduled' 716 Kind Kind `json:"kind,omitempty"` 717 // ID - READ-ONLY; Azure resource Id 718 ID *string `json:"id,omitempty"` 719 // Name - READ-ONLY; Azure resource name 720 Name *string `json:"name,omitempty"` 721 // Type - READ-ONLY; Azure resource type 722 Type *string `json:"type,omitempty"` 723 // Etag - Etag of the azure resource 724 Etag *string `json:"etag,omitempty"` 725} 726 727func unmarshalBasicAlertRule(body []byte) (BasicAlertRule, error) { 728 var m map[string]interface{} 729 err := json.Unmarshal(body, &m) 730 if err != nil { 731 return nil, err 732 } 733 734 switch m["kind"] { 735 case string(KindFusion): 736 var far FusionAlertRule 737 err := json.Unmarshal(body, &far) 738 return far, err 739 case string(KindMicrosoftSecurityIncidentCreation): 740 var msicar MicrosoftSecurityIncidentCreationAlertRule 741 err := json.Unmarshal(body, &msicar) 742 return msicar, err 743 case string(KindScheduled): 744 var sar ScheduledAlertRule 745 err := json.Unmarshal(body, &sar) 746 return sar, err 747 default: 748 var ar AlertRule 749 err := json.Unmarshal(body, &ar) 750 return ar, err 751 } 752} 753func unmarshalBasicAlertRuleArray(body []byte) ([]BasicAlertRule, error) { 754 var rawMessages []*json.RawMessage 755 err := json.Unmarshal(body, &rawMessages) 756 if err != nil { 757 return nil, err 758 } 759 760 arArray := make([]BasicAlertRule, len(rawMessages)) 761 762 for index, rawMessage := range rawMessages { 763 ar, err := unmarshalBasicAlertRule(*rawMessage) 764 if err != nil { 765 return nil, err 766 } 767 arArray[index] = ar 768 } 769 return arArray, nil 770} 771 772// MarshalJSON is the custom marshaler for AlertRule. 773func (ar AlertRule) MarshalJSON() ([]byte, error) { 774 ar.Kind = KindAlertRule 775 objectMap := make(map[string]interface{}) 776 if ar.Kind != "" { 777 objectMap["kind"] = ar.Kind 778 } 779 if ar.Etag != nil { 780 objectMap["etag"] = ar.Etag 781 } 782 return json.Marshal(objectMap) 783} 784 785// AsFusionAlertRule is the BasicAlertRule implementation for AlertRule. 786func (ar AlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { 787 return nil, false 788} 789 790// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for AlertRule. 791func (ar AlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { 792 return nil, false 793} 794 795// AsScheduledAlertRule is the BasicAlertRule implementation for AlertRule. 796func (ar AlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { 797 return nil, false 798} 799 800// AsAlertRule is the BasicAlertRule implementation for AlertRule. 801func (ar AlertRule) AsAlertRule() (*AlertRule, bool) { 802 return &ar, true 803} 804 805// AsBasicAlertRule is the BasicAlertRule implementation for AlertRule. 806func (ar AlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { 807 return &ar, true 808} 809 810// AlertRuleModel ... 811type AlertRuleModel struct { 812 autorest.Response `json:"-"` 813 Value BasicAlertRule `json:"value,omitempty"` 814} 815 816// UnmarshalJSON is the custom unmarshaler for AlertRuleModel struct. 817func (arm *AlertRuleModel) UnmarshalJSON(body []byte) error { 818 ar, err := unmarshalBasicAlertRule(body) 819 if err != nil { 820 return err 821 } 822 arm.Value = ar 823 824 return nil 825} 826 827// AlertRulesList list all the alert rules. 828type AlertRulesList struct { 829 autorest.Response `json:"-"` 830 // NextLink - READ-ONLY; URL to fetch the next set of alert rules. 831 NextLink *string `json:"nextLink,omitempty"` 832 // Value - Array of alert rules. 833 Value *[]BasicAlertRule `json:"value,omitempty"` 834} 835 836// MarshalJSON is the custom marshaler for AlertRulesList. 837func (arl AlertRulesList) MarshalJSON() ([]byte, error) { 838 objectMap := make(map[string]interface{}) 839 if arl.Value != nil { 840 objectMap["value"] = arl.Value 841 } 842 return json.Marshal(objectMap) 843} 844 845// UnmarshalJSON is the custom unmarshaler for AlertRulesList struct. 846func (arl *AlertRulesList) UnmarshalJSON(body []byte) error { 847 var m map[string]*json.RawMessage 848 err := json.Unmarshal(body, &m) 849 if err != nil { 850 return err 851 } 852 for k, v := range m { 853 switch k { 854 case "nextLink": 855 if v != nil { 856 var nextLink string 857 err = json.Unmarshal(*v, &nextLink) 858 if err != nil { 859 return err 860 } 861 arl.NextLink = &nextLink 862 } 863 case "value": 864 if v != nil { 865 value, err := unmarshalBasicAlertRuleArray(*v) 866 if err != nil { 867 return err 868 } 869 arl.Value = &value 870 } 871 } 872 } 873 874 return nil 875} 876 877// AlertRulesListIterator provides access to a complete listing of AlertRule values. 878type AlertRulesListIterator struct { 879 i int 880 page AlertRulesListPage 881} 882 883// NextWithContext advances to the next value. If there was an error making 884// the request the iterator does not advance and the error is returned. 885func (iter *AlertRulesListIterator) NextWithContext(ctx context.Context) (err error) { 886 if tracing.IsEnabled() { 887 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListIterator.NextWithContext") 888 defer func() { 889 sc := -1 890 if iter.Response().Response.Response != nil { 891 sc = iter.Response().Response.Response.StatusCode 892 } 893 tracing.EndSpan(ctx, sc, err) 894 }() 895 } 896 iter.i++ 897 if iter.i < len(iter.page.Values()) { 898 return nil 899 } 900 err = iter.page.NextWithContext(ctx) 901 if err != nil { 902 iter.i-- 903 return err 904 } 905 iter.i = 0 906 return nil 907} 908 909// Next advances to the next value. If there was an error making 910// the request the iterator does not advance and the error is returned. 911// Deprecated: Use NextWithContext() instead. 912func (iter *AlertRulesListIterator) Next() error { 913 return iter.NextWithContext(context.Background()) 914} 915 916// NotDone returns true if the enumeration should be started or is not yet complete. 917func (iter AlertRulesListIterator) NotDone() bool { 918 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 919} 920 921// Response returns the raw server response from the last page request. 922func (iter AlertRulesListIterator) Response() AlertRulesList { 923 return iter.page.Response() 924} 925 926// Value returns the current value or a zero-initialized value if the 927// iterator has advanced beyond the end of the collection. 928func (iter AlertRulesListIterator) Value() BasicAlertRule { 929 if !iter.page.NotDone() { 930 return AlertRule{} 931 } 932 return iter.page.Values()[iter.i] 933} 934 935// Creates a new instance of the AlertRulesListIterator type. 936func NewAlertRulesListIterator(page AlertRulesListPage) AlertRulesListIterator { 937 return AlertRulesListIterator{page: page} 938} 939 940// IsEmpty returns true if the ListResult contains no values. 941func (arl AlertRulesList) IsEmpty() bool { 942 return arl.Value == nil || len(*arl.Value) == 0 943} 944 945// hasNextLink returns true if the NextLink is not empty. 946func (arl AlertRulesList) hasNextLink() bool { 947 return arl.NextLink != nil && len(*arl.NextLink) != 0 948} 949 950// alertRulesListPreparer prepares a request to retrieve the next set of results. 951// It returns nil if no more results exist. 952func (arl AlertRulesList) alertRulesListPreparer(ctx context.Context) (*http.Request, error) { 953 if !arl.hasNextLink() { 954 return nil, nil 955 } 956 return autorest.Prepare((&http.Request{}).WithContext(ctx), 957 autorest.AsJSON(), 958 autorest.AsGet(), 959 autorest.WithBaseURL(to.String(arl.NextLink))) 960} 961 962// AlertRulesListPage contains a page of BasicAlertRule values. 963type AlertRulesListPage struct { 964 fn func(context.Context, AlertRulesList) (AlertRulesList, error) 965 arl AlertRulesList 966} 967 968// NextWithContext advances to the next page of values. If there was an error making 969// the request the page does not advance and the error is returned. 970func (page *AlertRulesListPage) NextWithContext(ctx context.Context) (err error) { 971 if tracing.IsEnabled() { 972 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListPage.NextWithContext") 973 defer func() { 974 sc := -1 975 if page.Response().Response.Response != nil { 976 sc = page.Response().Response.Response.StatusCode 977 } 978 tracing.EndSpan(ctx, sc, err) 979 }() 980 } 981 for { 982 next, err := page.fn(ctx, page.arl) 983 if err != nil { 984 return err 985 } 986 page.arl = next 987 if !next.hasNextLink() || !next.IsEmpty() { 988 break 989 } 990 } 991 return nil 992} 993 994// Next advances to the next page of values. If there was an error making 995// the request the page does not advance and the error is returned. 996// Deprecated: Use NextWithContext() instead. 997func (page *AlertRulesListPage) Next() error { 998 return page.NextWithContext(context.Background()) 999} 1000 1001// NotDone returns true if the page enumeration should be started or is not yet complete. 1002func (page AlertRulesListPage) NotDone() bool { 1003 return !page.arl.IsEmpty() 1004} 1005 1006// Response returns the raw server response from the last page request. 1007func (page AlertRulesListPage) Response() AlertRulesList { 1008 return page.arl 1009} 1010 1011// Values returns the slice of values for the current page or nil if there are no values. 1012func (page AlertRulesListPage) Values() []BasicAlertRule { 1013 if page.arl.IsEmpty() { 1014 return nil 1015 } 1016 return *page.arl.Value 1017} 1018 1019// Creates a new instance of the AlertRulesListPage type. 1020func NewAlertRulesListPage(cur AlertRulesList, getNextPage func(context.Context, AlertRulesList) (AlertRulesList, error)) AlertRulesListPage { 1021 return AlertRulesListPage{ 1022 fn: getNextPage, 1023 arl: cur, 1024 } 1025} 1026 1027// BasicAlertRuleTemplate alert rule template. 1028type BasicAlertRuleTemplate interface { 1029 AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) 1030 AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) 1031 AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) 1032 AsAlertRuleTemplate() (*AlertRuleTemplate, bool) 1033} 1034 1035// AlertRuleTemplate alert rule template. 1036type AlertRuleTemplate struct { 1037 autorest.Response `json:"-"` 1038 // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled' 1039 Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` 1040 // ID - READ-ONLY; Azure resource Id 1041 ID *string `json:"id,omitempty"` 1042 // Name - READ-ONLY; Azure resource name 1043 Name *string `json:"name,omitempty"` 1044 // Type - READ-ONLY; Azure resource type 1045 Type *string `json:"type,omitempty"` 1046} 1047 1048func unmarshalBasicAlertRuleTemplate(body []byte) (BasicAlertRuleTemplate, error) { 1049 var m map[string]interface{} 1050 err := json.Unmarshal(body, &m) 1051 if err != nil { 1052 return nil, err 1053 } 1054 1055 switch m["kind"] { 1056 case string(KindBasicAlertRuleTemplateKindFusion): 1057 var fart FusionAlertRuleTemplate 1058 err := json.Unmarshal(body, &fart) 1059 return fart, err 1060 case string(KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation): 1061 var msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate 1062 err := json.Unmarshal(body, &msicart) 1063 return msicart, err 1064 case string(KindBasicAlertRuleTemplateKindScheduled): 1065 var sart ScheduledAlertRuleTemplate 1066 err := json.Unmarshal(body, &sart) 1067 return sart, err 1068 default: 1069 var art AlertRuleTemplate 1070 err := json.Unmarshal(body, &art) 1071 return art, err 1072 } 1073} 1074func unmarshalBasicAlertRuleTemplateArray(body []byte) ([]BasicAlertRuleTemplate, error) { 1075 var rawMessages []*json.RawMessage 1076 err := json.Unmarshal(body, &rawMessages) 1077 if err != nil { 1078 return nil, err 1079 } 1080 1081 artArray := make([]BasicAlertRuleTemplate, len(rawMessages)) 1082 1083 for index, rawMessage := range rawMessages { 1084 art, err := unmarshalBasicAlertRuleTemplate(*rawMessage) 1085 if err != nil { 1086 return nil, err 1087 } 1088 artArray[index] = art 1089 } 1090 return artArray, nil 1091} 1092 1093// MarshalJSON is the custom marshaler for AlertRuleTemplate. 1094func (art AlertRuleTemplate) MarshalJSON() ([]byte, error) { 1095 art.Kind = KindBasicAlertRuleTemplateKindAlertRuleTemplate 1096 objectMap := make(map[string]interface{}) 1097 if art.Kind != "" { 1098 objectMap["kind"] = art.Kind 1099 } 1100 return json.Marshal(objectMap) 1101} 1102 1103// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. 1104func (art AlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { 1105 return nil, false 1106} 1107 1108// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. 1109func (art AlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { 1110 return nil, false 1111} 1112 1113// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. 1114func (art AlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { 1115 return nil, false 1116} 1117 1118// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. 1119func (art AlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { 1120 return &art, true 1121} 1122 1123// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for AlertRuleTemplate. 1124func (art AlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { 1125 return &art, true 1126} 1127 1128// AlertRuleTemplateDataSource alert rule template data sources 1129type AlertRuleTemplateDataSource struct { 1130 // ConnectorID - The connector id that provides the following data types 1131 ConnectorID *string `json:"connectorId,omitempty"` 1132 // DataTypes - The data types used by the alert rule template 1133 DataTypes *[]string `json:"dataTypes,omitempty"` 1134} 1135 1136// AlertRuleTemplateModel ... 1137type AlertRuleTemplateModel struct { 1138 autorest.Response `json:"-"` 1139 Value BasicAlertRuleTemplate `json:"value,omitempty"` 1140} 1141 1142// UnmarshalJSON is the custom unmarshaler for AlertRuleTemplateModel struct. 1143func (artm *AlertRuleTemplateModel) UnmarshalJSON(body []byte) error { 1144 art, err := unmarshalBasicAlertRuleTemplate(body) 1145 if err != nil { 1146 return err 1147 } 1148 artm.Value = art 1149 1150 return nil 1151} 1152 1153// AlertRuleTemplatesList list all the alert rule templates. 1154type AlertRuleTemplatesList struct { 1155 autorest.Response `json:"-"` 1156 // NextLink - READ-ONLY; URL to fetch the next set of alert rule templates. 1157 NextLink *string `json:"nextLink,omitempty"` 1158 // Value - Array of alert rule templates. 1159 Value *[]BasicAlertRuleTemplate `json:"value,omitempty"` 1160} 1161 1162// MarshalJSON is the custom marshaler for AlertRuleTemplatesList. 1163func (artl AlertRuleTemplatesList) MarshalJSON() ([]byte, error) { 1164 objectMap := make(map[string]interface{}) 1165 if artl.Value != nil { 1166 objectMap["value"] = artl.Value 1167 } 1168 return json.Marshal(objectMap) 1169} 1170 1171// UnmarshalJSON is the custom unmarshaler for AlertRuleTemplatesList struct. 1172func (artl *AlertRuleTemplatesList) UnmarshalJSON(body []byte) error { 1173 var m map[string]*json.RawMessage 1174 err := json.Unmarshal(body, &m) 1175 if err != nil { 1176 return err 1177 } 1178 for k, v := range m { 1179 switch k { 1180 case "nextLink": 1181 if v != nil { 1182 var nextLink string 1183 err = json.Unmarshal(*v, &nextLink) 1184 if err != nil { 1185 return err 1186 } 1187 artl.NextLink = &nextLink 1188 } 1189 case "value": 1190 if v != nil { 1191 value, err := unmarshalBasicAlertRuleTemplateArray(*v) 1192 if err != nil { 1193 return err 1194 } 1195 artl.Value = &value 1196 } 1197 } 1198 } 1199 1200 return nil 1201} 1202 1203// AlertRuleTemplatesListIterator provides access to a complete listing of AlertRuleTemplate values. 1204type AlertRuleTemplatesListIterator struct { 1205 i int 1206 page AlertRuleTemplatesListPage 1207} 1208 1209// NextWithContext advances to the next value. If there was an error making 1210// the request the iterator does not advance and the error is returned. 1211func (iter *AlertRuleTemplatesListIterator) NextWithContext(ctx context.Context) (err error) { 1212 if tracing.IsEnabled() { 1213 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesListIterator.NextWithContext") 1214 defer func() { 1215 sc := -1 1216 if iter.Response().Response.Response != nil { 1217 sc = iter.Response().Response.Response.StatusCode 1218 } 1219 tracing.EndSpan(ctx, sc, err) 1220 }() 1221 } 1222 iter.i++ 1223 if iter.i < len(iter.page.Values()) { 1224 return nil 1225 } 1226 err = iter.page.NextWithContext(ctx) 1227 if err != nil { 1228 iter.i-- 1229 return err 1230 } 1231 iter.i = 0 1232 return nil 1233} 1234 1235// Next advances to the next value. If there was an error making 1236// the request the iterator does not advance and the error is returned. 1237// Deprecated: Use NextWithContext() instead. 1238func (iter *AlertRuleTemplatesListIterator) Next() error { 1239 return iter.NextWithContext(context.Background()) 1240} 1241 1242// NotDone returns true if the enumeration should be started or is not yet complete. 1243func (iter AlertRuleTemplatesListIterator) NotDone() bool { 1244 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1245} 1246 1247// Response returns the raw server response from the last page request. 1248func (iter AlertRuleTemplatesListIterator) Response() AlertRuleTemplatesList { 1249 return iter.page.Response() 1250} 1251 1252// Value returns the current value or a zero-initialized value if the 1253// iterator has advanced beyond the end of the collection. 1254func (iter AlertRuleTemplatesListIterator) Value() BasicAlertRuleTemplate { 1255 if !iter.page.NotDone() { 1256 return AlertRuleTemplate{} 1257 } 1258 return iter.page.Values()[iter.i] 1259} 1260 1261// Creates a new instance of the AlertRuleTemplatesListIterator type. 1262func NewAlertRuleTemplatesListIterator(page AlertRuleTemplatesListPage) AlertRuleTemplatesListIterator { 1263 return AlertRuleTemplatesListIterator{page: page} 1264} 1265 1266// IsEmpty returns true if the ListResult contains no values. 1267func (artl AlertRuleTemplatesList) IsEmpty() bool { 1268 return artl.Value == nil || len(*artl.Value) == 0 1269} 1270 1271// hasNextLink returns true if the NextLink is not empty. 1272func (artl AlertRuleTemplatesList) hasNextLink() bool { 1273 return artl.NextLink != nil && len(*artl.NextLink) != 0 1274} 1275 1276// alertRuleTemplatesListPreparer prepares a request to retrieve the next set of results. 1277// It returns nil if no more results exist. 1278func (artl AlertRuleTemplatesList) alertRuleTemplatesListPreparer(ctx context.Context) (*http.Request, error) { 1279 if !artl.hasNextLink() { 1280 return nil, nil 1281 } 1282 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1283 autorest.AsJSON(), 1284 autorest.AsGet(), 1285 autorest.WithBaseURL(to.String(artl.NextLink))) 1286} 1287 1288// AlertRuleTemplatesListPage contains a page of BasicAlertRuleTemplate values. 1289type AlertRuleTemplatesListPage struct { 1290 fn func(context.Context, AlertRuleTemplatesList) (AlertRuleTemplatesList, error) 1291 artl AlertRuleTemplatesList 1292} 1293 1294// NextWithContext advances to the next page of values. If there was an error making 1295// the request the page does not advance and the error is returned. 1296func (page *AlertRuleTemplatesListPage) NextWithContext(ctx context.Context) (err error) { 1297 if tracing.IsEnabled() { 1298 ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleTemplatesListPage.NextWithContext") 1299 defer func() { 1300 sc := -1 1301 if page.Response().Response.Response != nil { 1302 sc = page.Response().Response.Response.StatusCode 1303 } 1304 tracing.EndSpan(ctx, sc, err) 1305 }() 1306 } 1307 for { 1308 next, err := page.fn(ctx, page.artl) 1309 if err != nil { 1310 return err 1311 } 1312 page.artl = next 1313 if !next.hasNextLink() || !next.IsEmpty() { 1314 break 1315 } 1316 } 1317 return nil 1318} 1319 1320// Next advances to the next page of values. If there was an error making 1321// the request the page does not advance and the error is returned. 1322// Deprecated: Use NextWithContext() instead. 1323func (page *AlertRuleTemplatesListPage) Next() error { 1324 return page.NextWithContext(context.Background()) 1325} 1326 1327// NotDone returns true if the page enumeration should be started or is not yet complete. 1328func (page AlertRuleTemplatesListPage) NotDone() bool { 1329 return !page.artl.IsEmpty() 1330} 1331 1332// Response returns the raw server response from the last page request. 1333func (page AlertRuleTemplatesListPage) Response() AlertRuleTemplatesList { 1334 return page.artl 1335} 1336 1337// Values returns the slice of values for the current page or nil if there are no values. 1338func (page AlertRuleTemplatesListPage) Values() []BasicAlertRuleTemplate { 1339 if page.artl.IsEmpty() { 1340 return nil 1341 } 1342 return *page.artl.Value 1343} 1344 1345// Creates a new instance of the AlertRuleTemplatesListPage type. 1346func NewAlertRuleTemplatesListPage(cur AlertRuleTemplatesList, getNextPage func(context.Context, AlertRuleTemplatesList) (AlertRuleTemplatesList, error)) AlertRuleTemplatesListPage { 1347 return AlertRuleTemplatesListPage{ 1348 fn: getNextPage, 1349 artl: cur, 1350 } 1351} 1352 1353// AlertsDataTypeOfDataConnector alerts data type for data connectors. 1354type AlertsDataTypeOfDataConnector struct { 1355 // Alerts - Alerts data type connection. 1356 Alerts *DataConnectorDataTypeCommon `json:"alerts,omitempty"` 1357} 1358 1359// ASCDataConnector represents ASC (Azure Security Center) data connector. 1360type ASCDataConnector struct { 1361 // ASCDataConnectorProperties - ASC (Azure Security Center) data connector properties. 1362 *ASCDataConnectorProperties `json:"properties,omitempty"` 1363 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 1364 Kind KindBasicDataConnector `json:"kind,omitempty"` 1365 // ID - READ-ONLY; Azure resource Id 1366 ID *string `json:"id,omitempty"` 1367 // Name - READ-ONLY; Azure resource name 1368 Name *string `json:"name,omitempty"` 1369 // Type - READ-ONLY; Azure resource type 1370 Type *string `json:"type,omitempty"` 1371 // Etag - Etag of the azure resource 1372 Etag *string `json:"etag,omitempty"` 1373} 1374 1375// MarshalJSON is the custom marshaler for ASCDataConnector. 1376func (adc ASCDataConnector) MarshalJSON() ([]byte, error) { 1377 adc.Kind = KindBasicDataConnectorKindAzureSecurityCenter 1378 objectMap := make(map[string]interface{}) 1379 if adc.ASCDataConnectorProperties != nil { 1380 objectMap["properties"] = adc.ASCDataConnectorProperties 1381 } 1382 if adc.Kind != "" { 1383 objectMap["kind"] = adc.Kind 1384 } 1385 if adc.Etag != nil { 1386 objectMap["etag"] = adc.Etag 1387 } 1388 return json.Marshal(objectMap) 1389} 1390 1391// AsAADDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1392func (adc ASCDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 1393 return nil, false 1394} 1395 1396// AsAATPDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1397func (adc ASCDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 1398 return nil, false 1399} 1400 1401// AsASCDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1402func (adc ASCDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 1403 return &adc, true 1404} 1405 1406// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1407func (adc ASCDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 1408 return nil, false 1409} 1410 1411// AsMCASDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1412func (adc ASCDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 1413 return nil, false 1414} 1415 1416// AsMDATPDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1417func (adc ASCDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 1418 return nil, false 1419} 1420 1421// AsOfficeDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1422func (adc ASCDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 1423 return nil, false 1424} 1425 1426// AsTIDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1427func (adc ASCDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 1428 return nil, false 1429} 1430 1431// AsDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1432func (adc ASCDataConnector) AsDataConnector() (*DataConnector, bool) { 1433 return nil, false 1434} 1435 1436// AsBasicDataConnector is the BasicDataConnector implementation for ASCDataConnector. 1437func (adc ASCDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 1438 return &adc, true 1439} 1440 1441// UnmarshalJSON is the custom unmarshaler for ASCDataConnector struct. 1442func (adc *ASCDataConnector) UnmarshalJSON(body []byte) error { 1443 var m map[string]*json.RawMessage 1444 err := json.Unmarshal(body, &m) 1445 if err != nil { 1446 return err 1447 } 1448 for k, v := range m { 1449 switch k { 1450 case "properties": 1451 if v != nil { 1452 var aSCDataConnectorProperties ASCDataConnectorProperties 1453 err = json.Unmarshal(*v, &aSCDataConnectorProperties) 1454 if err != nil { 1455 return err 1456 } 1457 adc.ASCDataConnectorProperties = &aSCDataConnectorProperties 1458 } 1459 case "kind": 1460 if v != nil { 1461 var kind KindBasicDataConnector 1462 err = json.Unmarshal(*v, &kind) 1463 if err != nil { 1464 return err 1465 } 1466 adc.Kind = kind 1467 } 1468 case "id": 1469 if v != nil { 1470 var ID string 1471 err = json.Unmarshal(*v, &ID) 1472 if err != nil { 1473 return err 1474 } 1475 adc.ID = &ID 1476 } 1477 case "name": 1478 if v != nil { 1479 var name string 1480 err = json.Unmarshal(*v, &name) 1481 if err != nil { 1482 return err 1483 } 1484 adc.Name = &name 1485 } 1486 case "type": 1487 if v != nil { 1488 var typeVar string 1489 err = json.Unmarshal(*v, &typeVar) 1490 if err != nil { 1491 return err 1492 } 1493 adc.Type = &typeVar 1494 } 1495 case "etag": 1496 if v != nil { 1497 var etag string 1498 err = json.Unmarshal(*v, &etag) 1499 if err != nil { 1500 return err 1501 } 1502 adc.Etag = &etag 1503 } 1504 } 1505 } 1506 1507 return nil 1508} 1509 1510// ASCDataConnectorProperties ASC (Azure Security Center) data connector properties. 1511type ASCDataConnectorProperties struct { 1512 // SubscriptionID - The subscription id to connect to, and get the data from. 1513 SubscriptionID *string `json:"subscriptionId,omitempty"` 1514 // DataTypes - The available data types for the connector. 1515 DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` 1516} 1517 1518// AwsCloudTrailDataConnector represents Amazon Web Services CloudTrail data connector. 1519type AwsCloudTrailDataConnector struct { 1520 // AwsCloudTrailDataConnectorProperties - Amazon Web Services CloudTrail data connector properties. 1521 *AwsCloudTrailDataConnectorProperties `json:"properties,omitempty"` 1522 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 1523 Kind KindBasicDataConnector `json:"kind,omitempty"` 1524 // ID - READ-ONLY; Azure resource Id 1525 ID *string `json:"id,omitempty"` 1526 // Name - READ-ONLY; Azure resource name 1527 Name *string `json:"name,omitempty"` 1528 // Type - READ-ONLY; Azure resource type 1529 Type *string `json:"type,omitempty"` 1530 // Etag - Etag of the azure resource 1531 Etag *string `json:"etag,omitempty"` 1532} 1533 1534// MarshalJSON is the custom marshaler for AwsCloudTrailDataConnector. 1535func (actdc AwsCloudTrailDataConnector) MarshalJSON() ([]byte, error) { 1536 actdc.Kind = KindBasicDataConnectorKindAmazonWebServicesCloudTrail 1537 objectMap := make(map[string]interface{}) 1538 if actdc.AwsCloudTrailDataConnectorProperties != nil { 1539 objectMap["properties"] = actdc.AwsCloudTrailDataConnectorProperties 1540 } 1541 if actdc.Kind != "" { 1542 objectMap["kind"] = actdc.Kind 1543 } 1544 if actdc.Etag != nil { 1545 objectMap["etag"] = actdc.Etag 1546 } 1547 return json.Marshal(objectMap) 1548} 1549 1550// AsAADDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1551func (actdc AwsCloudTrailDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 1552 return nil, false 1553} 1554 1555// AsAATPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1556func (actdc AwsCloudTrailDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 1557 return nil, false 1558} 1559 1560// AsASCDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1561func (actdc AwsCloudTrailDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 1562 return nil, false 1563} 1564 1565// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1566func (actdc AwsCloudTrailDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 1567 return &actdc, true 1568} 1569 1570// AsMCASDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1571func (actdc AwsCloudTrailDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 1572 return nil, false 1573} 1574 1575// AsMDATPDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1576func (actdc AwsCloudTrailDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 1577 return nil, false 1578} 1579 1580// AsOfficeDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1581func (actdc AwsCloudTrailDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 1582 return nil, false 1583} 1584 1585// AsTIDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1586func (actdc AwsCloudTrailDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 1587 return nil, false 1588} 1589 1590// AsDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1591func (actdc AwsCloudTrailDataConnector) AsDataConnector() (*DataConnector, bool) { 1592 return nil, false 1593} 1594 1595// AsBasicDataConnector is the BasicDataConnector implementation for AwsCloudTrailDataConnector. 1596func (actdc AwsCloudTrailDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 1597 return &actdc, true 1598} 1599 1600// UnmarshalJSON is the custom unmarshaler for AwsCloudTrailDataConnector struct. 1601func (actdc *AwsCloudTrailDataConnector) UnmarshalJSON(body []byte) error { 1602 var m map[string]*json.RawMessage 1603 err := json.Unmarshal(body, &m) 1604 if err != nil { 1605 return err 1606 } 1607 for k, v := range m { 1608 switch k { 1609 case "properties": 1610 if v != nil { 1611 var awsCloudTrailDataConnectorProperties AwsCloudTrailDataConnectorProperties 1612 err = json.Unmarshal(*v, &awsCloudTrailDataConnectorProperties) 1613 if err != nil { 1614 return err 1615 } 1616 actdc.AwsCloudTrailDataConnectorProperties = &awsCloudTrailDataConnectorProperties 1617 } 1618 case "kind": 1619 if v != nil { 1620 var kind KindBasicDataConnector 1621 err = json.Unmarshal(*v, &kind) 1622 if err != nil { 1623 return err 1624 } 1625 actdc.Kind = kind 1626 } 1627 case "id": 1628 if v != nil { 1629 var ID string 1630 err = json.Unmarshal(*v, &ID) 1631 if err != nil { 1632 return err 1633 } 1634 actdc.ID = &ID 1635 } 1636 case "name": 1637 if v != nil { 1638 var name string 1639 err = json.Unmarshal(*v, &name) 1640 if err != nil { 1641 return err 1642 } 1643 actdc.Name = &name 1644 } 1645 case "type": 1646 if v != nil { 1647 var typeVar string 1648 err = json.Unmarshal(*v, &typeVar) 1649 if err != nil { 1650 return err 1651 } 1652 actdc.Type = &typeVar 1653 } 1654 case "etag": 1655 if v != nil { 1656 var etag string 1657 err = json.Unmarshal(*v, &etag) 1658 if err != nil { 1659 return err 1660 } 1661 actdc.Etag = &etag 1662 } 1663 } 1664 } 1665 1666 return nil 1667} 1668 1669// AwsCloudTrailDataConnectorDataTypes the available data types for Amazon Web Services CloudTrail data 1670// connector. 1671type AwsCloudTrailDataConnectorDataTypes struct { 1672 // Logs - Logs data type. 1673 Logs *AwsCloudTrailDataConnectorDataTypesLogs `json:"logs,omitempty"` 1674} 1675 1676// AwsCloudTrailDataConnectorDataTypesLogs logs data type. 1677type AwsCloudTrailDataConnectorDataTypesLogs struct { 1678 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 1679 State DataTypeState `json:"state,omitempty"` 1680} 1681 1682// AwsCloudTrailDataConnectorProperties amazon Web Services CloudTrail data connector properties. 1683type AwsCloudTrailDataConnectorProperties struct { 1684 // AwsRoleArn - The Aws Role Arn (with CloudTrailReadOnly policy) that is used to access the Aws account. 1685 AwsRoleArn *string `json:"awsRoleArn,omitempty"` 1686 // DataTypes - The available data types for the connector. 1687 DataTypes *AwsCloudTrailDataConnectorDataTypes `json:"dataTypes,omitempty"` 1688} 1689 1690// Bookmark represents a bookmark in Azure Security Insights. 1691type Bookmark struct { 1692 autorest.Response `json:"-"` 1693 // BookmarkProperties - Bookmark properties 1694 *BookmarkProperties `json:"properties,omitempty"` 1695 // ID - READ-ONLY; Azure resource Id 1696 ID *string `json:"id,omitempty"` 1697 // Name - READ-ONLY; Azure resource name 1698 Name *string `json:"name,omitempty"` 1699 // Type - READ-ONLY; Azure resource type 1700 Type *string `json:"type,omitempty"` 1701 // Etag - Etag of the azure resource 1702 Etag *string `json:"etag,omitempty"` 1703} 1704 1705// MarshalJSON is the custom marshaler for Bookmark. 1706func (b Bookmark) MarshalJSON() ([]byte, error) { 1707 objectMap := make(map[string]interface{}) 1708 if b.BookmarkProperties != nil { 1709 objectMap["properties"] = b.BookmarkProperties 1710 } 1711 if b.Etag != nil { 1712 objectMap["etag"] = b.Etag 1713 } 1714 return json.Marshal(objectMap) 1715} 1716 1717// UnmarshalJSON is the custom unmarshaler for Bookmark struct. 1718func (b *Bookmark) UnmarshalJSON(body []byte) error { 1719 var m map[string]*json.RawMessage 1720 err := json.Unmarshal(body, &m) 1721 if err != nil { 1722 return err 1723 } 1724 for k, v := range m { 1725 switch k { 1726 case "properties": 1727 if v != nil { 1728 var bookmarkProperties BookmarkProperties 1729 err = json.Unmarshal(*v, &bookmarkProperties) 1730 if err != nil { 1731 return err 1732 } 1733 b.BookmarkProperties = &bookmarkProperties 1734 } 1735 case "id": 1736 if v != nil { 1737 var ID string 1738 err = json.Unmarshal(*v, &ID) 1739 if err != nil { 1740 return err 1741 } 1742 b.ID = &ID 1743 } 1744 case "name": 1745 if v != nil { 1746 var name string 1747 err = json.Unmarshal(*v, &name) 1748 if err != nil { 1749 return err 1750 } 1751 b.Name = &name 1752 } 1753 case "type": 1754 if v != nil { 1755 var typeVar string 1756 err = json.Unmarshal(*v, &typeVar) 1757 if err != nil { 1758 return err 1759 } 1760 b.Type = &typeVar 1761 } 1762 case "etag": 1763 if v != nil { 1764 var etag string 1765 err = json.Unmarshal(*v, &etag) 1766 if err != nil { 1767 return err 1768 } 1769 b.Etag = &etag 1770 } 1771 } 1772 } 1773 1774 return nil 1775} 1776 1777// BookmarkList list all the bookmarks. 1778type BookmarkList struct { 1779 autorest.Response `json:"-"` 1780 // NextLink - READ-ONLY; URL to fetch the next set of cases. 1781 NextLink *string `json:"nextLink,omitempty"` 1782 // Value - Array of bookmarks. 1783 Value *[]Bookmark `json:"value,omitempty"` 1784} 1785 1786// MarshalJSON is the custom marshaler for BookmarkList. 1787func (bl BookmarkList) MarshalJSON() ([]byte, error) { 1788 objectMap := make(map[string]interface{}) 1789 if bl.Value != nil { 1790 objectMap["value"] = bl.Value 1791 } 1792 return json.Marshal(objectMap) 1793} 1794 1795// BookmarkListIterator provides access to a complete listing of Bookmark values. 1796type BookmarkListIterator struct { 1797 i int 1798 page BookmarkListPage 1799} 1800 1801// NextWithContext advances to the next value. If there was an error making 1802// the request the iterator does not advance and the error is returned. 1803func (iter *BookmarkListIterator) NextWithContext(ctx context.Context) (err error) { 1804 if tracing.IsEnabled() { 1805 ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkListIterator.NextWithContext") 1806 defer func() { 1807 sc := -1 1808 if iter.Response().Response.Response != nil { 1809 sc = iter.Response().Response.Response.StatusCode 1810 } 1811 tracing.EndSpan(ctx, sc, err) 1812 }() 1813 } 1814 iter.i++ 1815 if iter.i < len(iter.page.Values()) { 1816 return nil 1817 } 1818 err = iter.page.NextWithContext(ctx) 1819 if err != nil { 1820 iter.i-- 1821 return err 1822 } 1823 iter.i = 0 1824 return nil 1825} 1826 1827// Next advances to the next value. If there was an error making 1828// the request the iterator does not advance and the error is returned. 1829// Deprecated: Use NextWithContext() instead. 1830func (iter *BookmarkListIterator) Next() error { 1831 return iter.NextWithContext(context.Background()) 1832} 1833 1834// NotDone returns true if the enumeration should be started or is not yet complete. 1835func (iter BookmarkListIterator) NotDone() bool { 1836 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1837} 1838 1839// Response returns the raw server response from the last page request. 1840func (iter BookmarkListIterator) Response() BookmarkList { 1841 return iter.page.Response() 1842} 1843 1844// Value returns the current value or a zero-initialized value if the 1845// iterator has advanced beyond the end of the collection. 1846func (iter BookmarkListIterator) Value() Bookmark { 1847 if !iter.page.NotDone() { 1848 return Bookmark{} 1849 } 1850 return iter.page.Values()[iter.i] 1851} 1852 1853// Creates a new instance of the BookmarkListIterator type. 1854func NewBookmarkListIterator(page BookmarkListPage) BookmarkListIterator { 1855 return BookmarkListIterator{page: page} 1856} 1857 1858// IsEmpty returns true if the ListResult contains no values. 1859func (bl BookmarkList) IsEmpty() bool { 1860 return bl.Value == nil || len(*bl.Value) == 0 1861} 1862 1863// hasNextLink returns true if the NextLink is not empty. 1864func (bl BookmarkList) hasNextLink() bool { 1865 return bl.NextLink != nil && len(*bl.NextLink) != 0 1866} 1867 1868// bookmarkListPreparer prepares a request to retrieve the next set of results. 1869// It returns nil if no more results exist. 1870func (bl BookmarkList) bookmarkListPreparer(ctx context.Context) (*http.Request, error) { 1871 if !bl.hasNextLink() { 1872 return nil, nil 1873 } 1874 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1875 autorest.AsJSON(), 1876 autorest.AsGet(), 1877 autorest.WithBaseURL(to.String(bl.NextLink))) 1878} 1879 1880// BookmarkListPage contains a page of Bookmark values. 1881type BookmarkListPage struct { 1882 fn func(context.Context, BookmarkList) (BookmarkList, error) 1883 bl BookmarkList 1884} 1885 1886// NextWithContext advances to the next page of values. If there was an error making 1887// the request the page does not advance and the error is returned. 1888func (page *BookmarkListPage) NextWithContext(ctx context.Context) (err error) { 1889 if tracing.IsEnabled() { 1890 ctx = tracing.StartSpan(ctx, fqdn+"/BookmarkListPage.NextWithContext") 1891 defer func() { 1892 sc := -1 1893 if page.Response().Response.Response != nil { 1894 sc = page.Response().Response.Response.StatusCode 1895 } 1896 tracing.EndSpan(ctx, sc, err) 1897 }() 1898 } 1899 for { 1900 next, err := page.fn(ctx, page.bl) 1901 if err != nil { 1902 return err 1903 } 1904 page.bl = next 1905 if !next.hasNextLink() || !next.IsEmpty() { 1906 break 1907 } 1908 } 1909 return nil 1910} 1911 1912// Next advances to the next page of values. If there was an error making 1913// the request the page does not advance and the error is returned. 1914// Deprecated: Use NextWithContext() instead. 1915func (page *BookmarkListPage) Next() error { 1916 return page.NextWithContext(context.Background()) 1917} 1918 1919// NotDone returns true if the page enumeration should be started or is not yet complete. 1920func (page BookmarkListPage) NotDone() bool { 1921 return !page.bl.IsEmpty() 1922} 1923 1924// Response returns the raw server response from the last page request. 1925func (page BookmarkListPage) Response() BookmarkList { 1926 return page.bl 1927} 1928 1929// Values returns the slice of values for the current page or nil if there are no values. 1930func (page BookmarkListPage) Values() []Bookmark { 1931 if page.bl.IsEmpty() { 1932 return nil 1933 } 1934 return *page.bl.Value 1935} 1936 1937// Creates a new instance of the BookmarkListPage type. 1938func NewBookmarkListPage(cur BookmarkList, getNextPage func(context.Context, BookmarkList) (BookmarkList, error)) BookmarkListPage { 1939 return BookmarkListPage{ 1940 fn: getNextPage, 1941 bl: cur, 1942 } 1943} 1944 1945// BookmarkProperties describes bookmark properties 1946type BookmarkProperties struct { 1947 // Created - The time the bookmark was created 1948 Created *date.Time `json:"created,omitempty"` 1949 // CreatedBy - Describes a user that created the bookmark 1950 CreatedBy *UserInfo `json:"createdBy,omitempty"` 1951 // DisplayName - The display name of the bookmark 1952 DisplayName *string `json:"displayName,omitempty"` 1953 // Labels - List of labels relevant to this bookmark 1954 Labels *[]string `json:"labels,omitempty"` 1955 // Notes - The notes of the bookmark 1956 Notes *string `json:"notes,omitempty"` 1957 // Query - The query of the bookmark. 1958 Query *string `json:"query,omitempty"` 1959 // QueryResult - The query result of the bookmark. 1960 QueryResult *string `json:"queryResult,omitempty"` 1961 // Updated - The last time the bookmark was updated 1962 Updated *date.Time `json:"updated,omitempty"` 1963 // UpdatedBy - Describes a user that updated the bookmark 1964 UpdatedBy *UserInfo `json:"updatedBy,omitempty"` 1965 // EventTime - The bookmark event time 1966 EventTime *date.Time `json:"eventTime,omitempty"` 1967 // QueryStartTime - The start time for the query 1968 QueryStartTime *date.Time `json:"queryStartTime,omitempty"` 1969 // QueryEndTime - The end time for the query 1970 QueryEndTime *date.Time `json:"queryEndTime,omitempty"` 1971 // IncidentInfo - Describes an incident that relates to bookmark 1972 IncidentInfo *IncidentInfo `json:"incidentInfo,omitempty"` 1973} 1974 1975// ClientInfo information on the client (user or application) that made some action 1976type ClientInfo struct { 1977 // Email - The email of the client. 1978 Email *string `json:"email,omitempty"` 1979 // Name - The name of the client. 1980 Name *string `json:"name,omitempty"` 1981 // ObjectID - The object id of the client. 1982 ObjectID *uuid.UUID `json:"objectId,omitempty"` 1983 // UserPrincipalName - The user principal name of the client. 1984 UserPrincipalName *string `json:"userPrincipalName,omitempty"` 1985} 1986 1987// CloudError an error response for a resource management request. 1988type CloudError struct { 1989 // Error - The error object of the CloudError response 1990 Error *ErrorResponse `json:"error,omitempty"` 1991} 1992 1993// BasicDataConnector data connector. 1994type BasicDataConnector interface { 1995 AsAADDataConnector() (*AADDataConnector, bool) 1996 AsAATPDataConnector() (*AATPDataConnector, bool) 1997 AsASCDataConnector() (*ASCDataConnector, bool) 1998 AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) 1999 AsMCASDataConnector() (*MCASDataConnector, bool) 2000 AsMDATPDataConnector() (*MDATPDataConnector, bool) 2001 AsOfficeDataConnector() (*OfficeDataConnector, bool) 2002 AsTIDataConnector() (*TIDataConnector, bool) 2003 AsDataConnector() (*DataConnector, bool) 2004} 2005 2006// DataConnector data connector. 2007type DataConnector struct { 2008 autorest.Response `json:"-"` 2009 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 2010 Kind KindBasicDataConnector `json:"kind,omitempty"` 2011 // ID - READ-ONLY; Azure resource Id 2012 ID *string `json:"id,omitempty"` 2013 // Name - READ-ONLY; Azure resource name 2014 Name *string `json:"name,omitempty"` 2015 // Type - READ-ONLY; Azure resource type 2016 Type *string `json:"type,omitempty"` 2017 // Etag - Etag of the azure resource 2018 Etag *string `json:"etag,omitempty"` 2019} 2020 2021func unmarshalBasicDataConnector(body []byte) (BasicDataConnector, error) { 2022 var m map[string]interface{} 2023 err := json.Unmarshal(body, &m) 2024 if err != nil { 2025 return nil, err 2026 } 2027 2028 switch m["kind"] { 2029 case string(KindBasicDataConnectorKindAzureActiveDirectory): 2030 var adc AADDataConnector 2031 err := json.Unmarshal(body, &adc) 2032 return adc, err 2033 case string(KindBasicDataConnectorKindAzureAdvancedThreatProtection): 2034 var adc AATPDataConnector 2035 err := json.Unmarshal(body, &adc) 2036 return adc, err 2037 case string(KindBasicDataConnectorKindAzureSecurityCenter): 2038 var adc ASCDataConnector 2039 err := json.Unmarshal(body, &adc) 2040 return adc, err 2041 case string(KindBasicDataConnectorKindAmazonWebServicesCloudTrail): 2042 var actdc AwsCloudTrailDataConnector 2043 err := json.Unmarshal(body, &actdc) 2044 return actdc, err 2045 case string(KindBasicDataConnectorKindMicrosoftCloudAppSecurity): 2046 var mdc MCASDataConnector 2047 err := json.Unmarshal(body, &mdc) 2048 return mdc, err 2049 case string(KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection): 2050 var mdc MDATPDataConnector 2051 err := json.Unmarshal(body, &mdc) 2052 return mdc, err 2053 case string(KindBasicDataConnectorKindOffice365): 2054 var odc OfficeDataConnector 2055 err := json.Unmarshal(body, &odc) 2056 return odc, err 2057 case string(KindBasicDataConnectorKindThreatIntelligence): 2058 var tdc TIDataConnector 2059 err := json.Unmarshal(body, &tdc) 2060 return tdc, err 2061 default: 2062 var dc DataConnector 2063 err := json.Unmarshal(body, &dc) 2064 return dc, err 2065 } 2066} 2067func unmarshalBasicDataConnectorArray(body []byte) ([]BasicDataConnector, error) { 2068 var rawMessages []*json.RawMessage 2069 err := json.Unmarshal(body, &rawMessages) 2070 if err != nil { 2071 return nil, err 2072 } 2073 2074 dcArray := make([]BasicDataConnector, len(rawMessages)) 2075 2076 for index, rawMessage := range rawMessages { 2077 dc, err := unmarshalBasicDataConnector(*rawMessage) 2078 if err != nil { 2079 return nil, err 2080 } 2081 dcArray[index] = dc 2082 } 2083 return dcArray, nil 2084} 2085 2086// MarshalJSON is the custom marshaler for DataConnector. 2087func (dc DataConnector) MarshalJSON() ([]byte, error) { 2088 dc.Kind = KindBasicDataConnectorKindDataConnector 2089 objectMap := make(map[string]interface{}) 2090 if dc.Kind != "" { 2091 objectMap["kind"] = dc.Kind 2092 } 2093 if dc.Etag != nil { 2094 objectMap["etag"] = dc.Etag 2095 } 2096 return json.Marshal(objectMap) 2097} 2098 2099// AsAADDataConnector is the BasicDataConnector implementation for DataConnector. 2100func (dc DataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 2101 return nil, false 2102} 2103 2104// AsAATPDataConnector is the BasicDataConnector implementation for DataConnector. 2105func (dc DataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 2106 return nil, false 2107} 2108 2109// AsASCDataConnector is the BasicDataConnector implementation for DataConnector. 2110func (dc DataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 2111 return nil, false 2112} 2113 2114// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for DataConnector. 2115func (dc DataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 2116 return nil, false 2117} 2118 2119// AsMCASDataConnector is the BasicDataConnector implementation for DataConnector. 2120func (dc DataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 2121 return nil, false 2122} 2123 2124// AsMDATPDataConnector is the BasicDataConnector implementation for DataConnector. 2125func (dc DataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 2126 return nil, false 2127} 2128 2129// AsOfficeDataConnector is the BasicDataConnector implementation for DataConnector. 2130func (dc DataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 2131 return nil, false 2132} 2133 2134// AsTIDataConnector is the BasicDataConnector implementation for DataConnector. 2135func (dc DataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 2136 return nil, false 2137} 2138 2139// AsDataConnector is the BasicDataConnector implementation for DataConnector. 2140func (dc DataConnector) AsDataConnector() (*DataConnector, bool) { 2141 return &dc, true 2142} 2143 2144// AsBasicDataConnector is the BasicDataConnector implementation for DataConnector. 2145func (dc DataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 2146 return &dc, true 2147} 2148 2149// DataConnectorDataTypeCommon common field for data type in data connectors. 2150type DataConnectorDataTypeCommon struct { 2151 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 2152 State DataTypeState `json:"state,omitempty"` 2153} 2154 2155// DataConnectorList list all the data connectors. 2156type DataConnectorList struct { 2157 autorest.Response `json:"-"` 2158 // NextLink - READ-ONLY; URL to fetch the next set of data connectors. 2159 NextLink *string `json:"nextLink,omitempty"` 2160 // Value - Array of data connectors. 2161 Value *[]BasicDataConnector `json:"value,omitempty"` 2162} 2163 2164// MarshalJSON is the custom marshaler for DataConnectorList. 2165func (dcl DataConnectorList) MarshalJSON() ([]byte, error) { 2166 objectMap := make(map[string]interface{}) 2167 if dcl.Value != nil { 2168 objectMap["value"] = dcl.Value 2169 } 2170 return json.Marshal(objectMap) 2171} 2172 2173// UnmarshalJSON is the custom unmarshaler for DataConnectorList struct. 2174func (dcl *DataConnectorList) UnmarshalJSON(body []byte) error { 2175 var m map[string]*json.RawMessage 2176 err := json.Unmarshal(body, &m) 2177 if err != nil { 2178 return err 2179 } 2180 for k, v := range m { 2181 switch k { 2182 case "nextLink": 2183 if v != nil { 2184 var nextLink string 2185 err = json.Unmarshal(*v, &nextLink) 2186 if err != nil { 2187 return err 2188 } 2189 dcl.NextLink = &nextLink 2190 } 2191 case "value": 2192 if v != nil { 2193 value, err := unmarshalBasicDataConnectorArray(*v) 2194 if err != nil { 2195 return err 2196 } 2197 dcl.Value = &value 2198 } 2199 } 2200 } 2201 2202 return nil 2203} 2204 2205// DataConnectorListIterator provides access to a complete listing of DataConnector values. 2206type DataConnectorListIterator struct { 2207 i int 2208 page DataConnectorListPage 2209} 2210 2211// NextWithContext advances to the next value. If there was an error making 2212// the request the iterator does not advance and the error is returned. 2213func (iter *DataConnectorListIterator) NextWithContext(ctx context.Context) (err error) { 2214 if tracing.IsEnabled() { 2215 ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorListIterator.NextWithContext") 2216 defer func() { 2217 sc := -1 2218 if iter.Response().Response.Response != nil { 2219 sc = iter.Response().Response.Response.StatusCode 2220 } 2221 tracing.EndSpan(ctx, sc, err) 2222 }() 2223 } 2224 iter.i++ 2225 if iter.i < len(iter.page.Values()) { 2226 return nil 2227 } 2228 err = iter.page.NextWithContext(ctx) 2229 if err != nil { 2230 iter.i-- 2231 return err 2232 } 2233 iter.i = 0 2234 return nil 2235} 2236 2237// Next advances to the next value. If there was an error making 2238// the request the iterator does not advance and the error is returned. 2239// Deprecated: Use NextWithContext() instead. 2240func (iter *DataConnectorListIterator) Next() error { 2241 return iter.NextWithContext(context.Background()) 2242} 2243 2244// NotDone returns true if the enumeration should be started or is not yet complete. 2245func (iter DataConnectorListIterator) NotDone() bool { 2246 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2247} 2248 2249// Response returns the raw server response from the last page request. 2250func (iter DataConnectorListIterator) Response() DataConnectorList { 2251 return iter.page.Response() 2252} 2253 2254// Value returns the current value or a zero-initialized value if the 2255// iterator has advanced beyond the end of the collection. 2256func (iter DataConnectorListIterator) Value() BasicDataConnector { 2257 if !iter.page.NotDone() { 2258 return DataConnector{} 2259 } 2260 return iter.page.Values()[iter.i] 2261} 2262 2263// Creates a new instance of the DataConnectorListIterator type. 2264func NewDataConnectorListIterator(page DataConnectorListPage) DataConnectorListIterator { 2265 return DataConnectorListIterator{page: page} 2266} 2267 2268// IsEmpty returns true if the ListResult contains no values. 2269func (dcl DataConnectorList) IsEmpty() bool { 2270 return dcl.Value == nil || len(*dcl.Value) == 0 2271} 2272 2273// hasNextLink returns true if the NextLink is not empty. 2274func (dcl DataConnectorList) hasNextLink() bool { 2275 return dcl.NextLink != nil && len(*dcl.NextLink) != 0 2276} 2277 2278// dataConnectorListPreparer prepares a request to retrieve the next set of results. 2279// It returns nil if no more results exist. 2280func (dcl DataConnectorList) dataConnectorListPreparer(ctx context.Context) (*http.Request, error) { 2281 if !dcl.hasNextLink() { 2282 return nil, nil 2283 } 2284 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2285 autorest.AsJSON(), 2286 autorest.AsGet(), 2287 autorest.WithBaseURL(to.String(dcl.NextLink))) 2288} 2289 2290// DataConnectorListPage contains a page of BasicDataConnector values. 2291type DataConnectorListPage struct { 2292 fn func(context.Context, DataConnectorList) (DataConnectorList, error) 2293 dcl DataConnectorList 2294} 2295 2296// NextWithContext advances to the next page of values. If there was an error making 2297// the request the page does not advance and the error is returned. 2298func (page *DataConnectorListPage) NextWithContext(ctx context.Context) (err error) { 2299 if tracing.IsEnabled() { 2300 ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectorListPage.NextWithContext") 2301 defer func() { 2302 sc := -1 2303 if page.Response().Response.Response != nil { 2304 sc = page.Response().Response.Response.StatusCode 2305 } 2306 tracing.EndSpan(ctx, sc, err) 2307 }() 2308 } 2309 for { 2310 next, err := page.fn(ctx, page.dcl) 2311 if err != nil { 2312 return err 2313 } 2314 page.dcl = next 2315 if !next.hasNextLink() || !next.IsEmpty() { 2316 break 2317 } 2318 } 2319 return nil 2320} 2321 2322// Next advances to the next page of values. If there was an error making 2323// the request the page does not advance and the error is returned. 2324// Deprecated: Use NextWithContext() instead. 2325func (page *DataConnectorListPage) Next() error { 2326 return page.NextWithContext(context.Background()) 2327} 2328 2329// NotDone returns true if the page enumeration should be started or is not yet complete. 2330func (page DataConnectorListPage) NotDone() bool { 2331 return !page.dcl.IsEmpty() 2332} 2333 2334// Response returns the raw server response from the last page request. 2335func (page DataConnectorListPage) Response() DataConnectorList { 2336 return page.dcl 2337} 2338 2339// Values returns the slice of values for the current page or nil if there are no values. 2340func (page DataConnectorListPage) Values() []BasicDataConnector { 2341 if page.dcl.IsEmpty() { 2342 return nil 2343 } 2344 return *page.dcl.Value 2345} 2346 2347// Creates a new instance of the DataConnectorListPage type. 2348func NewDataConnectorListPage(cur DataConnectorList, getNextPage func(context.Context, DataConnectorList) (DataConnectorList, error)) DataConnectorListPage { 2349 return DataConnectorListPage{ 2350 fn: getNextPage, 2351 dcl: cur, 2352 } 2353} 2354 2355// DataConnectorModel ... 2356type DataConnectorModel struct { 2357 autorest.Response `json:"-"` 2358 Value BasicDataConnector `json:"value,omitempty"` 2359} 2360 2361// UnmarshalJSON is the custom unmarshaler for DataConnectorModel struct. 2362func (dcm *DataConnectorModel) UnmarshalJSON(body []byte) error { 2363 dc, err := unmarshalBasicDataConnector(body) 2364 if err != nil { 2365 return err 2366 } 2367 dcm.Value = dc 2368 2369 return nil 2370} 2371 2372// DataConnectorTenantID properties data connector on tenant level. 2373type DataConnectorTenantID struct { 2374 // TenantID - The tenant id to connect to, and get the data from. 2375 TenantID *string `json:"tenantId,omitempty"` 2376} 2377 2378// DataConnectorWithAlertsProperties data connector properties. 2379type DataConnectorWithAlertsProperties struct { 2380 // DataTypes - The available data types for the connector. 2381 DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` 2382} 2383 2384// ErrorAdditionalInfo the resource management error additional info. 2385type ErrorAdditionalInfo struct { 2386 // Type - READ-ONLY; The additional info type. 2387 Type *string `json:"type,omitempty"` 2388 // Info - READ-ONLY; The additional info. 2389 Info interface{} `json:"info,omitempty"` 2390} 2391 2392// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 2393func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 2394 objectMap := make(map[string]interface{}) 2395 return json.Marshal(objectMap) 2396} 2397 2398// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 2399// failed operations. (This also follows the OData error response format.) 2400type ErrorResponse struct { 2401 // Code - READ-ONLY; The error code. 2402 Code *string `json:"code,omitempty"` 2403 // Message - READ-ONLY; The error message. 2404 Message *string `json:"message,omitempty"` 2405 // Target - READ-ONLY; The error target. 2406 Target *string `json:"target,omitempty"` 2407 // Details - READ-ONLY; The error details. 2408 Details *[]ErrorResponse `json:"details,omitempty"` 2409 // AdditionalInfo - READ-ONLY; The error additional info. 2410 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 2411} 2412 2413// MarshalJSON is the custom marshaler for ErrorResponse. 2414func (er ErrorResponse) MarshalJSON() ([]byte, error) { 2415 objectMap := make(map[string]interface{}) 2416 return json.Marshal(objectMap) 2417} 2418 2419// FusionAlertRule represents Fusion alert rule. 2420type FusionAlertRule struct { 2421 // FusionAlertRuleProperties - Fusion alert rule properties 2422 *FusionAlertRuleProperties `json:"properties,omitempty"` 2423 // Kind - Possible values include: 'KindAlertRule', 'KindFusion', 'KindMicrosoftSecurityIncidentCreation', 'KindScheduled' 2424 Kind Kind `json:"kind,omitempty"` 2425 // ID - READ-ONLY; Azure resource Id 2426 ID *string `json:"id,omitempty"` 2427 // Name - READ-ONLY; Azure resource name 2428 Name *string `json:"name,omitempty"` 2429 // Type - READ-ONLY; Azure resource type 2430 Type *string `json:"type,omitempty"` 2431 // Etag - Etag of the azure resource 2432 Etag *string `json:"etag,omitempty"` 2433} 2434 2435// MarshalJSON is the custom marshaler for FusionAlertRule. 2436func (far FusionAlertRule) MarshalJSON() ([]byte, error) { 2437 far.Kind = KindFusion 2438 objectMap := make(map[string]interface{}) 2439 if far.FusionAlertRuleProperties != nil { 2440 objectMap["properties"] = far.FusionAlertRuleProperties 2441 } 2442 if far.Kind != "" { 2443 objectMap["kind"] = far.Kind 2444 } 2445 if far.Etag != nil { 2446 objectMap["etag"] = far.Etag 2447 } 2448 return json.Marshal(objectMap) 2449} 2450 2451// AsFusionAlertRule is the BasicAlertRule implementation for FusionAlertRule. 2452func (far FusionAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { 2453 return &far, true 2454} 2455 2456// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for FusionAlertRule. 2457func (far FusionAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { 2458 return nil, false 2459} 2460 2461// AsScheduledAlertRule is the BasicAlertRule implementation for FusionAlertRule. 2462func (far FusionAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { 2463 return nil, false 2464} 2465 2466// AsAlertRule is the BasicAlertRule implementation for FusionAlertRule. 2467func (far FusionAlertRule) AsAlertRule() (*AlertRule, bool) { 2468 return nil, false 2469} 2470 2471// AsBasicAlertRule is the BasicAlertRule implementation for FusionAlertRule. 2472func (far FusionAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { 2473 return &far, true 2474} 2475 2476// UnmarshalJSON is the custom unmarshaler for FusionAlertRule struct. 2477func (far *FusionAlertRule) UnmarshalJSON(body []byte) error { 2478 var m map[string]*json.RawMessage 2479 err := json.Unmarshal(body, &m) 2480 if err != nil { 2481 return err 2482 } 2483 for k, v := range m { 2484 switch k { 2485 case "properties": 2486 if v != nil { 2487 var fusionAlertRuleProperties FusionAlertRuleProperties 2488 err = json.Unmarshal(*v, &fusionAlertRuleProperties) 2489 if err != nil { 2490 return err 2491 } 2492 far.FusionAlertRuleProperties = &fusionAlertRuleProperties 2493 } 2494 case "kind": 2495 if v != nil { 2496 var kind Kind 2497 err = json.Unmarshal(*v, &kind) 2498 if err != nil { 2499 return err 2500 } 2501 far.Kind = kind 2502 } 2503 case "id": 2504 if v != nil { 2505 var ID string 2506 err = json.Unmarshal(*v, &ID) 2507 if err != nil { 2508 return err 2509 } 2510 far.ID = &ID 2511 } 2512 case "name": 2513 if v != nil { 2514 var name string 2515 err = json.Unmarshal(*v, &name) 2516 if err != nil { 2517 return err 2518 } 2519 far.Name = &name 2520 } 2521 case "type": 2522 if v != nil { 2523 var typeVar string 2524 err = json.Unmarshal(*v, &typeVar) 2525 if err != nil { 2526 return err 2527 } 2528 far.Type = &typeVar 2529 } 2530 case "etag": 2531 if v != nil { 2532 var etag string 2533 err = json.Unmarshal(*v, &etag) 2534 if err != nil { 2535 return err 2536 } 2537 far.Etag = &etag 2538 } 2539 } 2540 } 2541 2542 return nil 2543} 2544 2545// FusionAlertRuleProperties fusion alert rule base property bag. 2546type FusionAlertRuleProperties struct { 2547 // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. 2548 AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` 2549 // Description - READ-ONLY; The description of the alert rule. 2550 Description *string `json:"description,omitempty"` 2551 // DisplayName - READ-ONLY; The display name for alerts created by this alert rule. 2552 DisplayName *string `json:"displayName,omitempty"` 2553 // Enabled - Determines whether this alert rule is enabled or disabled. 2554 Enabled *bool `json:"enabled,omitempty"` 2555 // LastModifiedUtc - READ-ONLY; The last time that this alert has been modified. 2556 LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` 2557 // Severity - READ-ONLY; The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' 2558 Severity AlertSeverity `json:"severity,omitempty"` 2559 // Tactics - READ-ONLY; The tactics of the alert rule 2560 Tactics *[]AttackTactic `json:"tactics,omitempty"` 2561} 2562 2563// MarshalJSON is the custom marshaler for FusionAlertRuleProperties. 2564func (farp FusionAlertRuleProperties) MarshalJSON() ([]byte, error) { 2565 objectMap := make(map[string]interface{}) 2566 if farp.AlertRuleTemplateName != nil { 2567 objectMap["alertRuleTemplateName"] = farp.AlertRuleTemplateName 2568 } 2569 if farp.Enabled != nil { 2570 objectMap["enabled"] = farp.Enabled 2571 } 2572 return json.Marshal(objectMap) 2573} 2574 2575// FusionAlertRuleTemplate represents Fusion alert rule template. 2576type FusionAlertRuleTemplate struct { 2577 // FusionAlertRuleTemplateProperties - Fusion alert rule template properties 2578 *FusionAlertRuleTemplateProperties `json:"properties,omitempty"` 2579 // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled' 2580 Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` 2581 // ID - READ-ONLY; Azure resource Id 2582 ID *string `json:"id,omitempty"` 2583 // Name - READ-ONLY; Azure resource name 2584 Name *string `json:"name,omitempty"` 2585 // Type - READ-ONLY; Azure resource type 2586 Type *string `json:"type,omitempty"` 2587} 2588 2589// MarshalJSON is the custom marshaler for FusionAlertRuleTemplate. 2590func (fart FusionAlertRuleTemplate) MarshalJSON() ([]byte, error) { 2591 fart.Kind = KindBasicAlertRuleTemplateKindFusion 2592 objectMap := make(map[string]interface{}) 2593 if fart.FusionAlertRuleTemplateProperties != nil { 2594 objectMap["properties"] = fart.FusionAlertRuleTemplateProperties 2595 } 2596 if fart.Kind != "" { 2597 objectMap["kind"] = fart.Kind 2598 } 2599 return json.Marshal(objectMap) 2600} 2601 2602// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. 2603func (fart FusionAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { 2604 return &fart, true 2605} 2606 2607// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. 2608func (fart FusionAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { 2609 return nil, false 2610} 2611 2612// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. 2613func (fart FusionAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { 2614 return nil, false 2615} 2616 2617// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. 2618func (fart FusionAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { 2619 return nil, false 2620} 2621 2622// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for FusionAlertRuleTemplate. 2623func (fart FusionAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { 2624 return &fart, true 2625} 2626 2627// UnmarshalJSON is the custom unmarshaler for FusionAlertRuleTemplate struct. 2628func (fart *FusionAlertRuleTemplate) UnmarshalJSON(body []byte) error { 2629 var m map[string]*json.RawMessage 2630 err := json.Unmarshal(body, &m) 2631 if err != nil { 2632 return err 2633 } 2634 for k, v := range m { 2635 switch k { 2636 case "properties": 2637 if v != nil { 2638 var fusionAlertRuleTemplateProperties FusionAlertRuleTemplateProperties 2639 err = json.Unmarshal(*v, &fusionAlertRuleTemplateProperties) 2640 if err != nil { 2641 return err 2642 } 2643 fart.FusionAlertRuleTemplateProperties = &fusionAlertRuleTemplateProperties 2644 } 2645 case "kind": 2646 if v != nil { 2647 var kind KindBasicAlertRuleTemplate 2648 err = json.Unmarshal(*v, &kind) 2649 if err != nil { 2650 return err 2651 } 2652 fart.Kind = kind 2653 } 2654 case "id": 2655 if v != nil { 2656 var ID string 2657 err = json.Unmarshal(*v, &ID) 2658 if err != nil { 2659 return err 2660 } 2661 fart.ID = &ID 2662 } 2663 case "name": 2664 if v != nil { 2665 var name string 2666 err = json.Unmarshal(*v, &name) 2667 if err != nil { 2668 return err 2669 } 2670 fart.Name = &name 2671 } 2672 case "type": 2673 if v != nil { 2674 var typeVar string 2675 err = json.Unmarshal(*v, &typeVar) 2676 if err != nil { 2677 return err 2678 } 2679 fart.Type = &typeVar 2680 } 2681 } 2682 } 2683 2684 return nil 2685} 2686 2687// FusionAlertRuleTemplateProperties represents Fusion alert rule template properties 2688type FusionAlertRuleTemplateProperties struct { 2689 // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template 2690 AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` 2691 // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. 2692 CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` 2693 // Description - The description of the alert rule template. 2694 Description *string `json:"description,omitempty"` 2695 // DisplayName - The display name for alert rule template. 2696 DisplayName *string `json:"displayName,omitempty"` 2697 // RequiredDataConnectors - The required data connectors for this template 2698 RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` 2699 // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' 2700 Status TemplateStatus `json:"status,omitempty"` 2701 // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' 2702 Severity AlertSeverity `json:"severity,omitempty"` 2703 // Tactics - The tactics of the alert rule template 2704 Tactics *[]AttackTactic `json:"tactics,omitempty"` 2705} 2706 2707// MarshalJSON is the custom marshaler for FusionAlertRuleTemplateProperties. 2708func (fartp FusionAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { 2709 objectMap := make(map[string]interface{}) 2710 if fartp.AlertRulesCreatedByTemplateCount != nil { 2711 objectMap["alertRulesCreatedByTemplateCount"] = fartp.AlertRulesCreatedByTemplateCount 2712 } 2713 if fartp.Description != nil { 2714 objectMap["description"] = fartp.Description 2715 } 2716 if fartp.DisplayName != nil { 2717 objectMap["displayName"] = fartp.DisplayName 2718 } 2719 if fartp.RequiredDataConnectors != nil { 2720 objectMap["requiredDataConnectors"] = fartp.RequiredDataConnectors 2721 } 2722 if fartp.Status != "" { 2723 objectMap["status"] = fartp.Status 2724 } 2725 if fartp.Severity != "" { 2726 objectMap["severity"] = fartp.Severity 2727 } 2728 if fartp.Tactics != nil { 2729 objectMap["tactics"] = fartp.Tactics 2730 } 2731 return json.Marshal(objectMap) 2732} 2733 2734// Incident represents an incident in Azure Security Insights. 2735type Incident struct { 2736 autorest.Response `json:"-"` 2737 // IncidentProperties - Incident properties 2738 *IncidentProperties `json:"properties,omitempty"` 2739 // ID - READ-ONLY; Azure resource Id 2740 ID *string `json:"id,omitempty"` 2741 // Name - READ-ONLY; Azure resource name 2742 Name *string `json:"name,omitempty"` 2743 // Type - READ-ONLY; Azure resource type 2744 Type *string `json:"type,omitempty"` 2745 // Etag - Etag of the azure resource 2746 Etag *string `json:"etag,omitempty"` 2747} 2748 2749// MarshalJSON is the custom marshaler for Incident. 2750func (i Incident) MarshalJSON() ([]byte, error) { 2751 objectMap := make(map[string]interface{}) 2752 if i.IncidentProperties != nil { 2753 objectMap["properties"] = i.IncidentProperties 2754 } 2755 if i.Etag != nil { 2756 objectMap["etag"] = i.Etag 2757 } 2758 return json.Marshal(objectMap) 2759} 2760 2761// UnmarshalJSON is the custom unmarshaler for Incident struct. 2762func (i *Incident) UnmarshalJSON(body []byte) error { 2763 var m map[string]*json.RawMessage 2764 err := json.Unmarshal(body, &m) 2765 if err != nil { 2766 return err 2767 } 2768 for k, v := range m { 2769 switch k { 2770 case "properties": 2771 if v != nil { 2772 var incidentProperties IncidentProperties 2773 err = json.Unmarshal(*v, &incidentProperties) 2774 if err != nil { 2775 return err 2776 } 2777 i.IncidentProperties = &incidentProperties 2778 } 2779 case "id": 2780 if v != nil { 2781 var ID string 2782 err = json.Unmarshal(*v, &ID) 2783 if err != nil { 2784 return err 2785 } 2786 i.ID = &ID 2787 } 2788 case "name": 2789 if v != nil { 2790 var name string 2791 err = json.Unmarshal(*v, &name) 2792 if err != nil { 2793 return err 2794 } 2795 i.Name = &name 2796 } 2797 case "type": 2798 if v != nil { 2799 var typeVar string 2800 err = json.Unmarshal(*v, &typeVar) 2801 if err != nil { 2802 return err 2803 } 2804 i.Type = &typeVar 2805 } 2806 case "etag": 2807 if v != nil { 2808 var etag string 2809 err = json.Unmarshal(*v, &etag) 2810 if err != nil { 2811 return err 2812 } 2813 i.Etag = &etag 2814 } 2815 } 2816 } 2817 2818 return nil 2819} 2820 2821// IncidentAdditionalData incident additional data property bag. 2822type IncidentAdditionalData struct { 2823 // AlertsCount - READ-ONLY; The number of alerts in the incident 2824 AlertsCount *int32 `json:"alertsCount,omitempty"` 2825 // BookmarksCount - READ-ONLY; The number of bookmarks in the incident 2826 BookmarksCount *int32 `json:"bookmarksCount,omitempty"` 2827 // CommentsCount - READ-ONLY; The number of comments in the incident 2828 CommentsCount *int32 `json:"commentsCount,omitempty"` 2829 // AlertProductNames - READ-ONLY; List of product names of alerts in the incident 2830 AlertProductNames *[]string `json:"alertProductNames,omitempty"` 2831 // Tactics - READ-ONLY; The tactics associated with incident 2832 Tactics *[]AttackTactic `json:"tactics,omitempty"` 2833} 2834 2835// MarshalJSON is the custom marshaler for IncidentAdditionalData. 2836func (iad IncidentAdditionalData) MarshalJSON() ([]byte, error) { 2837 objectMap := make(map[string]interface{}) 2838 return json.Marshal(objectMap) 2839} 2840 2841// IncidentComment represents an incident comment 2842type IncidentComment struct { 2843 autorest.Response `json:"-"` 2844 // IncidentCommentProperties - Incident comment properties 2845 *IncidentCommentProperties `json:"properties,omitempty"` 2846 // ID - READ-ONLY; Azure resource Id 2847 ID *string `json:"id,omitempty"` 2848 // Name - READ-ONLY; Azure resource name 2849 Name *string `json:"name,omitempty"` 2850 // Type - READ-ONLY; Azure resource type 2851 Type *string `json:"type,omitempty"` 2852} 2853 2854// MarshalJSON is the custom marshaler for IncidentComment. 2855func (ic IncidentComment) MarshalJSON() ([]byte, error) { 2856 objectMap := make(map[string]interface{}) 2857 if ic.IncidentCommentProperties != nil { 2858 objectMap["properties"] = ic.IncidentCommentProperties 2859 } 2860 return json.Marshal(objectMap) 2861} 2862 2863// UnmarshalJSON is the custom unmarshaler for IncidentComment struct. 2864func (ic *IncidentComment) UnmarshalJSON(body []byte) error { 2865 var m map[string]*json.RawMessage 2866 err := json.Unmarshal(body, &m) 2867 if err != nil { 2868 return err 2869 } 2870 for k, v := range m { 2871 switch k { 2872 case "properties": 2873 if v != nil { 2874 var incidentCommentProperties IncidentCommentProperties 2875 err = json.Unmarshal(*v, &incidentCommentProperties) 2876 if err != nil { 2877 return err 2878 } 2879 ic.IncidentCommentProperties = &incidentCommentProperties 2880 } 2881 case "id": 2882 if v != nil { 2883 var ID string 2884 err = json.Unmarshal(*v, &ID) 2885 if err != nil { 2886 return err 2887 } 2888 ic.ID = &ID 2889 } 2890 case "name": 2891 if v != nil { 2892 var name string 2893 err = json.Unmarshal(*v, &name) 2894 if err != nil { 2895 return err 2896 } 2897 ic.Name = &name 2898 } 2899 case "type": 2900 if v != nil { 2901 var typeVar string 2902 err = json.Unmarshal(*v, &typeVar) 2903 if err != nil { 2904 return err 2905 } 2906 ic.Type = &typeVar 2907 } 2908 } 2909 } 2910 2911 return nil 2912} 2913 2914// IncidentCommentList list of incident comments. 2915type IncidentCommentList struct { 2916 autorest.Response `json:"-"` 2917 // NextLink - READ-ONLY; URL to fetch the next set of comments. 2918 NextLink *string `json:"nextLink,omitempty"` 2919 // Value - Array of comments. 2920 Value *[]IncidentComment `json:"value,omitempty"` 2921} 2922 2923// MarshalJSON is the custom marshaler for IncidentCommentList. 2924func (icl IncidentCommentList) MarshalJSON() ([]byte, error) { 2925 objectMap := make(map[string]interface{}) 2926 if icl.Value != nil { 2927 objectMap["value"] = icl.Value 2928 } 2929 return json.Marshal(objectMap) 2930} 2931 2932// IncidentCommentListIterator provides access to a complete listing of IncidentComment values. 2933type IncidentCommentListIterator struct { 2934 i int 2935 page IncidentCommentListPage 2936} 2937 2938// NextWithContext advances to the next value. If there was an error making 2939// the request the iterator does not advance and the error is returned. 2940func (iter *IncidentCommentListIterator) NextWithContext(ctx context.Context) (err error) { 2941 if tracing.IsEnabled() { 2942 ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentListIterator.NextWithContext") 2943 defer func() { 2944 sc := -1 2945 if iter.Response().Response.Response != nil { 2946 sc = iter.Response().Response.Response.StatusCode 2947 } 2948 tracing.EndSpan(ctx, sc, err) 2949 }() 2950 } 2951 iter.i++ 2952 if iter.i < len(iter.page.Values()) { 2953 return nil 2954 } 2955 err = iter.page.NextWithContext(ctx) 2956 if err != nil { 2957 iter.i-- 2958 return err 2959 } 2960 iter.i = 0 2961 return nil 2962} 2963 2964// Next advances to the next value. If there was an error making 2965// the request the iterator does not advance and the error is returned. 2966// Deprecated: Use NextWithContext() instead. 2967func (iter *IncidentCommentListIterator) Next() error { 2968 return iter.NextWithContext(context.Background()) 2969} 2970 2971// NotDone returns true if the enumeration should be started or is not yet complete. 2972func (iter IncidentCommentListIterator) NotDone() bool { 2973 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2974} 2975 2976// Response returns the raw server response from the last page request. 2977func (iter IncidentCommentListIterator) Response() IncidentCommentList { 2978 return iter.page.Response() 2979} 2980 2981// Value returns the current value or a zero-initialized value if the 2982// iterator has advanced beyond the end of the collection. 2983func (iter IncidentCommentListIterator) Value() IncidentComment { 2984 if !iter.page.NotDone() { 2985 return IncidentComment{} 2986 } 2987 return iter.page.Values()[iter.i] 2988} 2989 2990// Creates a new instance of the IncidentCommentListIterator type. 2991func NewIncidentCommentListIterator(page IncidentCommentListPage) IncidentCommentListIterator { 2992 return IncidentCommentListIterator{page: page} 2993} 2994 2995// IsEmpty returns true if the ListResult contains no values. 2996func (icl IncidentCommentList) IsEmpty() bool { 2997 return icl.Value == nil || len(*icl.Value) == 0 2998} 2999 3000// hasNextLink returns true if the NextLink is not empty. 3001func (icl IncidentCommentList) hasNextLink() bool { 3002 return icl.NextLink != nil && len(*icl.NextLink) != 0 3003} 3004 3005// incidentCommentListPreparer prepares a request to retrieve the next set of results. 3006// It returns nil if no more results exist. 3007func (icl IncidentCommentList) incidentCommentListPreparer(ctx context.Context) (*http.Request, error) { 3008 if !icl.hasNextLink() { 3009 return nil, nil 3010 } 3011 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3012 autorest.AsJSON(), 3013 autorest.AsGet(), 3014 autorest.WithBaseURL(to.String(icl.NextLink))) 3015} 3016 3017// IncidentCommentListPage contains a page of IncidentComment values. 3018type IncidentCommentListPage struct { 3019 fn func(context.Context, IncidentCommentList) (IncidentCommentList, error) 3020 icl IncidentCommentList 3021} 3022 3023// NextWithContext advances to the next page of values. If there was an error making 3024// the request the page does not advance and the error is returned. 3025func (page *IncidentCommentListPage) NextWithContext(ctx context.Context) (err error) { 3026 if tracing.IsEnabled() { 3027 ctx = tracing.StartSpan(ctx, fqdn+"/IncidentCommentListPage.NextWithContext") 3028 defer func() { 3029 sc := -1 3030 if page.Response().Response.Response != nil { 3031 sc = page.Response().Response.Response.StatusCode 3032 } 3033 tracing.EndSpan(ctx, sc, err) 3034 }() 3035 } 3036 for { 3037 next, err := page.fn(ctx, page.icl) 3038 if err != nil { 3039 return err 3040 } 3041 page.icl = next 3042 if !next.hasNextLink() || !next.IsEmpty() { 3043 break 3044 } 3045 } 3046 return nil 3047} 3048 3049// Next advances to the next page of values. If there was an error making 3050// the request the page does not advance and the error is returned. 3051// Deprecated: Use NextWithContext() instead. 3052func (page *IncidentCommentListPage) Next() error { 3053 return page.NextWithContext(context.Background()) 3054} 3055 3056// NotDone returns true if the page enumeration should be started or is not yet complete. 3057func (page IncidentCommentListPage) NotDone() bool { 3058 return !page.icl.IsEmpty() 3059} 3060 3061// Response returns the raw server response from the last page request. 3062func (page IncidentCommentListPage) Response() IncidentCommentList { 3063 return page.icl 3064} 3065 3066// Values returns the slice of values for the current page or nil if there are no values. 3067func (page IncidentCommentListPage) Values() []IncidentComment { 3068 if page.icl.IsEmpty() { 3069 return nil 3070 } 3071 return *page.icl.Value 3072} 3073 3074// Creates a new instance of the IncidentCommentListPage type. 3075func NewIncidentCommentListPage(cur IncidentCommentList, getNextPage func(context.Context, IncidentCommentList) (IncidentCommentList, error)) IncidentCommentListPage { 3076 return IncidentCommentListPage{ 3077 fn: getNextPage, 3078 icl: cur, 3079 } 3080} 3081 3082// IncidentCommentProperties incident comment property bag. 3083type IncidentCommentProperties struct { 3084 // CreatedTimeUtc - READ-ONLY; The time the comment was created 3085 CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` 3086 // Message - The comment message 3087 Message *string `json:"message,omitempty"` 3088 // Author - READ-ONLY; Describes the client that created the comment 3089 Author *ClientInfo `json:"author,omitempty"` 3090} 3091 3092// MarshalJSON is the custom marshaler for IncidentCommentProperties. 3093func (icp IncidentCommentProperties) MarshalJSON() ([]byte, error) { 3094 objectMap := make(map[string]interface{}) 3095 if icp.Message != nil { 3096 objectMap["message"] = icp.Message 3097 } 3098 return json.Marshal(objectMap) 3099} 3100 3101// IncidentInfo describes related incident information for the bookmark 3102type IncidentInfo struct { 3103 // IncidentID - Incident Id 3104 IncidentID *string `json:"incidentId,omitempty"` 3105 // Severity - The severity of the incident. Possible values include: 'CaseSeverityCritical', 'CaseSeverityHigh', 'CaseSeverityMedium', 'CaseSeverityLow', 'CaseSeverityInformational' 3106 Severity CaseSeverity `json:"severity,omitempty"` 3107 // Title - The title of the incident 3108 Title *string `json:"title,omitempty"` 3109 // RelationName - Relation Name 3110 RelationName *string `json:"relationName,omitempty"` 3111} 3112 3113// IncidentLabel represents an incident label 3114type IncidentLabel struct { 3115 // LabelName - The name of the label 3116 LabelName *string `json:"labelName,omitempty"` 3117 // LabelType - READ-ONLY; The type of the label. Possible values include: 'IncidentLabelTypeUser', 'IncidentLabelTypeSystem' 3118 LabelType IncidentLabelType `json:"labelType,omitempty"` 3119} 3120 3121// MarshalJSON is the custom marshaler for IncidentLabel. 3122func (il IncidentLabel) MarshalJSON() ([]byte, error) { 3123 objectMap := make(map[string]interface{}) 3124 if il.LabelName != nil { 3125 objectMap["labelName"] = il.LabelName 3126 } 3127 return json.Marshal(objectMap) 3128} 3129 3130// IncidentList list all the incidents. 3131type IncidentList struct { 3132 autorest.Response `json:"-"` 3133 // NextLink - READ-ONLY; URL to fetch the next set of incidents. 3134 NextLink *string `json:"nextLink,omitempty"` 3135 // Value - Array of incidents. 3136 Value *[]Incident `json:"value,omitempty"` 3137} 3138 3139// MarshalJSON is the custom marshaler for IncidentList. 3140func (il IncidentList) MarshalJSON() ([]byte, error) { 3141 objectMap := make(map[string]interface{}) 3142 if il.Value != nil { 3143 objectMap["value"] = il.Value 3144 } 3145 return json.Marshal(objectMap) 3146} 3147 3148// IncidentListIterator provides access to a complete listing of Incident values. 3149type IncidentListIterator struct { 3150 i int 3151 page IncidentListPage 3152} 3153 3154// NextWithContext advances to the next value. If there was an error making 3155// the request the iterator does not advance and the error is returned. 3156func (iter *IncidentListIterator) NextWithContext(ctx context.Context) (err error) { 3157 if tracing.IsEnabled() { 3158 ctx = tracing.StartSpan(ctx, fqdn+"/IncidentListIterator.NextWithContext") 3159 defer func() { 3160 sc := -1 3161 if iter.Response().Response.Response != nil { 3162 sc = iter.Response().Response.Response.StatusCode 3163 } 3164 tracing.EndSpan(ctx, sc, err) 3165 }() 3166 } 3167 iter.i++ 3168 if iter.i < len(iter.page.Values()) { 3169 return nil 3170 } 3171 err = iter.page.NextWithContext(ctx) 3172 if err != nil { 3173 iter.i-- 3174 return err 3175 } 3176 iter.i = 0 3177 return nil 3178} 3179 3180// Next advances to the next value. If there was an error making 3181// the request the iterator does not advance and the error is returned. 3182// Deprecated: Use NextWithContext() instead. 3183func (iter *IncidentListIterator) Next() error { 3184 return iter.NextWithContext(context.Background()) 3185} 3186 3187// NotDone returns true if the enumeration should be started or is not yet complete. 3188func (iter IncidentListIterator) NotDone() bool { 3189 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3190} 3191 3192// Response returns the raw server response from the last page request. 3193func (iter IncidentListIterator) Response() IncidentList { 3194 return iter.page.Response() 3195} 3196 3197// Value returns the current value or a zero-initialized value if the 3198// iterator has advanced beyond the end of the collection. 3199func (iter IncidentListIterator) Value() Incident { 3200 if !iter.page.NotDone() { 3201 return Incident{} 3202 } 3203 return iter.page.Values()[iter.i] 3204} 3205 3206// Creates a new instance of the IncidentListIterator type. 3207func NewIncidentListIterator(page IncidentListPage) IncidentListIterator { 3208 return IncidentListIterator{page: page} 3209} 3210 3211// IsEmpty returns true if the ListResult contains no values. 3212func (il IncidentList) IsEmpty() bool { 3213 return il.Value == nil || len(*il.Value) == 0 3214} 3215 3216// hasNextLink returns true if the NextLink is not empty. 3217func (il IncidentList) hasNextLink() bool { 3218 return il.NextLink != nil && len(*il.NextLink) != 0 3219} 3220 3221// incidentListPreparer prepares a request to retrieve the next set of results. 3222// It returns nil if no more results exist. 3223func (il IncidentList) incidentListPreparer(ctx context.Context) (*http.Request, error) { 3224 if !il.hasNextLink() { 3225 return nil, nil 3226 } 3227 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3228 autorest.AsJSON(), 3229 autorest.AsGet(), 3230 autorest.WithBaseURL(to.String(il.NextLink))) 3231} 3232 3233// IncidentListPage contains a page of Incident values. 3234type IncidentListPage struct { 3235 fn func(context.Context, IncidentList) (IncidentList, error) 3236 il IncidentList 3237} 3238 3239// NextWithContext advances to the next page of values. If there was an error making 3240// the request the page does not advance and the error is returned. 3241func (page *IncidentListPage) NextWithContext(ctx context.Context) (err error) { 3242 if tracing.IsEnabled() { 3243 ctx = tracing.StartSpan(ctx, fqdn+"/IncidentListPage.NextWithContext") 3244 defer func() { 3245 sc := -1 3246 if page.Response().Response.Response != nil { 3247 sc = page.Response().Response.Response.StatusCode 3248 } 3249 tracing.EndSpan(ctx, sc, err) 3250 }() 3251 } 3252 for { 3253 next, err := page.fn(ctx, page.il) 3254 if err != nil { 3255 return err 3256 } 3257 page.il = next 3258 if !next.hasNextLink() || !next.IsEmpty() { 3259 break 3260 } 3261 } 3262 return nil 3263} 3264 3265// Next advances to the next page of values. If there was an error making 3266// the request the page does not advance and the error is returned. 3267// Deprecated: Use NextWithContext() instead. 3268func (page *IncidentListPage) Next() error { 3269 return page.NextWithContext(context.Background()) 3270} 3271 3272// NotDone returns true if the page enumeration should be started or is not yet complete. 3273func (page IncidentListPage) NotDone() bool { 3274 return !page.il.IsEmpty() 3275} 3276 3277// Response returns the raw server response from the last page request. 3278func (page IncidentListPage) Response() IncidentList { 3279 return page.il 3280} 3281 3282// Values returns the slice of values for the current page or nil if there are no values. 3283func (page IncidentListPage) Values() []Incident { 3284 if page.il.IsEmpty() { 3285 return nil 3286 } 3287 return *page.il.Value 3288} 3289 3290// Creates a new instance of the IncidentListPage type. 3291func NewIncidentListPage(cur IncidentList, getNextPage func(context.Context, IncidentList) (IncidentList, error)) IncidentListPage { 3292 return IncidentListPage{ 3293 fn: getNextPage, 3294 il: cur, 3295 } 3296} 3297 3298// IncidentOwnerInfo information on the user an incident is assigned to 3299type IncidentOwnerInfo struct { 3300 // Email - The email of the user the incident is assigned to. 3301 Email *string `json:"email,omitempty"` 3302 // AssignedTo - The name of the user the incident is assigned to. 3303 AssignedTo *string `json:"assignedTo,omitempty"` 3304 // ObjectID - The object id of the user the incident is assigned to. 3305 ObjectID *uuid.UUID `json:"objectId,omitempty"` 3306 // UserPrincipalName - The user principal name of the user the incident is assigned to. 3307 UserPrincipalName *string `json:"userPrincipalName,omitempty"` 3308} 3309 3310// IncidentProperties describes incident properties 3311type IncidentProperties struct { 3312 // AdditionalData - READ-ONLY; Additional data on the incident 3313 AdditionalData *IncidentAdditionalData `json:"additionalData,omitempty"` 3314 // Classification - The reason the incident was closed. Possible values include: 'IncidentClassificationUndetermined', 'IncidentClassificationTruePositive', 'IncidentClassificationBenignPositive', 'IncidentClassificationFalsePositive' 3315 Classification IncidentClassification `json:"classification,omitempty"` 3316 // ClassificationComment - Describes the reason the incident was closed 3317 ClassificationComment *string `json:"classificationComment,omitempty"` 3318 // ClassificationReason - The classification reason the incident was closed with. Possible values include: 'IncidentClassificationReasonSuspiciousActivity', 'IncidentClassificationReasonSuspiciousButExpected', 'IncidentClassificationReasonIncorrectAlertLogic', 'IncidentClassificationReasonInaccurateData' 3319 ClassificationReason IncidentClassificationReason `json:"classificationReason,omitempty"` 3320 // CreatedTimeUtc - READ-ONLY; The time the incident was created 3321 CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` 3322 // Description - The description of the incident 3323 Description *string `json:"description,omitempty"` 3324 // FirstActivityTimeUtc - The time of the first activity in the incident 3325 FirstActivityTimeUtc *date.Time `json:"firstActivityTimeUtc,omitempty"` 3326 // IncidentURL - READ-ONLY; The deep-link url to the incident in Azure portal 3327 IncidentURL *string `json:"incidentUrl,omitempty"` 3328 // IncidentNumber - READ-ONLY; A sequential number 3329 IncidentNumber *int32 `json:"incidentNumber,omitempty"` 3330 // Labels - List of labels relevant to this incident 3331 Labels *[]IncidentLabel `json:"labels,omitempty"` 3332 // LastActivityTimeUtc - The time of the last activity in the incident 3333 LastActivityTimeUtc *date.Time `json:"lastActivityTimeUtc,omitempty"` 3334 // LastModifiedTimeUtc - READ-ONLY; The last time the incident was updated 3335 LastModifiedTimeUtc *date.Time `json:"lastModifiedTimeUtc,omitempty"` 3336 // Owner - Describes a user that the incident is assigned to 3337 Owner *IncidentOwnerInfo `json:"owner,omitempty"` 3338 // RelatedAnalyticRuleIds - READ-ONLY; List of resource ids of Analytic rules related to the incident 3339 RelatedAnalyticRuleIds *[]string `json:"relatedAnalyticRuleIds,omitempty"` 3340 // Severity - The severity of the incident. Possible values include: 'IncidentSeverityHigh', 'IncidentSeverityMedium', 'IncidentSeverityLow', 'IncidentSeverityInformational' 3341 Severity IncidentSeverity `json:"severity,omitempty"` 3342 // Status - The status of the incident. Possible values include: 'IncidentStatusNew', 'IncidentStatusActive', 'IncidentStatusClosed' 3343 Status IncidentStatus `json:"status,omitempty"` 3344 // Title - The title of the incident 3345 Title *string `json:"title,omitempty"` 3346} 3347 3348// MarshalJSON is the custom marshaler for IncidentProperties. 3349func (IP IncidentProperties) MarshalJSON() ([]byte, error) { 3350 objectMap := make(map[string]interface{}) 3351 if IP.Classification != "" { 3352 objectMap["classification"] = IP.Classification 3353 } 3354 if IP.ClassificationComment != nil { 3355 objectMap["classificationComment"] = IP.ClassificationComment 3356 } 3357 if IP.ClassificationReason != "" { 3358 objectMap["classificationReason"] = IP.ClassificationReason 3359 } 3360 if IP.Description != nil { 3361 objectMap["description"] = IP.Description 3362 } 3363 if IP.FirstActivityTimeUtc != nil { 3364 objectMap["firstActivityTimeUtc"] = IP.FirstActivityTimeUtc 3365 } 3366 if IP.Labels != nil { 3367 objectMap["labels"] = IP.Labels 3368 } 3369 if IP.LastActivityTimeUtc != nil { 3370 objectMap["lastActivityTimeUtc"] = IP.LastActivityTimeUtc 3371 } 3372 if IP.Owner != nil { 3373 objectMap["owner"] = IP.Owner 3374 } 3375 if IP.Severity != "" { 3376 objectMap["severity"] = IP.Severity 3377 } 3378 if IP.Status != "" { 3379 objectMap["status"] = IP.Status 3380 } 3381 if IP.Title != nil { 3382 objectMap["title"] = IP.Title 3383 } 3384 return json.Marshal(objectMap) 3385} 3386 3387// MCASDataConnector represents MCAS (Microsoft Cloud App Security) data connector. 3388type MCASDataConnector struct { 3389 // MCASDataConnectorProperties - MCAS (Microsoft Cloud App Security) data connector properties. 3390 *MCASDataConnectorProperties `json:"properties,omitempty"` 3391 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 3392 Kind KindBasicDataConnector `json:"kind,omitempty"` 3393 // ID - READ-ONLY; Azure resource Id 3394 ID *string `json:"id,omitempty"` 3395 // Name - READ-ONLY; Azure resource name 3396 Name *string `json:"name,omitempty"` 3397 // Type - READ-ONLY; Azure resource type 3398 Type *string `json:"type,omitempty"` 3399 // Etag - Etag of the azure resource 3400 Etag *string `json:"etag,omitempty"` 3401} 3402 3403// MarshalJSON is the custom marshaler for MCASDataConnector. 3404func (mdc MCASDataConnector) MarshalJSON() ([]byte, error) { 3405 mdc.Kind = KindBasicDataConnectorKindMicrosoftCloudAppSecurity 3406 objectMap := make(map[string]interface{}) 3407 if mdc.MCASDataConnectorProperties != nil { 3408 objectMap["properties"] = mdc.MCASDataConnectorProperties 3409 } 3410 if mdc.Kind != "" { 3411 objectMap["kind"] = mdc.Kind 3412 } 3413 if mdc.Etag != nil { 3414 objectMap["etag"] = mdc.Etag 3415 } 3416 return json.Marshal(objectMap) 3417} 3418 3419// AsAADDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3420func (mdc MCASDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 3421 return nil, false 3422} 3423 3424// AsAATPDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3425func (mdc MCASDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 3426 return nil, false 3427} 3428 3429// AsASCDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3430func (mdc MCASDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 3431 return nil, false 3432} 3433 3434// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3435func (mdc MCASDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 3436 return nil, false 3437} 3438 3439// AsMCASDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3440func (mdc MCASDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 3441 return &mdc, true 3442} 3443 3444// AsMDATPDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3445func (mdc MCASDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 3446 return nil, false 3447} 3448 3449// AsOfficeDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3450func (mdc MCASDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 3451 return nil, false 3452} 3453 3454// AsTIDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3455func (mdc MCASDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 3456 return nil, false 3457} 3458 3459// AsDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3460func (mdc MCASDataConnector) AsDataConnector() (*DataConnector, bool) { 3461 return nil, false 3462} 3463 3464// AsBasicDataConnector is the BasicDataConnector implementation for MCASDataConnector. 3465func (mdc MCASDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 3466 return &mdc, true 3467} 3468 3469// UnmarshalJSON is the custom unmarshaler for MCASDataConnector struct. 3470func (mdc *MCASDataConnector) UnmarshalJSON(body []byte) error { 3471 var m map[string]*json.RawMessage 3472 err := json.Unmarshal(body, &m) 3473 if err != nil { 3474 return err 3475 } 3476 for k, v := range m { 3477 switch k { 3478 case "properties": 3479 if v != nil { 3480 var mCASDataConnectorProperties MCASDataConnectorProperties 3481 err = json.Unmarshal(*v, &mCASDataConnectorProperties) 3482 if err != nil { 3483 return err 3484 } 3485 mdc.MCASDataConnectorProperties = &mCASDataConnectorProperties 3486 } 3487 case "kind": 3488 if v != nil { 3489 var kind KindBasicDataConnector 3490 err = json.Unmarshal(*v, &kind) 3491 if err != nil { 3492 return err 3493 } 3494 mdc.Kind = kind 3495 } 3496 case "id": 3497 if v != nil { 3498 var ID string 3499 err = json.Unmarshal(*v, &ID) 3500 if err != nil { 3501 return err 3502 } 3503 mdc.ID = &ID 3504 } 3505 case "name": 3506 if v != nil { 3507 var name string 3508 err = json.Unmarshal(*v, &name) 3509 if err != nil { 3510 return err 3511 } 3512 mdc.Name = &name 3513 } 3514 case "type": 3515 if v != nil { 3516 var typeVar string 3517 err = json.Unmarshal(*v, &typeVar) 3518 if err != nil { 3519 return err 3520 } 3521 mdc.Type = &typeVar 3522 } 3523 case "etag": 3524 if v != nil { 3525 var etag string 3526 err = json.Unmarshal(*v, &etag) 3527 if err != nil { 3528 return err 3529 } 3530 mdc.Etag = &etag 3531 } 3532 } 3533 } 3534 3535 return nil 3536} 3537 3538// MCASDataConnectorDataTypes the available data types for MCAS (Microsoft Cloud App Security) data 3539// connector. 3540type MCASDataConnectorDataTypes struct { 3541 // DiscoveryLogs - Discovery log data type connection. 3542 DiscoveryLogs *DataConnectorDataTypeCommon `json:"discoveryLogs,omitempty"` 3543 // Alerts - Alerts data type connection. 3544 Alerts *DataConnectorDataTypeCommon `json:"alerts,omitempty"` 3545} 3546 3547// MCASDataConnectorProperties MCAS (Microsoft Cloud App Security) data connector properties. 3548type MCASDataConnectorProperties struct { 3549 // TenantID - The tenant id to connect to, and get the data from. 3550 TenantID *string `json:"tenantId,omitempty"` 3551 // DataTypes - The available data types for the connector. 3552 DataTypes *MCASDataConnectorDataTypes `json:"dataTypes,omitempty"` 3553} 3554 3555// MDATPDataConnector represents MDATP (Microsoft Defender Advanced Threat Protection) data connector. 3556type MDATPDataConnector struct { 3557 // MDATPDataConnectorProperties - MDATP (Microsoft Defender Advanced Threat Protection) data connector properties. 3558 *MDATPDataConnectorProperties `json:"properties,omitempty"` 3559 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 3560 Kind KindBasicDataConnector `json:"kind,omitempty"` 3561 // ID - READ-ONLY; Azure resource Id 3562 ID *string `json:"id,omitempty"` 3563 // Name - READ-ONLY; Azure resource name 3564 Name *string `json:"name,omitempty"` 3565 // Type - READ-ONLY; Azure resource type 3566 Type *string `json:"type,omitempty"` 3567 // Etag - Etag of the azure resource 3568 Etag *string `json:"etag,omitempty"` 3569} 3570 3571// MarshalJSON is the custom marshaler for MDATPDataConnector. 3572func (mdc MDATPDataConnector) MarshalJSON() ([]byte, error) { 3573 mdc.Kind = KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection 3574 objectMap := make(map[string]interface{}) 3575 if mdc.MDATPDataConnectorProperties != nil { 3576 objectMap["properties"] = mdc.MDATPDataConnectorProperties 3577 } 3578 if mdc.Kind != "" { 3579 objectMap["kind"] = mdc.Kind 3580 } 3581 if mdc.Etag != nil { 3582 objectMap["etag"] = mdc.Etag 3583 } 3584 return json.Marshal(objectMap) 3585} 3586 3587// AsAADDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3588func (mdc MDATPDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 3589 return nil, false 3590} 3591 3592// AsAATPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3593func (mdc MDATPDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 3594 return nil, false 3595} 3596 3597// AsASCDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3598func (mdc MDATPDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 3599 return nil, false 3600} 3601 3602// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3603func (mdc MDATPDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 3604 return nil, false 3605} 3606 3607// AsMCASDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3608func (mdc MDATPDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 3609 return nil, false 3610} 3611 3612// AsMDATPDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3613func (mdc MDATPDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 3614 return &mdc, true 3615} 3616 3617// AsOfficeDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3618func (mdc MDATPDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 3619 return nil, false 3620} 3621 3622// AsTIDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3623func (mdc MDATPDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 3624 return nil, false 3625} 3626 3627// AsDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3628func (mdc MDATPDataConnector) AsDataConnector() (*DataConnector, bool) { 3629 return nil, false 3630} 3631 3632// AsBasicDataConnector is the BasicDataConnector implementation for MDATPDataConnector. 3633func (mdc MDATPDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 3634 return &mdc, true 3635} 3636 3637// UnmarshalJSON is the custom unmarshaler for MDATPDataConnector struct. 3638func (mdc *MDATPDataConnector) UnmarshalJSON(body []byte) error { 3639 var m map[string]*json.RawMessage 3640 err := json.Unmarshal(body, &m) 3641 if err != nil { 3642 return err 3643 } 3644 for k, v := range m { 3645 switch k { 3646 case "properties": 3647 if v != nil { 3648 var mDATPDataConnectorProperties MDATPDataConnectorProperties 3649 err = json.Unmarshal(*v, &mDATPDataConnectorProperties) 3650 if err != nil { 3651 return err 3652 } 3653 mdc.MDATPDataConnectorProperties = &mDATPDataConnectorProperties 3654 } 3655 case "kind": 3656 if v != nil { 3657 var kind KindBasicDataConnector 3658 err = json.Unmarshal(*v, &kind) 3659 if err != nil { 3660 return err 3661 } 3662 mdc.Kind = kind 3663 } 3664 case "id": 3665 if v != nil { 3666 var ID string 3667 err = json.Unmarshal(*v, &ID) 3668 if err != nil { 3669 return err 3670 } 3671 mdc.ID = &ID 3672 } 3673 case "name": 3674 if v != nil { 3675 var name string 3676 err = json.Unmarshal(*v, &name) 3677 if err != nil { 3678 return err 3679 } 3680 mdc.Name = &name 3681 } 3682 case "type": 3683 if v != nil { 3684 var typeVar string 3685 err = json.Unmarshal(*v, &typeVar) 3686 if err != nil { 3687 return err 3688 } 3689 mdc.Type = &typeVar 3690 } 3691 case "etag": 3692 if v != nil { 3693 var etag string 3694 err = json.Unmarshal(*v, &etag) 3695 if err != nil { 3696 return err 3697 } 3698 mdc.Etag = &etag 3699 } 3700 } 3701 } 3702 3703 return nil 3704} 3705 3706// MDATPDataConnectorProperties MDATP (Microsoft Defender Advanced Threat Protection) data connector 3707// properties. 3708type MDATPDataConnectorProperties struct { 3709 // TenantID - The tenant id to connect to, and get the data from. 3710 TenantID *string `json:"tenantId,omitempty"` 3711 // DataTypes - The available data types for the connector. 3712 DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` 3713} 3714 3715// MicrosoftSecurityIncidentCreationAlertRule represents MicrosoftSecurityIncidentCreation rule. 3716type MicrosoftSecurityIncidentCreationAlertRule struct { 3717 // MicrosoftSecurityIncidentCreationAlertRuleProperties - MicrosoftSecurityIncidentCreation rule properties 3718 *MicrosoftSecurityIncidentCreationAlertRuleProperties `json:"properties,omitempty"` 3719 // Kind - Possible values include: 'KindAlertRule', 'KindFusion', 'KindMicrosoftSecurityIncidentCreation', 'KindScheduled' 3720 Kind Kind `json:"kind,omitempty"` 3721 // ID - READ-ONLY; Azure resource Id 3722 ID *string `json:"id,omitempty"` 3723 // Name - READ-ONLY; Azure resource name 3724 Name *string `json:"name,omitempty"` 3725 // Type - READ-ONLY; Azure resource type 3726 Type *string `json:"type,omitempty"` 3727 // Etag - Etag of the azure resource 3728 Etag *string `json:"etag,omitempty"` 3729} 3730 3731// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRule. 3732func (msicar MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { 3733 msicar.Kind = KindMicrosoftSecurityIncidentCreation 3734 objectMap := make(map[string]interface{}) 3735 if msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties != nil { 3736 objectMap["properties"] = msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties 3737 } 3738 if msicar.Kind != "" { 3739 objectMap["kind"] = msicar.Kind 3740 } 3741 if msicar.Etag != nil { 3742 objectMap["etag"] = msicar.Etag 3743 } 3744 return json.Marshal(objectMap) 3745} 3746 3747// AsFusionAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. 3748func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { 3749 return nil, false 3750} 3751 3752// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. 3753func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { 3754 return &msicar, true 3755} 3756 3757// AsScheduledAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. 3758func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { 3759 return nil, false 3760} 3761 3762// AsAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. 3763func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsAlertRule() (*AlertRule, bool) { 3764 return nil, false 3765} 3766 3767// AsBasicAlertRule is the BasicAlertRule implementation for MicrosoftSecurityIncidentCreationAlertRule. 3768func (msicar MicrosoftSecurityIncidentCreationAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { 3769 return &msicar, true 3770} 3771 3772// UnmarshalJSON is the custom unmarshaler for MicrosoftSecurityIncidentCreationAlertRule struct. 3773func (msicar *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(body []byte) error { 3774 var m map[string]*json.RawMessage 3775 err := json.Unmarshal(body, &m) 3776 if err != nil { 3777 return err 3778 } 3779 for k, v := range m { 3780 switch k { 3781 case "properties": 3782 if v != nil { 3783 var microsoftSecurityIncidentCreationAlertRuleProperties MicrosoftSecurityIncidentCreationAlertRuleProperties 3784 err = json.Unmarshal(*v, µsoftSecurityIncidentCreationAlertRuleProperties) 3785 if err != nil { 3786 return err 3787 } 3788 msicar.MicrosoftSecurityIncidentCreationAlertRuleProperties = µsoftSecurityIncidentCreationAlertRuleProperties 3789 } 3790 case "kind": 3791 if v != nil { 3792 var kind Kind 3793 err = json.Unmarshal(*v, &kind) 3794 if err != nil { 3795 return err 3796 } 3797 msicar.Kind = kind 3798 } 3799 case "id": 3800 if v != nil { 3801 var ID string 3802 err = json.Unmarshal(*v, &ID) 3803 if err != nil { 3804 return err 3805 } 3806 msicar.ID = &ID 3807 } 3808 case "name": 3809 if v != nil { 3810 var name string 3811 err = json.Unmarshal(*v, &name) 3812 if err != nil { 3813 return err 3814 } 3815 msicar.Name = &name 3816 } 3817 case "type": 3818 if v != nil { 3819 var typeVar string 3820 err = json.Unmarshal(*v, &typeVar) 3821 if err != nil { 3822 return err 3823 } 3824 msicar.Type = &typeVar 3825 } 3826 case "etag": 3827 if v != nil { 3828 var etag string 3829 err = json.Unmarshal(*v, &etag) 3830 if err != nil { 3831 return err 3832 } 3833 msicar.Etag = &etag 3834 } 3835 } 3836 } 3837 3838 return nil 3839} 3840 3841// MicrosoftSecurityIncidentCreationAlertRuleCommonProperties microsoftSecurityIncidentCreation rule common 3842// property bag. 3843type MicrosoftSecurityIncidentCreationAlertRuleCommonProperties struct { 3844 // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated 3845 DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` 3846 // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated 3847 DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` 3848 // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT' 3849 ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` 3850 // SeveritiesFilter - the alerts' severities on which the cases will be generated 3851 SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` 3852} 3853 3854// MicrosoftSecurityIncidentCreationAlertRuleProperties microsoftSecurityIncidentCreation rule property 3855// bag. 3856type MicrosoftSecurityIncidentCreationAlertRuleProperties struct { 3857 // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. 3858 AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` 3859 // Description - The description of the alert rule. 3860 Description *string `json:"description,omitempty"` 3861 // DisplayName - The display name for alerts created by this alert rule. 3862 DisplayName *string `json:"displayName,omitempty"` 3863 // Enabled - Determines whether this alert rule is enabled or disabled. 3864 Enabled *bool `json:"enabled,omitempty"` 3865 // LastModifiedUtc - READ-ONLY; The last time that this alert has been modified. 3866 LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` 3867 // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated 3868 DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` 3869 // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated 3870 DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` 3871 // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT' 3872 ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` 3873 // SeveritiesFilter - the alerts' severities on which the cases will be generated 3874 SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` 3875} 3876 3877// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleProperties. 3878func (msicarp MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { 3879 objectMap := make(map[string]interface{}) 3880 if msicarp.AlertRuleTemplateName != nil { 3881 objectMap["alertRuleTemplateName"] = msicarp.AlertRuleTemplateName 3882 } 3883 if msicarp.Description != nil { 3884 objectMap["description"] = msicarp.Description 3885 } 3886 if msicarp.DisplayName != nil { 3887 objectMap["displayName"] = msicarp.DisplayName 3888 } 3889 if msicarp.Enabled != nil { 3890 objectMap["enabled"] = msicarp.Enabled 3891 } 3892 if msicarp.DisplayNamesFilter != nil { 3893 objectMap["displayNamesFilter"] = msicarp.DisplayNamesFilter 3894 } 3895 if msicarp.DisplayNamesExcludeFilter != nil { 3896 objectMap["displayNamesExcludeFilter"] = msicarp.DisplayNamesExcludeFilter 3897 } 3898 if msicarp.ProductFilter != "" { 3899 objectMap["productFilter"] = msicarp.ProductFilter 3900 } 3901 if msicarp.SeveritiesFilter != nil { 3902 objectMap["severitiesFilter"] = msicarp.SeveritiesFilter 3903 } 3904 return json.Marshal(objectMap) 3905} 3906 3907// MicrosoftSecurityIncidentCreationAlertRuleTemplate represents MicrosoftSecurityIncidentCreation rule 3908// template. 3909type MicrosoftSecurityIncidentCreationAlertRuleTemplate struct { 3910 // MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - MicrosoftSecurityIncidentCreation rule template properties 3911 *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties `json:"properties,omitempty"` 3912 // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled' 3913 Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` 3914 // ID - READ-ONLY; Azure resource Id 3915 ID *string `json:"id,omitempty"` 3916 // Name - READ-ONLY; Azure resource name 3917 Name *string `json:"name,omitempty"` 3918 // Type - READ-ONLY; Azure resource type 3919 Type *string `json:"type,omitempty"` 3920} 3921 3922// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3923func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { 3924 msicart.Kind = KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation 3925 objectMap := make(map[string]interface{}) 3926 if msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties != nil { 3927 objectMap["properties"] = msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties 3928 } 3929 if msicart.Kind != "" { 3930 objectMap["kind"] = msicart.Kind 3931 } 3932 return json.Marshal(objectMap) 3933} 3934 3935// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3936func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { 3937 return nil, false 3938} 3939 3940// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3941func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { 3942 return &msicart, true 3943} 3944 3945// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3946func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { 3947 return nil, false 3948} 3949 3950// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3951func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { 3952 return nil, false 3953} 3954 3955// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for MicrosoftSecurityIncidentCreationAlertRuleTemplate. 3956func (msicart MicrosoftSecurityIncidentCreationAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { 3957 return &msicart, true 3958} 3959 3960// UnmarshalJSON is the custom unmarshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplate struct. 3961func (msicart *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(body []byte) error { 3962 var m map[string]*json.RawMessage 3963 err := json.Unmarshal(body, &m) 3964 if err != nil { 3965 return err 3966 } 3967 for k, v := range m { 3968 switch k { 3969 case "properties": 3970 if v != nil { 3971 var microsoftSecurityIncidentCreationAlertRuleTemplateProperties MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties 3972 err = json.Unmarshal(*v, µsoftSecurityIncidentCreationAlertRuleTemplateProperties) 3973 if err != nil { 3974 return err 3975 } 3976 msicart.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties = µsoftSecurityIncidentCreationAlertRuleTemplateProperties 3977 } 3978 case "kind": 3979 if v != nil { 3980 var kind KindBasicAlertRuleTemplate 3981 err = json.Unmarshal(*v, &kind) 3982 if err != nil { 3983 return err 3984 } 3985 msicart.Kind = kind 3986 } 3987 case "id": 3988 if v != nil { 3989 var ID string 3990 err = json.Unmarshal(*v, &ID) 3991 if err != nil { 3992 return err 3993 } 3994 msicart.ID = &ID 3995 } 3996 case "name": 3997 if v != nil { 3998 var name string 3999 err = json.Unmarshal(*v, &name) 4000 if err != nil { 4001 return err 4002 } 4003 msicart.Name = &name 4004 } 4005 case "type": 4006 if v != nil { 4007 var typeVar string 4008 err = json.Unmarshal(*v, &typeVar) 4009 if err != nil { 4010 return err 4011 } 4012 msicart.Type = &typeVar 4013 } 4014 } 4015 } 4016 4017 return nil 4018} 4019 4020// MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties microsoftSecurityIncidentCreation rule 4021// template properties 4022type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties struct { 4023 // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template 4024 AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` 4025 // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. 4026 CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` 4027 // Description - The description of the alert rule template. 4028 Description *string `json:"description,omitempty"` 4029 // DisplayName - The display name for alert rule template. 4030 DisplayName *string `json:"displayName,omitempty"` 4031 // RequiredDataConnectors - The required data connectors for this template 4032 RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` 4033 // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' 4034 Status TemplateStatus `json:"status,omitempty"` 4035 // DisplayNamesFilter - the alerts' displayNames on which the cases will be generated 4036 DisplayNamesFilter *[]string `json:"displayNamesFilter,omitempty"` 4037 // DisplayNamesExcludeFilter - the alerts' displayNames on which the cases will not be generated 4038 DisplayNamesExcludeFilter *[]string `json:"displayNamesExcludeFilter,omitempty"` 4039 // ProductFilter - The alerts' productName on which the cases will be generated. Possible values include: 'MicrosoftSecurityProductNameMicrosoftCloudAppSecurity', 'MicrosoftSecurityProductNameAzureSecurityCenter', 'MicrosoftSecurityProductNameAzureAdvancedThreatProtection', 'MicrosoftSecurityProductNameAzureActiveDirectoryIdentityProtection', 'MicrosoftSecurityProductNameAzureSecurityCenterforIoT' 4040 ProductFilter MicrosoftSecurityProductName `json:"productFilter,omitempty"` 4041 // SeveritiesFilter - the alerts' severities on which the cases will be generated 4042 SeveritiesFilter *[]AlertSeverity `json:"severitiesFilter,omitempty"` 4043} 4044 4045// MarshalJSON is the custom marshaler for MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. 4046func (msicartp MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { 4047 objectMap := make(map[string]interface{}) 4048 if msicartp.AlertRulesCreatedByTemplateCount != nil { 4049 objectMap["alertRulesCreatedByTemplateCount"] = msicartp.AlertRulesCreatedByTemplateCount 4050 } 4051 if msicartp.Description != nil { 4052 objectMap["description"] = msicartp.Description 4053 } 4054 if msicartp.DisplayName != nil { 4055 objectMap["displayName"] = msicartp.DisplayName 4056 } 4057 if msicartp.RequiredDataConnectors != nil { 4058 objectMap["requiredDataConnectors"] = msicartp.RequiredDataConnectors 4059 } 4060 if msicartp.Status != "" { 4061 objectMap["status"] = msicartp.Status 4062 } 4063 if msicartp.DisplayNamesFilter != nil { 4064 objectMap["displayNamesFilter"] = msicartp.DisplayNamesFilter 4065 } 4066 if msicartp.DisplayNamesExcludeFilter != nil { 4067 objectMap["displayNamesExcludeFilter"] = msicartp.DisplayNamesExcludeFilter 4068 } 4069 if msicartp.ProductFilter != "" { 4070 objectMap["productFilter"] = msicartp.ProductFilter 4071 } 4072 if msicartp.SeveritiesFilter != nil { 4073 objectMap["severitiesFilter"] = msicartp.SeveritiesFilter 4074 } 4075 return json.Marshal(objectMap) 4076} 4077 4078// OfficeConsent consent for Office365 tenant that already made. 4079type OfficeConsent struct { 4080 // OfficeConsentProperties - Office consent properties 4081 *OfficeConsentProperties `json:"properties,omitempty"` 4082 // ID - READ-ONLY; Azure resource Id 4083 ID *string `json:"id,omitempty"` 4084 // Name - READ-ONLY; Azure resource name 4085 Name *string `json:"name,omitempty"` 4086 // Type - READ-ONLY; Azure resource type 4087 Type *string `json:"type,omitempty"` 4088} 4089 4090// MarshalJSON is the custom marshaler for OfficeConsent. 4091func (oc OfficeConsent) MarshalJSON() ([]byte, error) { 4092 objectMap := make(map[string]interface{}) 4093 if oc.OfficeConsentProperties != nil { 4094 objectMap["properties"] = oc.OfficeConsentProperties 4095 } 4096 return json.Marshal(objectMap) 4097} 4098 4099// UnmarshalJSON is the custom unmarshaler for OfficeConsent struct. 4100func (oc *OfficeConsent) UnmarshalJSON(body []byte) error { 4101 var m map[string]*json.RawMessage 4102 err := json.Unmarshal(body, &m) 4103 if err != nil { 4104 return err 4105 } 4106 for k, v := range m { 4107 switch k { 4108 case "properties": 4109 if v != nil { 4110 var officeConsentProperties OfficeConsentProperties 4111 err = json.Unmarshal(*v, &officeConsentProperties) 4112 if err != nil { 4113 return err 4114 } 4115 oc.OfficeConsentProperties = &officeConsentProperties 4116 } 4117 case "id": 4118 if v != nil { 4119 var ID string 4120 err = json.Unmarshal(*v, &ID) 4121 if err != nil { 4122 return err 4123 } 4124 oc.ID = &ID 4125 } 4126 case "name": 4127 if v != nil { 4128 var name string 4129 err = json.Unmarshal(*v, &name) 4130 if err != nil { 4131 return err 4132 } 4133 oc.Name = &name 4134 } 4135 case "type": 4136 if v != nil { 4137 var typeVar string 4138 err = json.Unmarshal(*v, &typeVar) 4139 if err != nil { 4140 return err 4141 } 4142 oc.Type = &typeVar 4143 } 4144 } 4145 } 4146 4147 return nil 4148} 4149 4150// OfficeConsentList list of all the office365 consents. 4151type OfficeConsentList struct { 4152 // NextLink - READ-ONLY; URL to fetch the next set of office consents. 4153 NextLink *string `json:"nextLink,omitempty"` 4154 // Value - Array of the consents. 4155 Value *[]OfficeConsent `json:"value,omitempty"` 4156} 4157 4158// MarshalJSON is the custom marshaler for OfficeConsentList. 4159func (ocl OfficeConsentList) MarshalJSON() ([]byte, error) { 4160 objectMap := make(map[string]interface{}) 4161 if ocl.Value != nil { 4162 objectMap["value"] = ocl.Value 4163 } 4164 return json.Marshal(objectMap) 4165} 4166 4167// OfficeConsentProperties consent property bag. 4168type OfficeConsentProperties struct { 4169 // TenantID - The tenantId of the Office365 with the consent. 4170 TenantID *string `json:"tenantId,omitempty"` 4171 // TenantName - READ-ONLY; The tenant name of the Office365 with the consent. 4172 TenantName *string `json:"tenantName,omitempty"` 4173} 4174 4175// MarshalJSON is the custom marshaler for OfficeConsentProperties. 4176func (ocp OfficeConsentProperties) MarshalJSON() ([]byte, error) { 4177 objectMap := make(map[string]interface{}) 4178 if ocp.TenantID != nil { 4179 objectMap["tenantId"] = ocp.TenantID 4180 } 4181 return json.Marshal(objectMap) 4182} 4183 4184// OfficeDataConnector represents office data connector. 4185type OfficeDataConnector struct { 4186 // OfficeDataConnectorProperties - Office data connector properties. 4187 *OfficeDataConnectorProperties `json:"properties,omitempty"` 4188 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 4189 Kind KindBasicDataConnector `json:"kind,omitempty"` 4190 // ID - READ-ONLY; Azure resource Id 4191 ID *string `json:"id,omitempty"` 4192 // Name - READ-ONLY; Azure resource name 4193 Name *string `json:"name,omitempty"` 4194 // Type - READ-ONLY; Azure resource type 4195 Type *string `json:"type,omitempty"` 4196 // Etag - Etag of the azure resource 4197 Etag *string `json:"etag,omitempty"` 4198} 4199 4200// MarshalJSON is the custom marshaler for OfficeDataConnector. 4201func (odc OfficeDataConnector) MarshalJSON() ([]byte, error) { 4202 odc.Kind = KindBasicDataConnectorKindOffice365 4203 objectMap := make(map[string]interface{}) 4204 if odc.OfficeDataConnectorProperties != nil { 4205 objectMap["properties"] = odc.OfficeDataConnectorProperties 4206 } 4207 if odc.Kind != "" { 4208 objectMap["kind"] = odc.Kind 4209 } 4210 if odc.Etag != nil { 4211 objectMap["etag"] = odc.Etag 4212 } 4213 return json.Marshal(objectMap) 4214} 4215 4216// AsAADDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4217func (odc OfficeDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 4218 return nil, false 4219} 4220 4221// AsAATPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4222func (odc OfficeDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 4223 return nil, false 4224} 4225 4226// AsASCDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4227func (odc OfficeDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 4228 return nil, false 4229} 4230 4231// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4232func (odc OfficeDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 4233 return nil, false 4234} 4235 4236// AsMCASDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4237func (odc OfficeDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 4238 return nil, false 4239} 4240 4241// AsMDATPDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4242func (odc OfficeDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 4243 return nil, false 4244} 4245 4246// AsOfficeDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4247func (odc OfficeDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 4248 return &odc, true 4249} 4250 4251// AsTIDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4252func (odc OfficeDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 4253 return nil, false 4254} 4255 4256// AsDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4257func (odc OfficeDataConnector) AsDataConnector() (*DataConnector, bool) { 4258 return nil, false 4259} 4260 4261// AsBasicDataConnector is the BasicDataConnector implementation for OfficeDataConnector. 4262func (odc OfficeDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 4263 return &odc, true 4264} 4265 4266// UnmarshalJSON is the custom unmarshaler for OfficeDataConnector struct. 4267func (odc *OfficeDataConnector) UnmarshalJSON(body []byte) error { 4268 var m map[string]*json.RawMessage 4269 err := json.Unmarshal(body, &m) 4270 if err != nil { 4271 return err 4272 } 4273 for k, v := range m { 4274 switch k { 4275 case "properties": 4276 if v != nil { 4277 var officeDataConnectorProperties OfficeDataConnectorProperties 4278 err = json.Unmarshal(*v, &officeDataConnectorProperties) 4279 if err != nil { 4280 return err 4281 } 4282 odc.OfficeDataConnectorProperties = &officeDataConnectorProperties 4283 } 4284 case "kind": 4285 if v != nil { 4286 var kind KindBasicDataConnector 4287 err = json.Unmarshal(*v, &kind) 4288 if err != nil { 4289 return err 4290 } 4291 odc.Kind = kind 4292 } 4293 case "id": 4294 if v != nil { 4295 var ID string 4296 err = json.Unmarshal(*v, &ID) 4297 if err != nil { 4298 return err 4299 } 4300 odc.ID = &ID 4301 } 4302 case "name": 4303 if v != nil { 4304 var name string 4305 err = json.Unmarshal(*v, &name) 4306 if err != nil { 4307 return err 4308 } 4309 odc.Name = &name 4310 } 4311 case "type": 4312 if v != nil { 4313 var typeVar string 4314 err = json.Unmarshal(*v, &typeVar) 4315 if err != nil { 4316 return err 4317 } 4318 odc.Type = &typeVar 4319 } 4320 case "etag": 4321 if v != nil { 4322 var etag string 4323 err = json.Unmarshal(*v, &etag) 4324 if err != nil { 4325 return err 4326 } 4327 odc.Etag = &etag 4328 } 4329 } 4330 } 4331 4332 return nil 4333} 4334 4335// OfficeDataConnectorDataTypes the available data types for office data connector. 4336type OfficeDataConnectorDataTypes struct { 4337 // Exchange - Exchange data type connection. 4338 Exchange *OfficeDataConnectorDataTypesExchange `json:"exchange,omitempty"` 4339 // SharePoint - SharePoint data type connection. 4340 SharePoint *OfficeDataConnectorDataTypesSharePoint `json:"sharePoint,omitempty"` 4341 // Teams - Teams data type connection. 4342 Teams *OfficeDataConnectorDataTypesTeams `json:"teams,omitempty"` 4343} 4344 4345// OfficeDataConnectorDataTypesExchange exchange data type connection. 4346type OfficeDataConnectorDataTypesExchange struct { 4347 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 4348 State DataTypeState `json:"state,omitempty"` 4349} 4350 4351// OfficeDataConnectorDataTypesSharePoint sharePoint data type connection. 4352type OfficeDataConnectorDataTypesSharePoint struct { 4353 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 4354 State DataTypeState `json:"state,omitempty"` 4355} 4356 4357// OfficeDataConnectorDataTypesTeams teams data type connection. 4358type OfficeDataConnectorDataTypesTeams struct { 4359 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 4360 State DataTypeState `json:"state,omitempty"` 4361} 4362 4363// OfficeDataConnectorProperties office data connector properties. 4364type OfficeDataConnectorProperties struct { 4365 // TenantID - The tenant id to connect to, and get the data from. 4366 TenantID *string `json:"tenantId,omitempty"` 4367 // DataTypes - The available data types for the connector. 4368 DataTypes *OfficeDataConnectorDataTypes `json:"dataTypes,omitempty"` 4369} 4370 4371// Operation operation provided by provider 4372type Operation struct { 4373 // Display - Properties of the operation 4374 Display *OperationDisplay `json:"display,omitempty"` 4375 // Name - Name of the operation 4376 Name *string `json:"name,omitempty"` 4377 // Origin - The origin of the operation 4378 Origin *string `json:"origin,omitempty"` 4379} 4380 4381// OperationDisplay properties of the operation 4382type OperationDisplay struct { 4383 // Description - Description of the operation 4384 Description *string `json:"description,omitempty"` 4385 // Operation - Operation name 4386 Operation *string `json:"operation,omitempty"` 4387 // Provider - Provider name 4388 Provider *string `json:"provider,omitempty"` 4389 // Resource - Resource name 4390 Resource *string `json:"resource,omitempty"` 4391} 4392 4393// OperationsList lists the operations available in the SecurityInsights RP. 4394type OperationsList struct { 4395 autorest.Response `json:"-"` 4396 // NextLink - URL to fetch the next set of operations. 4397 NextLink *string `json:"nextLink,omitempty"` 4398 // Value - Array of operations 4399 Value *[]Operation `json:"value,omitempty"` 4400} 4401 4402// OperationsListIterator provides access to a complete listing of Operation values. 4403type OperationsListIterator struct { 4404 i int 4405 page OperationsListPage 4406} 4407 4408// NextWithContext advances to the next value. If there was an error making 4409// the request the iterator does not advance and the error is returned. 4410func (iter *OperationsListIterator) NextWithContext(ctx context.Context) (err error) { 4411 if tracing.IsEnabled() { 4412 ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListIterator.NextWithContext") 4413 defer func() { 4414 sc := -1 4415 if iter.Response().Response.Response != nil { 4416 sc = iter.Response().Response.Response.StatusCode 4417 } 4418 tracing.EndSpan(ctx, sc, err) 4419 }() 4420 } 4421 iter.i++ 4422 if iter.i < len(iter.page.Values()) { 4423 return nil 4424 } 4425 err = iter.page.NextWithContext(ctx) 4426 if err != nil { 4427 iter.i-- 4428 return err 4429 } 4430 iter.i = 0 4431 return nil 4432} 4433 4434// Next advances to the next value. If there was an error making 4435// the request the iterator does not advance and the error is returned. 4436// Deprecated: Use NextWithContext() instead. 4437func (iter *OperationsListIterator) Next() error { 4438 return iter.NextWithContext(context.Background()) 4439} 4440 4441// NotDone returns true if the enumeration should be started or is not yet complete. 4442func (iter OperationsListIterator) NotDone() bool { 4443 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4444} 4445 4446// Response returns the raw server response from the last page request. 4447func (iter OperationsListIterator) Response() OperationsList { 4448 return iter.page.Response() 4449} 4450 4451// Value returns the current value or a zero-initialized value if the 4452// iterator has advanced beyond the end of the collection. 4453func (iter OperationsListIterator) Value() Operation { 4454 if !iter.page.NotDone() { 4455 return Operation{} 4456 } 4457 return iter.page.Values()[iter.i] 4458} 4459 4460// Creates a new instance of the OperationsListIterator type. 4461func NewOperationsListIterator(page OperationsListPage) OperationsListIterator { 4462 return OperationsListIterator{page: page} 4463} 4464 4465// IsEmpty returns true if the ListResult contains no values. 4466func (ol OperationsList) IsEmpty() bool { 4467 return ol.Value == nil || len(*ol.Value) == 0 4468} 4469 4470// hasNextLink returns true if the NextLink is not empty. 4471func (ol OperationsList) hasNextLink() bool { 4472 return ol.NextLink != nil && len(*ol.NextLink) != 0 4473} 4474 4475// operationsListPreparer prepares a request to retrieve the next set of results. 4476// It returns nil if no more results exist. 4477func (ol OperationsList) operationsListPreparer(ctx context.Context) (*http.Request, error) { 4478 if !ol.hasNextLink() { 4479 return nil, nil 4480 } 4481 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4482 autorest.AsJSON(), 4483 autorest.AsGet(), 4484 autorest.WithBaseURL(to.String(ol.NextLink))) 4485} 4486 4487// OperationsListPage contains a page of Operation values. 4488type OperationsListPage struct { 4489 fn func(context.Context, OperationsList) (OperationsList, error) 4490 ol OperationsList 4491} 4492 4493// NextWithContext advances to the next page of values. If there was an error making 4494// the request the page does not advance and the error is returned. 4495func (page *OperationsListPage) NextWithContext(ctx context.Context) (err error) { 4496 if tracing.IsEnabled() { 4497 ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListPage.NextWithContext") 4498 defer func() { 4499 sc := -1 4500 if page.Response().Response.Response != nil { 4501 sc = page.Response().Response.Response.StatusCode 4502 } 4503 tracing.EndSpan(ctx, sc, err) 4504 }() 4505 } 4506 for { 4507 next, err := page.fn(ctx, page.ol) 4508 if err != nil { 4509 return err 4510 } 4511 page.ol = next 4512 if !next.hasNextLink() || !next.IsEmpty() { 4513 break 4514 } 4515 } 4516 return nil 4517} 4518 4519// Next advances to the next page of values. If there was an error making 4520// the request the page does not advance and the error is returned. 4521// Deprecated: Use NextWithContext() instead. 4522func (page *OperationsListPage) Next() error { 4523 return page.NextWithContext(context.Background()) 4524} 4525 4526// NotDone returns true if the page enumeration should be started or is not yet complete. 4527func (page OperationsListPage) NotDone() bool { 4528 return !page.ol.IsEmpty() 4529} 4530 4531// Response returns the raw server response from the last page request. 4532func (page OperationsListPage) Response() OperationsList { 4533 return page.ol 4534} 4535 4536// Values returns the slice of values for the current page or nil if there are no values. 4537func (page OperationsListPage) Values() []Operation { 4538 if page.ol.IsEmpty() { 4539 return nil 4540 } 4541 return *page.ol.Value 4542} 4543 4544// Creates a new instance of the OperationsListPage type. 4545func NewOperationsListPage(cur OperationsList, getNextPage func(context.Context, OperationsList) (OperationsList, error)) OperationsListPage { 4546 return OperationsListPage{ 4547 fn: getNextPage, 4548 ol: cur, 4549 } 4550} 4551 4552// Resource an azure resource object 4553type Resource struct { 4554 // ID - READ-ONLY; Azure resource Id 4555 ID *string `json:"id,omitempty"` 4556 // Name - READ-ONLY; Azure resource name 4557 Name *string `json:"name,omitempty"` 4558 // Type - READ-ONLY; Azure resource type 4559 Type *string `json:"type,omitempty"` 4560} 4561 4562// MarshalJSON is the custom marshaler for Resource. 4563func (r Resource) MarshalJSON() ([]byte, error) { 4564 objectMap := make(map[string]interface{}) 4565 return json.Marshal(objectMap) 4566} 4567 4568// ResourceWithEtag an azure resource object with an Etag property 4569type ResourceWithEtag struct { 4570 // ID - READ-ONLY; Azure resource Id 4571 ID *string `json:"id,omitempty"` 4572 // Name - READ-ONLY; Azure resource name 4573 Name *string `json:"name,omitempty"` 4574 // Type - READ-ONLY; Azure resource type 4575 Type *string `json:"type,omitempty"` 4576 // Etag - Etag of the azure resource 4577 Etag *string `json:"etag,omitempty"` 4578} 4579 4580// MarshalJSON is the custom marshaler for ResourceWithEtag. 4581func (rwe ResourceWithEtag) MarshalJSON() ([]byte, error) { 4582 objectMap := make(map[string]interface{}) 4583 if rwe.Etag != nil { 4584 objectMap["etag"] = rwe.Etag 4585 } 4586 return json.Marshal(objectMap) 4587} 4588 4589// ScheduledAlertRule represents scheduled alert rule. 4590type ScheduledAlertRule struct { 4591 // ScheduledAlertRuleProperties - Scheduled alert rule properties 4592 *ScheduledAlertRuleProperties `json:"properties,omitempty"` 4593 // Kind - Possible values include: 'KindAlertRule', 'KindFusion', 'KindMicrosoftSecurityIncidentCreation', 'KindScheduled' 4594 Kind Kind `json:"kind,omitempty"` 4595 // ID - READ-ONLY; Azure resource Id 4596 ID *string `json:"id,omitempty"` 4597 // Name - READ-ONLY; Azure resource name 4598 Name *string `json:"name,omitempty"` 4599 // Type - READ-ONLY; Azure resource type 4600 Type *string `json:"type,omitempty"` 4601 // Etag - Etag of the azure resource 4602 Etag *string `json:"etag,omitempty"` 4603} 4604 4605// MarshalJSON is the custom marshaler for ScheduledAlertRule. 4606func (sar ScheduledAlertRule) MarshalJSON() ([]byte, error) { 4607 sar.Kind = KindScheduled 4608 objectMap := make(map[string]interface{}) 4609 if sar.ScheduledAlertRuleProperties != nil { 4610 objectMap["properties"] = sar.ScheduledAlertRuleProperties 4611 } 4612 if sar.Kind != "" { 4613 objectMap["kind"] = sar.Kind 4614 } 4615 if sar.Etag != nil { 4616 objectMap["etag"] = sar.Etag 4617 } 4618 return json.Marshal(objectMap) 4619} 4620 4621// AsFusionAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. 4622func (sar ScheduledAlertRule) AsFusionAlertRule() (*FusionAlertRule, bool) { 4623 return nil, false 4624} 4625 4626// AsMicrosoftSecurityIncidentCreationAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. 4627func (sar ScheduledAlertRule) AsMicrosoftSecurityIncidentCreationAlertRule() (*MicrosoftSecurityIncidentCreationAlertRule, bool) { 4628 return nil, false 4629} 4630 4631// AsScheduledAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. 4632func (sar ScheduledAlertRule) AsScheduledAlertRule() (*ScheduledAlertRule, bool) { 4633 return &sar, true 4634} 4635 4636// AsAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. 4637func (sar ScheduledAlertRule) AsAlertRule() (*AlertRule, bool) { 4638 return nil, false 4639} 4640 4641// AsBasicAlertRule is the BasicAlertRule implementation for ScheduledAlertRule. 4642func (sar ScheduledAlertRule) AsBasicAlertRule() (BasicAlertRule, bool) { 4643 return &sar, true 4644} 4645 4646// UnmarshalJSON is the custom unmarshaler for ScheduledAlertRule struct. 4647func (sar *ScheduledAlertRule) UnmarshalJSON(body []byte) error { 4648 var m map[string]*json.RawMessage 4649 err := json.Unmarshal(body, &m) 4650 if err != nil { 4651 return err 4652 } 4653 for k, v := range m { 4654 switch k { 4655 case "properties": 4656 if v != nil { 4657 var scheduledAlertRuleProperties ScheduledAlertRuleProperties 4658 err = json.Unmarshal(*v, &scheduledAlertRuleProperties) 4659 if err != nil { 4660 return err 4661 } 4662 sar.ScheduledAlertRuleProperties = &scheduledAlertRuleProperties 4663 } 4664 case "kind": 4665 if v != nil { 4666 var kind Kind 4667 err = json.Unmarshal(*v, &kind) 4668 if err != nil { 4669 return err 4670 } 4671 sar.Kind = kind 4672 } 4673 case "id": 4674 if v != nil { 4675 var ID string 4676 err = json.Unmarshal(*v, &ID) 4677 if err != nil { 4678 return err 4679 } 4680 sar.ID = &ID 4681 } 4682 case "name": 4683 if v != nil { 4684 var name string 4685 err = json.Unmarshal(*v, &name) 4686 if err != nil { 4687 return err 4688 } 4689 sar.Name = &name 4690 } 4691 case "type": 4692 if v != nil { 4693 var typeVar string 4694 err = json.Unmarshal(*v, &typeVar) 4695 if err != nil { 4696 return err 4697 } 4698 sar.Type = &typeVar 4699 } 4700 case "etag": 4701 if v != nil { 4702 var etag string 4703 err = json.Unmarshal(*v, &etag) 4704 if err != nil { 4705 return err 4706 } 4707 sar.Etag = &etag 4708 } 4709 } 4710 } 4711 4712 return nil 4713} 4714 4715// ScheduledAlertRuleCommonProperties schedule alert rule template property bag. 4716type ScheduledAlertRuleCommonProperties struct { 4717 // Query - The query that creates alerts for this rule. 4718 Query *string `json:"query,omitempty"` 4719 // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. 4720 QueryFrequency *string `json:"queryFrequency,omitempty"` 4721 // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. 4722 QueryPeriod *string `json:"queryPeriod,omitempty"` 4723 // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' 4724 Severity AlertSeverity `json:"severity,omitempty"` 4725 // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' 4726 TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` 4727 // TriggerThreshold - The threshold triggers this alert rule. 4728 TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` 4729} 4730 4731// ScheduledAlertRuleProperties scheduled alert rule base property bag. 4732type ScheduledAlertRuleProperties struct { 4733 // AlertRuleTemplateName - The Name of the alert rule template used to create this rule. 4734 AlertRuleTemplateName *string `json:"alertRuleTemplateName,omitempty"` 4735 // Description - The description of the alert rule. 4736 Description *string `json:"description,omitempty"` 4737 // DisplayName - The display name for alerts created by this alert rule. 4738 DisplayName *string `json:"displayName,omitempty"` 4739 // Enabled - Determines whether this alert rule is enabled or disabled. 4740 Enabled *bool `json:"enabled,omitempty"` 4741 // LastModifiedUtc - READ-ONLY; The last time that this alert rule has been modified. 4742 LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` 4743 // SuppressionDuration - The suppression (in ISO 8601 duration format) to wait since last time this alert rule been triggered. 4744 SuppressionDuration *string `json:"suppressionDuration,omitempty"` 4745 // SuppressionEnabled - Determines whether the suppression for this alert rule is enabled or disabled. 4746 SuppressionEnabled *bool `json:"suppressionEnabled,omitempty"` 4747 // Tactics - The tactics of the alert rule 4748 Tactics *[]AttackTactic `json:"tactics,omitempty"` 4749 // Query - The query that creates alerts for this rule. 4750 Query *string `json:"query,omitempty"` 4751 // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. 4752 QueryFrequency *string `json:"queryFrequency,omitempty"` 4753 // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. 4754 QueryPeriod *string `json:"queryPeriod,omitempty"` 4755 // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' 4756 Severity AlertSeverity `json:"severity,omitempty"` 4757 // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' 4758 TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` 4759 // TriggerThreshold - The threshold triggers this alert rule. 4760 TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` 4761} 4762 4763// MarshalJSON is the custom marshaler for ScheduledAlertRuleProperties. 4764func (sarp ScheduledAlertRuleProperties) MarshalJSON() ([]byte, error) { 4765 objectMap := make(map[string]interface{}) 4766 if sarp.AlertRuleTemplateName != nil { 4767 objectMap["alertRuleTemplateName"] = sarp.AlertRuleTemplateName 4768 } 4769 if sarp.Description != nil { 4770 objectMap["description"] = sarp.Description 4771 } 4772 if sarp.DisplayName != nil { 4773 objectMap["displayName"] = sarp.DisplayName 4774 } 4775 if sarp.Enabled != nil { 4776 objectMap["enabled"] = sarp.Enabled 4777 } 4778 if sarp.SuppressionDuration != nil { 4779 objectMap["suppressionDuration"] = sarp.SuppressionDuration 4780 } 4781 if sarp.SuppressionEnabled != nil { 4782 objectMap["suppressionEnabled"] = sarp.SuppressionEnabled 4783 } 4784 if sarp.Tactics != nil { 4785 objectMap["tactics"] = sarp.Tactics 4786 } 4787 if sarp.Query != nil { 4788 objectMap["query"] = sarp.Query 4789 } 4790 if sarp.QueryFrequency != nil { 4791 objectMap["queryFrequency"] = sarp.QueryFrequency 4792 } 4793 if sarp.QueryPeriod != nil { 4794 objectMap["queryPeriod"] = sarp.QueryPeriod 4795 } 4796 if sarp.Severity != "" { 4797 objectMap["severity"] = sarp.Severity 4798 } 4799 if sarp.TriggerOperator != "" { 4800 objectMap["triggerOperator"] = sarp.TriggerOperator 4801 } 4802 if sarp.TriggerThreshold != nil { 4803 objectMap["triggerThreshold"] = sarp.TriggerThreshold 4804 } 4805 return json.Marshal(objectMap) 4806} 4807 4808// ScheduledAlertRuleTemplate represents scheduled alert rule template. 4809type ScheduledAlertRuleTemplate struct { 4810 // ScheduledAlertRuleTemplateProperties - Scheduled alert rule template properties 4811 *ScheduledAlertRuleTemplateProperties `json:"properties,omitempty"` 4812 // Kind - Possible values include: 'KindBasicAlertRuleTemplateKindAlertRuleTemplate', 'KindBasicAlertRuleTemplateKindFusion', 'KindBasicAlertRuleTemplateKindMicrosoftSecurityIncidentCreation', 'KindBasicAlertRuleTemplateKindScheduled' 4813 Kind KindBasicAlertRuleTemplate `json:"kind,omitempty"` 4814 // ID - READ-ONLY; Azure resource Id 4815 ID *string `json:"id,omitempty"` 4816 // Name - READ-ONLY; Azure resource name 4817 Name *string `json:"name,omitempty"` 4818 // Type - READ-ONLY; Azure resource type 4819 Type *string `json:"type,omitempty"` 4820} 4821 4822// MarshalJSON is the custom marshaler for ScheduledAlertRuleTemplate. 4823func (sart ScheduledAlertRuleTemplate) MarshalJSON() ([]byte, error) { 4824 sart.Kind = KindBasicAlertRuleTemplateKindScheduled 4825 objectMap := make(map[string]interface{}) 4826 if sart.ScheduledAlertRuleTemplateProperties != nil { 4827 objectMap["properties"] = sart.ScheduledAlertRuleTemplateProperties 4828 } 4829 if sart.Kind != "" { 4830 objectMap["kind"] = sart.Kind 4831 } 4832 return json.Marshal(objectMap) 4833} 4834 4835// AsFusionAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. 4836func (sart ScheduledAlertRuleTemplate) AsFusionAlertRuleTemplate() (*FusionAlertRuleTemplate, bool) { 4837 return nil, false 4838} 4839 4840// AsMicrosoftSecurityIncidentCreationAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. 4841func (sart ScheduledAlertRuleTemplate) AsMicrosoftSecurityIncidentCreationAlertRuleTemplate() (*MicrosoftSecurityIncidentCreationAlertRuleTemplate, bool) { 4842 return nil, false 4843} 4844 4845// AsScheduledAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. 4846func (sart ScheduledAlertRuleTemplate) AsScheduledAlertRuleTemplate() (*ScheduledAlertRuleTemplate, bool) { 4847 return &sart, true 4848} 4849 4850// AsAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. 4851func (sart ScheduledAlertRuleTemplate) AsAlertRuleTemplate() (*AlertRuleTemplate, bool) { 4852 return nil, false 4853} 4854 4855// AsBasicAlertRuleTemplate is the BasicAlertRuleTemplate implementation for ScheduledAlertRuleTemplate. 4856func (sart ScheduledAlertRuleTemplate) AsBasicAlertRuleTemplate() (BasicAlertRuleTemplate, bool) { 4857 return &sart, true 4858} 4859 4860// UnmarshalJSON is the custom unmarshaler for ScheduledAlertRuleTemplate struct. 4861func (sart *ScheduledAlertRuleTemplate) UnmarshalJSON(body []byte) error { 4862 var m map[string]*json.RawMessage 4863 err := json.Unmarshal(body, &m) 4864 if err != nil { 4865 return err 4866 } 4867 for k, v := range m { 4868 switch k { 4869 case "properties": 4870 if v != nil { 4871 var scheduledAlertRuleTemplateProperties ScheduledAlertRuleTemplateProperties 4872 err = json.Unmarshal(*v, &scheduledAlertRuleTemplateProperties) 4873 if err != nil { 4874 return err 4875 } 4876 sart.ScheduledAlertRuleTemplateProperties = &scheduledAlertRuleTemplateProperties 4877 } 4878 case "kind": 4879 if v != nil { 4880 var kind KindBasicAlertRuleTemplate 4881 err = json.Unmarshal(*v, &kind) 4882 if err != nil { 4883 return err 4884 } 4885 sart.Kind = kind 4886 } 4887 case "id": 4888 if v != nil { 4889 var ID string 4890 err = json.Unmarshal(*v, &ID) 4891 if err != nil { 4892 return err 4893 } 4894 sart.ID = &ID 4895 } 4896 case "name": 4897 if v != nil { 4898 var name string 4899 err = json.Unmarshal(*v, &name) 4900 if err != nil { 4901 return err 4902 } 4903 sart.Name = &name 4904 } 4905 case "type": 4906 if v != nil { 4907 var typeVar string 4908 err = json.Unmarshal(*v, &typeVar) 4909 if err != nil { 4910 return err 4911 } 4912 sart.Type = &typeVar 4913 } 4914 } 4915 } 4916 4917 return nil 4918} 4919 4920// ScheduledAlertRuleTemplateProperties scheduled alert rule template properties 4921type ScheduledAlertRuleTemplateProperties struct { 4922 // AlertRulesCreatedByTemplateCount - the number of alert rules that were created by this template 4923 AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` 4924 // CreatedDateUTC - READ-ONLY; The time that this alert rule template has been added. 4925 CreatedDateUTC *date.Time `json:"createdDateUTC,omitempty"` 4926 // Description - The description of the alert rule template. 4927 Description *string `json:"description,omitempty"` 4928 // DisplayName - The display name for alert rule template. 4929 DisplayName *string `json:"displayName,omitempty"` 4930 // RequiredDataConnectors - The required data connectors for this template 4931 RequiredDataConnectors *[]AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` 4932 // Status - The alert rule template status. Possible values include: 'TemplateStatusInstalled', 'TemplateStatusAvailable', 'TemplateStatusNotAvailable' 4933 Status TemplateStatus `json:"status,omitempty"` 4934 // Query - The query that creates alerts for this rule. 4935 Query *string `json:"query,omitempty"` 4936 // QueryFrequency - The frequency (in ISO 8601 duration format) for this alert rule to run. 4937 QueryFrequency *string `json:"queryFrequency,omitempty"` 4938 // QueryPeriod - The period (in ISO 8601 duration format) that this alert rule looks at. 4939 QueryPeriod *string `json:"queryPeriod,omitempty"` 4940 // Severity - The severity for alerts created by this alert rule. Possible values include: 'AlertSeverityHigh', 'AlertSeverityMedium', 'AlertSeverityLow', 'AlertSeverityInformational' 4941 Severity AlertSeverity `json:"severity,omitempty"` 4942 // TriggerOperator - The operation against the threshold that triggers alert rule. Possible values include: 'TriggerOperatorGreaterThan', 'TriggerOperatorLessThan', 'TriggerOperatorEqual', 'TriggerOperatorNotEqual' 4943 TriggerOperator TriggerOperator `json:"triggerOperator,omitempty"` 4944 // TriggerThreshold - The threshold triggers this alert rule. 4945 TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` 4946 // Tactics - The tactics of the alert rule template 4947 Tactics *[]AttackTactic `json:"tactics,omitempty"` 4948} 4949 4950// MarshalJSON is the custom marshaler for ScheduledAlertRuleTemplateProperties. 4951func (sartp ScheduledAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { 4952 objectMap := make(map[string]interface{}) 4953 if sartp.AlertRulesCreatedByTemplateCount != nil { 4954 objectMap["alertRulesCreatedByTemplateCount"] = sartp.AlertRulesCreatedByTemplateCount 4955 } 4956 if sartp.Description != nil { 4957 objectMap["description"] = sartp.Description 4958 } 4959 if sartp.DisplayName != nil { 4960 objectMap["displayName"] = sartp.DisplayName 4961 } 4962 if sartp.RequiredDataConnectors != nil { 4963 objectMap["requiredDataConnectors"] = sartp.RequiredDataConnectors 4964 } 4965 if sartp.Status != "" { 4966 objectMap["status"] = sartp.Status 4967 } 4968 if sartp.Query != nil { 4969 objectMap["query"] = sartp.Query 4970 } 4971 if sartp.QueryFrequency != nil { 4972 objectMap["queryFrequency"] = sartp.QueryFrequency 4973 } 4974 if sartp.QueryPeriod != nil { 4975 objectMap["queryPeriod"] = sartp.QueryPeriod 4976 } 4977 if sartp.Severity != "" { 4978 objectMap["severity"] = sartp.Severity 4979 } 4980 if sartp.TriggerOperator != "" { 4981 objectMap["triggerOperator"] = sartp.TriggerOperator 4982 } 4983 if sartp.TriggerThreshold != nil { 4984 objectMap["triggerThreshold"] = sartp.TriggerThreshold 4985 } 4986 if sartp.Tactics != nil { 4987 objectMap["tactics"] = sartp.Tactics 4988 } 4989 return json.Marshal(objectMap) 4990} 4991 4992// BasicSettings the Settings. 4993type BasicSettings interface { 4994 AsToggleSettings() (*ToggleSettings, bool) 4995 AsUebaSettings() (*UebaSettings, bool) 4996 AsSettings() (*Settings, bool) 4997} 4998 4999// Settings the Settings. 5000type Settings struct { 5001 // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindToggleSettings', 'KindBasicSettingsKindUebaSettings' 5002 Kind KindBasicSettings `json:"kind,omitempty"` 5003 // ID - READ-ONLY; Azure resource Id 5004 ID *string `json:"id,omitempty"` 5005 // Name - READ-ONLY; Azure resource name 5006 Name *string `json:"name,omitempty"` 5007 // Type - READ-ONLY; Azure resource type 5008 Type *string `json:"type,omitempty"` 5009 // Etag - Etag of the azure resource 5010 Etag *string `json:"etag,omitempty"` 5011} 5012 5013func unmarshalBasicSettings(body []byte) (BasicSettings, error) { 5014 var m map[string]interface{} 5015 err := json.Unmarshal(body, &m) 5016 if err != nil { 5017 return nil, err 5018 } 5019 5020 switch m["kind"] { 5021 case string(KindBasicSettingsKindToggleSettings): 5022 var ts ToggleSettings 5023 err := json.Unmarshal(body, &ts) 5024 return ts, err 5025 case string(KindBasicSettingsKindUebaSettings): 5026 var us UebaSettings 5027 err := json.Unmarshal(body, &us) 5028 return us, err 5029 default: 5030 var s Settings 5031 err := json.Unmarshal(body, &s) 5032 return s, err 5033 } 5034} 5035func unmarshalBasicSettingsArray(body []byte) ([]BasicSettings, error) { 5036 var rawMessages []*json.RawMessage 5037 err := json.Unmarshal(body, &rawMessages) 5038 if err != nil { 5039 return nil, err 5040 } 5041 5042 sArray := make([]BasicSettings, len(rawMessages)) 5043 5044 for index, rawMessage := range rawMessages { 5045 s, err := unmarshalBasicSettings(*rawMessage) 5046 if err != nil { 5047 return nil, err 5048 } 5049 sArray[index] = s 5050 } 5051 return sArray, nil 5052} 5053 5054// MarshalJSON is the custom marshaler for Settings. 5055func (s Settings) MarshalJSON() ([]byte, error) { 5056 s.Kind = KindBasicSettingsKindSettings 5057 objectMap := make(map[string]interface{}) 5058 if s.Kind != "" { 5059 objectMap["kind"] = s.Kind 5060 } 5061 if s.Etag != nil { 5062 objectMap["etag"] = s.Etag 5063 } 5064 return json.Marshal(objectMap) 5065} 5066 5067// AsToggleSettings is the BasicSettings implementation for Settings. 5068func (s Settings) AsToggleSettings() (*ToggleSettings, bool) { 5069 return nil, false 5070} 5071 5072// AsUebaSettings is the BasicSettings implementation for Settings. 5073func (s Settings) AsUebaSettings() (*UebaSettings, bool) { 5074 return nil, false 5075} 5076 5077// AsSettings is the BasicSettings implementation for Settings. 5078func (s Settings) AsSettings() (*Settings, bool) { 5079 return &s, true 5080} 5081 5082// AsBasicSettings is the BasicSettings implementation for Settings. 5083func (s Settings) AsBasicSettings() (BasicSettings, bool) { 5084 return &s, true 5085} 5086 5087// ThreatIntelligence threatIntelligence property bag. 5088type ThreatIntelligence struct { 5089 // Confidence - READ-ONLY; Confidence (must be between 0 and 1) 5090 Confidence *float64 `json:"confidence,omitempty"` 5091 // ProviderName - READ-ONLY; Name of the provider from whom this Threat Intelligence information was received 5092 ProviderName *string `json:"providerName,omitempty"` 5093 // ReportLink - READ-ONLY; Report link 5094 ReportLink *string `json:"reportLink,omitempty"` 5095 // ThreatDescription - READ-ONLY; Threat description (free text) 5096 ThreatDescription *string `json:"threatDescription,omitempty"` 5097 // ThreatName - READ-ONLY; Threat name (e.g. "Jedobot malware") 5098 ThreatName *string `json:"threatName,omitempty"` 5099 // ThreatType - READ-ONLY; Threat type (e.g. "Botnet") 5100 ThreatType *string `json:"threatType,omitempty"` 5101} 5102 5103// MarshalJSON is the custom marshaler for ThreatIntelligence. 5104func (ti ThreatIntelligence) MarshalJSON() ([]byte, error) { 5105 objectMap := make(map[string]interface{}) 5106 return json.Marshal(objectMap) 5107} 5108 5109// TIDataConnector represents threat intelligence data connector. 5110type TIDataConnector struct { 5111 // TIDataConnectorProperties - TI (Threat Intelligence) data connector properties. 5112 *TIDataConnectorProperties `json:"properties,omitempty"` 5113 // Kind - Possible values include: 'KindBasicDataConnectorKindDataConnector', 'KindBasicDataConnectorKindAzureActiveDirectory', 'KindBasicDataConnectorKindAzureAdvancedThreatProtection', 'KindBasicDataConnectorKindAzureSecurityCenter', 'KindBasicDataConnectorKindAmazonWebServicesCloudTrail', 'KindBasicDataConnectorKindMicrosoftCloudAppSecurity', 'KindBasicDataConnectorKindMicrosoftDefenderAdvancedThreatProtection', 'KindBasicDataConnectorKindOffice365', 'KindBasicDataConnectorKindThreatIntelligence' 5114 Kind KindBasicDataConnector `json:"kind,omitempty"` 5115 // ID - READ-ONLY; Azure resource Id 5116 ID *string `json:"id,omitempty"` 5117 // Name - READ-ONLY; Azure resource name 5118 Name *string `json:"name,omitempty"` 5119 // Type - READ-ONLY; Azure resource type 5120 Type *string `json:"type,omitempty"` 5121 // Etag - Etag of the azure resource 5122 Etag *string `json:"etag,omitempty"` 5123} 5124 5125// MarshalJSON is the custom marshaler for TIDataConnector. 5126func (tdc TIDataConnector) MarshalJSON() ([]byte, error) { 5127 tdc.Kind = KindBasicDataConnectorKindThreatIntelligence 5128 objectMap := make(map[string]interface{}) 5129 if tdc.TIDataConnectorProperties != nil { 5130 objectMap["properties"] = tdc.TIDataConnectorProperties 5131 } 5132 if tdc.Kind != "" { 5133 objectMap["kind"] = tdc.Kind 5134 } 5135 if tdc.Etag != nil { 5136 objectMap["etag"] = tdc.Etag 5137 } 5138 return json.Marshal(objectMap) 5139} 5140 5141// AsAADDataConnector is the BasicDataConnector implementation for TIDataConnector. 5142func (tdc TIDataConnector) AsAADDataConnector() (*AADDataConnector, bool) { 5143 return nil, false 5144} 5145 5146// AsAATPDataConnector is the BasicDataConnector implementation for TIDataConnector. 5147func (tdc TIDataConnector) AsAATPDataConnector() (*AATPDataConnector, bool) { 5148 return nil, false 5149} 5150 5151// AsASCDataConnector is the BasicDataConnector implementation for TIDataConnector. 5152func (tdc TIDataConnector) AsASCDataConnector() (*ASCDataConnector, bool) { 5153 return nil, false 5154} 5155 5156// AsAwsCloudTrailDataConnector is the BasicDataConnector implementation for TIDataConnector. 5157func (tdc TIDataConnector) AsAwsCloudTrailDataConnector() (*AwsCloudTrailDataConnector, bool) { 5158 return nil, false 5159} 5160 5161// AsMCASDataConnector is the BasicDataConnector implementation for TIDataConnector. 5162func (tdc TIDataConnector) AsMCASDataConnector() (*MCASDataConnector, bool) { 5163 return nil, false 5164} 5165 5166// AsMDATPDataConnector is the BasicDataConnector implementation for TIDataConnector. 5167func (tdc TIDataConnector) AsMDATPDataConnector() (*MDATPDataConnector, bool) { 5168 return nil, false 5169} 5170 5171// AsOfficeDataConnector is the BasicDataConnector implementation for TIDataConnector. 5172func (tdc TIDataConnector) AsOfficeDataConnector() (*OfficeDataConnector, bool) { 5173 return nil, false 5174} 5175 5176// AsTIDataConnector is the BasicDataConnector implementation for TIDataConnector. 5177func (tdc TIDataConnector) AsTIDataConnector() (*TIDataConnector, bool) { 5178 return &tdc, true 5179} 5180 5181// AsDataConnector is the BasicDataConnector implementation for TIDataConnector. 5182func (tdc TIDataConnector) AsDataConnector() (*DataConnector, bool) { 5183 return nil, false 5184} 5185 5186// AsBasicDataConnector is the BasicDataConnector implementation for TIDataConnector. 5187func (tdc TIDataConnector) AsBasicDataConnector() (BasicDataConnector, bool) { 5188 return &tdc, true 5189} 5190 5191// UnmarshalJSON is the custom unmarshaler for TIDataConnector struct. 5192func (tdc *TIDataConnector) UnmarshalJSON(body []byte) error { 5193 var m map[string]*json.RawMessage 5194 err := json.Unmarshal(body, &m) 5195 if err != nil { 5196 return err 5197 } 5198 for k, v := range m { 5199 switch k { 5200 case "properties": 5201 if v != nil { 5202 var tIDataConnectorProperties TIDataConnectorProperties 5203 err = json.Unmarshal(*v, &tIDataConnectorProperties) 5204 if err != nil { 5205 return err 5206 } 5207 tdc.TIDataConnectorProperties = &tIDataConnectorProperties 5208 } 5209 case "kind": 5210 if v != nil { 5211 var kind KindBasicDataConnector 5212 err = json.Unmarshal(*v, &kind) 5213 if err != nil { 5214 return err 5215 } 5216 tdc.Kind = kind 5217 } 5218 case "id": 5219 if v != nil { 5220 var ID string 5221 err = json.Unmarshal(*v, &ID) 5222 if err != nil { 5223 return err 5224 } 5225 tdc.ID = &ID 5226 } 5227 case "name": 5228 if v != nil { 5229 var name string 5230 err = json.Unmarshal(*v, &name) 5231 if err != nil { 5232 return err 5233 } 5234 tdc.Name = &name 5235 } 5236 case "type": 5237 if v != nil { 5238 var typeVar string 5239 err = json.Unmarshal(*v, &typeVar) 5240 if err != nil { 5241 return err 5242 } 5243 tdc.Type = &typeVar 5244 } 5245 case "etag": 5246 if v != nil { 5247 var etag string 5248 err = json.Unmarshal(*v, &etag) 5249 if err != nil { 5250 return err 5251 } 5252 tdc.Etag = &etag 5253 } 5254 } 5255 } 5256 5257 return nil 5258} 5259 5260// TIDataConnectorDataTypes the available data types for TI (Threat Intelligence) data connector. 5261type TIDataConnectorDataTypes struct { 5262 // Indicators - Data type for indicators connection. 5263 Indicators *TIDataConnectorDataTypesIndicators `json:"indicators,omitempty"` 5264} 5265 5266// TIDataConnectorDataTypesIndicators data type for indicators connection. 5267type TIDataConnectorDataTypesIndicators struct { 5268 // State - Describe whether this data type connection is enabled or not. Possible values include: 'DataTypeStateEnabled', 'DataTypeStateDisabled' 5269 State DataTypeState `json:"state,omitempty"` 5270} 5271 5272// TIDataConnectorProperties TI (Threat Intelligence) data connector properties. 5273type TIDataConnectorProperties struct { 5274 // TenantID - The tenant id to connect to, and get the data from. 5275 TenantID *string `json:"tenantId,omitempty"` 5276 // TipLookbackPeriod - The lookback period for the feed to be imported. 5277 TipLookbackPeriod *date.Time `json:"tipLookbackPeriod,omitempty"` 5278 // DataTypes - The available data types for the connector. 5279 DataTypes *TIDataConnectorDataTypes `json:"dataTypes,omitempty"` 5280} 5281 5282// ToggleSettings settings with single toggle. 5283type ToggleSettings struct { 5284 // ToggleSettingsProperties - toggle properties 5285 *ToggleSettingsProperties `json:"properties,omitempty"` 5286 // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindToggleSettings', 'KindBasicSettingsKindUebaSettings' 5287 Kind KindBasicSettings `json:"kind,omitempty"` 5288 // ID - READ-ONLY; Azure resource Id 5289 ID *string `json:"id,omitempty"` 5290 // Name - READ-ONLY; Azure resource name 5291 Name *string `json:"name,omitempty"` 5292 // Type - READ-ONLY; Azure resource type 5293 Type *string `json:"type,omitempty"` 5294 // Etag - Etag of the azure resource 5295 Etag *string `json:"etag,omitempty"` 5296} 5297 5298// MarshalJSON is the custom marshaler for ToggleSettings. 5299func (ts ToggleSettings) MarshalJSON() ([]byte, error) { 5300 ts.Kind = KindBasicSettingsKindToggleSettings 5301 objectMap := make(map[string]interface{}) 5302 if ts.ToggleSettingsProperties != nil { 5303 objectMap["properties"] = ts.ToggleSettingsProperties 5304 } 5305 if ts.Kind != "" { 5306 objectMap["kind"] = ts.Kind 5307 } 5308 if ts.Etag != nil { 5309 objectMap["etag"] = ts.Etag 5310 } 5311 return json.Marshal(objectMap) 5312} 5313 5314// AsToggleSettings is the BasicSettings implementation for ToggleSettings. 5315func (ts ToggleSettings) AsToggleSettings() (*ToggleSettings, bool) { 5316 return &ts, true 5317} 5318 5319// AsUebaSettings is the BasicSettings implementation for ToggleSettings. 5320func (ts ToggleSettings) AsUebaSettings() (*UebaSettings, bool) { 5321 return nil, false 5322} 5323 5324// AsSettings is the BasicSettings implementation for ToggleSettings. 5325func (ts ToggleSettings) AsSettings() (*Settings, bool) { 5326 return nil, false 5327} 5328 5329// AsBasicSettings is the BasicSettings implementation for ToggleSettings. 5330func (ts ToggleSettings) AsBasicSettings() (BasicSettings, bool) { 5331 return &ts, true 5332} 5333 5334// UnmarshalJSON is the custom unmarshaler for ToggleSettings struct. 5335func (ts *ToggleSettings) UnmarshalJSON(body []byte) error { 5336 var m map[string]*json.RawMessage 5337 err := json.Unmarshal(body, &m) 5338 if err != nil { 5339 return err 5340 } 5341 for k, v := range m { 5342 switch k { 5343 case "properties": 5344 if v != nil { 5345 var toggleSettingsProperties ToggleSettingsProperties 5346 err = json.Unmarshal(*v, &toggleSettingsProperties) 5347 if err != nil { 5348 return err 5349 } 5350 ts.ToggleSettingsProperties = &toggleSettingsProperties 5351 } 5352 case "kind": 5353 if v != nil { 5354 var kind KindBasicSettings 5355 err = json.Unmarshal(*v, &kind) 5356 if err != nil { 5357 return err 5358 } 5359 ts.Kind = kind 5360 } 5361 case "id": 5362 if v != nil { 5363 var ID string 5364 err = json.Unmarshal(*v, &ID) 5365 if err != nil { 5366 return err 5367 } 5368 ts.ID = &ID 5369 } 5370 case "name": 5371 if v != nil { 5372 var name string 5373 err = json.Unmarshal(*v, &name) 5374 if err != nil { 5375 return err 5376 } 5377 ts.Name = &name 5378 } 5379 case "type": 5380 if v != nil { 5381 var typeVar string 5382 err = json.Unmarshal(*v, &typeVar) 5383 if err != nil { 5384 return err 5385 } 5386 ts.Type = &typeVar 5387 } 5388 case "etag": 5389 if v != nil { 5390 var etag string 5391 err = json.Unmarshal(*v, &etag) 5392 if err != nil { 5393 return err 5394 } 5395 ts.Etag = &etag 5396 } 5397 } 5398 } 5399 5400 return nil 5401} 5402 5403// ToggleSettingsProperties toggle property bag. 5404type ToggleSettingsProperties struct { 5405 // IsEnabled - Determines whether the setting is enable or disabled. 5406 IsEnabled *bool `json:"isEnabled,omitempty"` 5407} 5408 5409// UebaSettings represents settings for User and Entity Behavior Analytics enablement. 5410type UebaSettings struct { 5411 // UebaSettingsProperties - User and Entity Behavior Analytics settings properties 5412 *UebaSettingsProperties `json:"properties,omitempty"` 5413 // Kind - Possible values include: 'KindBasicSettingsKindSettings', 'KindBasicSettingsKindToggleSettings', 'KindBasicSettingsKindUebaSettings' 5414 Kind KindBasicSettings `json:"kind,omitempty"` 5415 // ID - READ-ONLY; Azure resource Id 5416 ID *string `json:"id,omitempty"` 5417 // Name - READ-ONLY; Azure resource name 5418 Name *string `json:"name,omitempty"` 5419 // Type - READ-ONLY; Azure resource type 5420 Type *string `json:"type,omitempty"` 5421 // Etag - Etag of the azure resource 5422 Etag *string `json:"etag,omitempty"` 5423} 5424 5425// MarshalJSON is the custom marshaler for UebaSettings. 5426func (us UebaSettings) MarshalJSON() ([]byte, error) { 5427 us.Kind = KindBasicSettingsKindUebaSettings 5428 objectMap := make(map[string]interface{}) 5429 if us.UebaSettingsProperties != nil { 5430 objectMap["properties"] = us.UebaSettingsProperties 5431 } 5432 if us.Kind != "" { 5433 objectMap["kind"] = us.Kind 5434 } 5435 if us.Etag != nil { 5436 objectMap["etag"] = us.Etag 5437 } 5438 return json.Marshal(objectMap) 5439} 5440 5441// AsToggleSettings is the BasicSettings implementation for UebaSettings. 5442func (us UebaSettings) AsToggleSettings() (*ToggleSettings, bool) { 5443 return nil, false 5444} 5445 5446// AsUebaSettings is the BasicSettings implementation for UebaSettings. 5447func (us UebaSettings) AsUebaSettings() (*UebaSettings, bool) { 5448 return &us, true 5449} 5450 5451// AsSettings is the BasicSettings implementation for UebaSettings. 5452func (us UebaSettings) AsSettings() (*Settings, bool) { 5453 return nil, false 5454} 5455 5456// AsBasicSettings is the BasicSettings implementation for UebaSettings. 5457func (us UebaSettings) AsBasicSettings() (BasicSettings, bool) { 5458 return &us, true 5459} 5460 5461// UnmarshalJSON is the custom unmarshaler for UebaSettings struct. 5462func (us *UebaSettings) UnmarshalJSON(body []byte) error { 5463 var m map[string]*json.RawMessage 5464 err := json.Unmarshal(body, &m) 5465 if err != nil { 5466 return err 5467 } 5468 for k, v := range m { 5469 switch k { 5470 case "properties": 5471 if v != nil { 5472 var uebaSettingsProperties UebaSettingsProperties 5473 err = json.Unmarshal(*v, &uebaSettingsProperties) 5474 if err != nil { 5475 return err 5476 } 5477 us.UebaSettingsProperties = &uebaSettingsProperties 5478 } 5479 case "kind": 5480 if v != nil { 5481 var kind KindBasicSettings 5482 err = json.Unmarshal(*v, &kind) 5483 if err != nil { 5484 return err 5485 } 5486 us.Kind = kind 5487 } 5488 case "id": 5489 if v != nil { 5490 var ID string 5491 err = json.Unmarshal(*v, &ID) 5492 if err != nil { 5493 return err 5494 } 5495 us.ID = &ID 5496 } 5497 case "name": 5498 if v != nil { 5499 var name string 5500 err = json.Unmarshal(*v, &name) 5501 if err != nil { 5502 return err 5503 } 5504 us.Name = &name 5505 } 5506 case "type": 5507 if v != nil { 5508 var typeVar string 5509 err = json.Unmarshal(*v, &typeVar) 5510 if err != nil { 5511 return err 5512 } 5513 us.Type = &typeVar 5514 } 5515 case "etag": 5516 if v != nil { 5517 var etag string 5518 err = json.Unmarshal(*v, &etag) 5519 if err != nil { 5520 return err 5521 } 5522 us.Etag = &etag 5523 } 5524 } 5525 } 5526 5527 return nil 5528} 5529 5530// UebaSettingsProperties user and Entity Behavior Analytics settings property bag. 5531type UebaSettingsProperties struct { 5532 // AtpLicenseStatus - READ-ONLY; Determines whether the tenant has ATP (Advanced Threat Protection) license. Possible values include: 'LicenseStatusEnabled', 'LicenseStatusDisabled' 5533 AtpLicenseStatus LicenseStatus `json:"atpLicenseStatus,omitempty"` 5534 // IsEnabled - Determines whether User and Entity Behavior Analytics is enabled for this workspace. 5535 IsEnabled *bool `json:"isEnabled,omitempty"` 5536 // StatusInMcas - READ-ONLY; Determines whether User and Entity Behavior Analytics is enabled from MCAS (Microsoft Cloud App Security). Possible values include: 'StatusInMcasEnabled', 'StatusInMcasDisabled' 5537 StatusInMcas StatusInMcas `json:"statusInMcas,omitempty"` 5538} 5539 5540// MarshalJSON is the custom marshaler for UebaSettingsProperties. 5541func (usp UebaSettingsProperties) MarshalJSON() ([]byte, error) { 5542 objectMap := make(map[string]interface{}) 5543 if usp.IsEnabled != nil { 5544 objectMap["isEnabled"] = usp.IsEnabled 5545 } 5546 return json.Marshal(objectMap) 5547} 5548 5549// UserInfo user information that made some action 5550type UserInfo struct { 5551 // Email - READ-ONLY; The email of the user. 5552 Email *string `json:"email,omitempty"` 5553 // Name - READ-ONLY; The name of the user. 5554 Name *string `json:"name,omitempty"` 5555 // ObjectID - The object id of the user. 5556 ObjectID *uuid.UUID `json:"objectId,omitempty"` 5557} 5558 5559// MarshalJSON is the custom marshaler for UserInfo. 5560func (UI UserInfo) MarshalJSON() ([]byte, error) { 5561 objectMap := make(map[string]interface{}) 5562 if UI.ObjectID != nil { 5563 objectMap["objectId"] = UI.ObjectID 5564 } 5565 return json.Marshal(objectMap) 5566} 5567