diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md b/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md index 52c043d1131d..d2a559bf71ab 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md @@ -1,5 +1,111 @@ # Release History +## 2.0.0-beta.2 (2022-09-19) + +### Features Added + +- New const `FileImportStateFatalError` +- New const `AutomationRuleBooleanConditionSupportedOperatorOr` +- New const `DeviceImportanceHigh` +- New const `FileImportStateWaitingForUpload` +- New const `ConditionTypeBoolean` +- New const `FileImportStateIngestedWithErrors` +- New const `AutomationRuleBooleanConditionSupportedOperatorAnd` +- New const `ConditionTypePropertyArray` +- New const `TriggersOnAlerts` +- New const `DeviceImportanceNormal` +- New const `FileImportStateUnspecified` +- New const `FileImportContentTypeUnspecified` +- New const `IngestionModeIngestAnyValidRecords` +- New const `AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails` +- New const `AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues` +- New const `FileFormatUnspecified` +- New const `DeleteStatusNotDeleted` +- New const `AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs` +- New const `FileFormatCSV` +- New const `AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey` +- New const `FileImportStateInvalid` +- New const `DeleteStatusUnspecified` +- New const `FileImportContentTypeStixIndicator` +- New const `DeviceImportanceUnknown` +- New const `DeviceImportanceLow` +- New const `FileImportStateInProgress` +- New const `AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource` +- New const `DeleteStatusDeleted` +- New const `FileImportStateIngested` +- New const `FileFormatJSON` +- New const `IngestionModeIngestOnlyIfAllAreValid` +- New const `EntityTypeNic` +- New const `EntityKindNic` +- New const `AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem` +- New const `AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue` +- New const `FileImportContentTypeBasicIndicator` +- New const `IngestionModeUnspecified` +- New type alias `IngestionMode` +- New type alias `DeviceImportance` +- New type alias `FileFormat` +- New type alias `FileImportState` +- New type alias `DeleteStatus` +- New type alias `FileImportContentType` +- New type alias `AutomationRuleBooleanConditionSupportedOperator` +- New type alias `AutomationRulePropertyArrayConditionSupportedArrayType` +- New type alias `AutomationRulePropertyArrayConditionSupportedArrayConditionType` +- New function `PossibleDeviceImportanceValues() []DeviceImportance` +- New function `PossibleFileImportStateValues() []FileImportState` +- New function `*PropertyArrayConditionProperties.GetAutomationRuleCondition() *AutomationRuleCondition` +- New function `*BooleanConditionProperties.GetAutomationRuleCondition() *AutomationRuleCondition` +- New function `*NicEntity.GetEntity() *Entity` +- New function `PossibleFileFormatValues() []FileFormat` +- New function `NewFileImportsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FileImportsClient, error)` +- New function `PossibleAutomationRuleBooleanConditionSupportedOperatorValues() []AutomationRuleBooleanConditionSupportedOperator` +- New function `*FileImportsClient.NewListPager(string, string, *FileImportsClientListOptions) *runtime.Pager[FileImportsClientListResponse]` +- New function `*FileImportsClient.Create(context.Context, string, string, string, FileImport, *FileImportsClientCreateOptions) (FileImportsClientCreateResponse, error)` +- New function `PossibleDeleteStatusValues() []DeleteStatus` +- New function `*FileImportsClient.BeginDelete(context.Context, string, string, string, *FileImportsClientBeginDeleteOptions) (*runtime.Poller[FileImportsClientDeleteResponse], error)` +- New function `PossibleIngestionModeValues() []IngestionMode` +- New function `PossibleAutomationRulePropertyArrayConditionSupportedArrayTypeValues() []AutomationRulePropertyArrayConditionSupportedArrayType` +- New function `PossibleFileImportContentTypeValues() []FileImportContentType` +- New function `*FileImportsClient.Get(context.Context, string, string, string, *FileImportsClientGetOptions) (FileImportsClientGetResponse, error)` +- New function `PossibleAutomationRulePropertyArrayConditionSupportedArrayConditionTypeValues() []AutomationRulePropertyArrayConditionSupportedArrayConditionType` +- New struct `AutomationRuleBooleanCondition` +- New struct `AutomationRulePropertyArrayValuesCondition` +- New struct `BooleanConditionProperties` +- New struct `FileImport` +- New struct `FileImportList` +- New struct `FileImportProperties` +- New struct `FileImportsClient` +- New struct `FileImportsClientBeginDeleteOptions` +- New struct `FileImportsClientCreateOptions` +- New struct `FileImportsClientCreateResponse` +- New struct `FileImportsClientDeleteResponse` +- New struct `FileImportsClientGetOptions` +- New struct `FileImportsClientGetResponse` +- New struct `FileImportsClientListOptions` +- New struct `FileImportsClientListResponse` +- New struct `FileMetadata` +- New struct `NicEntity` +- New struct `NicEntityProperties` +- New struct `PropertyArrayConditionProperties` +- New struct `ValidationError` +- New field `DeviceSubType` in struct `IoTDeviceEntityProperties` +- New field `Sensor` in struct `IoTDeviceEntityProperties` +- New field `Zone` in struct `IoTDeviceEntityProperties` +- New field `Importance` in struct `IoTDeviceEntityProperties` +- New field `IsAuthorized` in struct `IoTDeviceEntityProperties` +- New field `PurdueLayer` in struct `IoTDeviceEntityProperties` +- New field `IsScanner` in struct `IoTDeviceEntityProperties` +- New field `NicEntityIDs` in struct `IoTDeviceEntityProperties` +- New field `IsProgramming` in struct `IoTDeviceEntityProperties` +- New field `Owners` in struct `IoTDeviceEntityProperties` +- New field `Site` in struct `IoTDeviceEntityProperties` +- New field `OutputStream` in struct `DataConnectorConnectBody` +- New field `DataCollectionEndpoint` in struct `DataConnectorConnectBody` +- New field `DataCollectionRuleImmutableID` in struct `DataConnectorConnectBody` +- New field `EventGroupingSettings` in struct `QueryBasedAlertRuleTemplateProperties` +- New field `EventGroupingSettings` in struct `NrtAlertRuleTemplateProperties` +- New field `EventGroupingSettings` in struct `NrtAlertRuleProperties` + + ## 2.0.0-beta.1 (2022-05-24) ### Breaking Changes @@ -889,4 +995,4 @@ The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityin To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). -To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_actions_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_actions_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go index 79e92a1ab3b7..ecca2087a7c5 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_actions_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewActionsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -106,7 +107,7 @@ func (client *ActionsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, action) @@ -123,7 +124,7 @@ func (client *ActionsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -172,7 +173,7 @@ func (client *ActionsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +181,7 @@ func (client *ActionsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -229,7 +230,7 @@ func (client *ActionsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,8 +246,7 @@ func (client *ActionsClient) getHandleResponse(resp *http.Response) (ActionsClie } // NewListByAlertRulePager - Gets all actions of alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -303,7 +303,7 @@ func (client *ActionsClient) listByAlertRuleCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_actions_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go similarity index 70% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_actions_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go index 20a8109b9748..ec4ed6498a58 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_actions_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/actions/GetAllActionsByAlertRule.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/actions/GetAllActionsByAlertRule.json func ExampleActionsClient_NewListByAlertRulePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleActionsClient_NewListByAlertRulePager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByAlertRulePager("myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + pager := client.NewListByAlertRulePager("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,7 +41,7 @@ func ExampleActionsClient_NewListByAlertRulePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/actions/GetActionOfAlertRuleById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/actions/GetActionOfAlertRuleById.json func ExampleActionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,12 +52,7 @@ func ExampleActionsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "912bec42-cb66-4c03-ac63-1761b6898c3e", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +60,7 @@ func ExampleActionsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/actions/CreateActionOfAlertRule.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/actions/CreateActionOfAlertRule.json func ExampleActionsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,19 +71,13 @@ func ExampleActionsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "912bec42-cb66-4c03-ac63-1761b6898c3e", - armsecurityinsights.ActionRequest{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.ActionRequestProperties{ - LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), - TriggerURI: to.Ptr("https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature"), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", armsecurityinsights.ActionRequest{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.ActionRequestProperties{ + LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), + TriggerURI: to.Ptr("https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -99,7 +85,7 @@ func ExampleActionsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/actions/DeleteActionOfAlertRule.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/actions/DeleteActionOfAlertRule.json func ExampleActionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -110,12 +96,7 @@ func ExampleActionsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "912bec42-cb66-4c03-ac63-1761b6898c3e", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertrules_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertrules_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go index e4ce180ac651..778bfc593ffd 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertrules_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates or updates the alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -102,7 +103,7 @@ func (client *AlertRulesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, alertRule) @@ -119,7 +120,7 @@ func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Delete the alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -163,7 +164,7 @@ func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +172,7 @@ func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the alert rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // ruleID - Alert rule ID @@ -215,7 +216,7 @@ func (client *AlertRulesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,8 +232,7 @@ func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRul } // NewListPager - Gets all alert rules. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - AlertRulesClientListOptions contains the optional parameters for the AlertRulesClient.List method. @@ -284,7 +284,7 @@ func (client *AlertRulesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go new file mode 100644 index 000000000000..ae720d99a8a1 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go @@ -0,0 +1,805 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/GetAllAlertRules.json +func ExampleAlertRulesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/GetFusionAlertRule.json +func ExampleAlertRulesClient_Get_getAFusionAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "myFirstFusionRule", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json +func ExampleAlertRulesClient_Get_getAMicrosoftSecurityIncidentCreationRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/GetScheduledAlertRule.json +func ExampleAlertRulesClient_Get_getAScheduledAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/GetNrtAlertRule.json +func ExampleAlertRulesClient_Get_getAnNrtAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json +func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAFusionAlertRuleWithScenarioExclusionPattern() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "myFirstFusionRule", &armsecurityinsights.FusionAlertRule{ + Etag: to.Ptr("3d00c3ca-0000-0100-0000-5d42d5010000"), + Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), + Properties: &armsecurityinsights.FusionAlertRuleProperties{ + AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), + Enabled: to.Ptr(true), + SourceSettings: []*armsecurityinsights.FusionSourceSettings{ + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Anomalies"), + }, + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Alert providers"), + SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Active Directory Identity Protection"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Defender"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Defender for IoT"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft 365 Defender"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Cloud App Security"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Endpoint"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Identity"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Office 365"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Sentinel scheduled analytics rules"), + }}, + }, + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Raw logs from other sources"), + SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{}, + SourceSubTypeName: to.Ptr("Palo Alto Networks"), + }}, + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/CreateFusionAlertRule.json +func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAFusionAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "myFirstFusionRule", &armsecurityinsights.FusionAlertRule{ + Etag: to.Ptr("3d00c3ca-0000-0100-0000-5d42d5010000"), + Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), + Properties: &armsecurityinsights.FusionAlertRuleProperties{ + AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), + Enabled: to.Ptr(true), + SourceSettings: []*armsecurityinsights.FusionSourceSettings{ + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Anomalies"), + }, + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Alert providers"), + SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Active Directory Identity Protection"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Defender"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Defender for IoT"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft 365 Defender"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Cloud App Security"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Endpoint"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Identity"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Microsoft Defender for Office 365"), + }, + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ + Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), + }, + { + Enabled: to.Ptr(true), + Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), + }}, + }, + SourceSubTypeName: to.Ptr("Azure Sentinel scheduled analytics rules"), + }}, + }, + { + Enabled: to.Ptr(true), + SourceName: to.Ptr("Raw logs from other sources"), + SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ + { + Enabled: to.Ptr(true), + SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{}, + SourceSubTypeName: to.Ptr("Palo Alto Networks"), + }}, + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json +func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAMicrosoftSecurityIncidentCreationRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRule{ + Etag: to.Ptr("\"260097e0-0000-0d00-0000-5d6fa88f0000\""), + Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), + Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleProperties{ + ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), + DisplayName: to.Ptr("testing displayname"), + Enabled: to.Ptr(true), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/CreateNrtAlertRule.json +func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesANrtAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.NrtAlertRule{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.AlertRuleKindNRT), + Properties: &armsecurityinsights.NrtAlertRuleProperties{ + Description: to.Ptr(""), + DisplayName: to.Ptr("Rule2"), + Enabled: to.Ptr(true), + EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ + AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), + }, + IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ + CreateIncident: to.Ptr(true), + GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ + Enabled: to.Ptr(true), + GroupByEntities: []*armsecurityinsights.EntityMappingType{ + to.Ptr(armsecurityinsights.EntityMappingTypeHost), + to.Ptr(armsecurityinsights.EntityMappingTypeAccount)}, + LookbackDuration: to.Ptr("PT5H"), + MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), + ReopenClosedIncident: to.Ptr(false), + }, + }, + Query: to.Ptr("ProtectionStatus | extend HostCustomEntity = Computer | extend IPCustomEntity = ComputerIP_Hidden"), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + SuppressionDuration: to.Ptr("PT1H"), + SuppressionEnabled: to.Ptr(false), + Tactics: []*armsecurityinsights.AttackTactic{ + to.Ptr(armsecurityinsights.AttackTacticPersistence), + to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, + Techniques: []*string{ + to.Ptr("T1037"), + to.Ptr("T1021")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/CreateScheduledAlertRule.json +func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAScheduledAlertRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.ScheduledAlertRule{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), + Properties: &armsecurityinsights.ScheduledAlertRuleProperties{ + AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ + AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{ComputerIP}}"), + AlertDisplayNameFormat: to.Ptr("Alert from {{Computer}}"), + }, + CustomDetails: map[string]*string{ + "OperatingSystemName": to.Ptr("OSName"), + "OperatingSystemType": to.Ptr("OSType"), + }, + EntityMappings: []*armsecurityinsights.EntityMapping{ + { + EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeHost), + FieldMappings: []*armsecurityinsights.FieldMapping{ + { + ColumnName: to.Ptr("Computer"), + Identifier: to.Ptr("FullName"), + }}, + }, + { + EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), + FieldMappings: []*armsecurityinsights.FieldMapping{ + { + ColumnName: to.Ptr("ComputerIP"), + Identifier: to.Ptr("Address"), + }}, + }}, + EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ + AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), + }, + Query: to.Ptr("Heartbeat"), + QueryFrequency: to.Ptr("PT1H"), + QueryPeriod: to.Ptr("P2DT1H30M"), + Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), + TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), + TriggerThreshold: to.Ptr[int32](0), + Description: to.Ptr("An example for a scheduled rule"), + DisplayName: to.Ptr("My scheduled rule"), + Enabled: to.Ptr(true), + IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ + CreateIncident: to.Ptr(true), + GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ + Enabled: to.Ptr(true), + GroupByAlertDetails: []*armsecurityinsights.AlertDetail{ + to.Ptr(armsecurityinsights.AlertDetailDisplayName)}, + GroupByCustomDetails: []*string{ + to.Ptr("OperatingSystemType"), + to.Ptr("OperatingSystemName")}, + GroupByEntities: []*armsecurityinsights.EntityMappingType{ + to.Ptr(armsecurityinsights.EntityMappingTypeHost)}, + LookbackDuration: to.Ptr("PT5H"), + MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), + ReopenClosedIncident: to.Ptr(false), + }, + }, + SuppressionDuration: to.Ptr("PT1H"), + SuppressionEnabled: to.Ptr(false), + Tactics: []*armsecurityinsights.AttackTactic{ + to.Ptr(armsecurityinsights.AttackTacticPersistence), + to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, + Techniques: []*string{ + to.Ptr("T1037"), + to.Ptr("T1021")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRules/DeleteAlertRule.json +func ExampleAlertRulesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertruletemplates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertruletemplates_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go index 33f8e072d8b2..08945b0d109c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_alertruletemplates_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewAlertRuleTemplatesClient(subscriptionID string, credential azcore.TokenC // Get - Gets the alert rule template. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // alertRuleTemplateID - Alert rule template ID @@ -100,7 +101,7 @@ func (client *AlertRuleTemplatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,8 +117,7 @@ func (client *AlertRuleTemplatesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets all alert rule templates. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - AlertRuleTemplatesClientListOptions contains the optional parameters for the AlertRuleTemplatesClient.List method. @@ -169,7 +169,7 @@ func (client *AlertRuleTemplatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertruletemplates_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go similarity index 87% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertruletemplates_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go index 03ffb29caeed..6b8394c1d163 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertruletemplates_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplates.json func ExampleAlertRuleTemplatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,9 +27,7 @@ func ExampleAlertRuleTemplatesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,7 +40,7 @@ func ExampleAlertRuleTemplatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplateById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/alertRuleTemplates/GetAlertRuleTemplateById.json func ExampleAlertRuleTemplatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,11 +51,7 @@ func ExampleAlertRuleTemplatesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "65360bb0-8986-4ade-a89d-af3cf44d28aa", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_automationrules_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_automationrules_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go index 66db42517319..d3417603014a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_automationrules_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewAutomationRulesClient(subscriptionID string, credential azcore.TokenCred // CreateOrUpdate - Creates or updates the automation rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // automationRuleID - Automation rule ID @@ -101,7 +102,7 @@ func (client *AutomationRulesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.AutomationRuleToUpsert != nil { @@ -121,7 +122,7 @@ func (client *AutomationRulesClient) createOrUpdateHandleResponse(resp *http.Res // Delete - Delete the automation rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // automationRuleID - Automation rule ID @@ -165,7 +166,7 @@ func (client *AutomationRulesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +183,7 @@ func (client *AutomationRulesClient) deleteHandleResponse(resp *http.Response) ( // Get - Gets the automation rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // automationRuleID - Automation rule ID @@ -226,7 +227,7 @@ func (client *AutomationRulesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,8 +243,7 @@ func (client *AutomationRulesClient) getHandleResponse(resp *http.Response) (Aut } // NewListPager - Gets all automation rules. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - AutomationRulesClientListOptions contains the optional parameters for the AutomationRulesClient.List method. @@ -295,7 +295,7 @@ func (client *AutomationRulesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_automationrules_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go similarity index 82% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_automationrules_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go index 6aa9f5db644d..97189f621e24 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_automationrules_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/automationRules/AutomationRules_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/automationRules/AutomationRules_Get.json func ExampleAutomationRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,11 +27,7 @@ func ExampleAutomationRulesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -39,7 +35,7 @@ func ExampleAutomationRulesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/automationRules/AutomationRules_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/automationRules/AutomationRules_CreateOrUpdate.json func ExampleAutomationRulesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,11 +46,7 @@ func ExampleAutomationRulesClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - &armsecurityinsights.AutomationRulesClientCreateOrUpdateOptions{AutomationRuleToUpsert: nil}) + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.AutomationRulesClientCreateOrUpdateOptions{AutomationRuleToUpsert: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -62,7 +54,7 @@ func ExampleAutomationRulesClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/automationRules/AutomationRules_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/automationRules/AutomationRules_Delete.json func ExampleAutomationRulesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,11 +65,7 @@ func ExampleAutomationRulesClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + res, err := client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -85,7 +73,7 @@ func ExampleAutomationRulesClient_Delete() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/automationRules/AutomationRules_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/automationRules/AutomationRules_List.json func ExampleAutomationRulesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,9 +84,7 @@ func ExampleAutomationRulesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md b/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md index 44cd857de62a..fe397db9d3df 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/792db17291c758b2bfdbbc0d35d0e2f5b5a1bd05/specification/securityinsights/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/792db17291c758b2bfdbbc0d35d0e2f5b5a1bd05/specification/securityinsights/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/securityinsights/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/securityinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0-beta.1 +module-version: 2.0.0-beta.2 modelerfour: lenient-model-deduplication: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmark_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmark_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client.go index f5657dc8c529..83629a61ad97 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmark_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewBookmarkClient(subscriptionID string, credential azcore.TokenCredential, // Expand - Expand an bookmark // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -101,7 +102,7 @@ func (client *BookmarkClient) expandCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmark_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client_example_test.go similarity index 70% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmark_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client_example_test.go index 4c18b78b5c46..b5ab4108ccec 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmark_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmark_client_example_test.go @@ -19,7 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/expand/PostExpandBookmark.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/expand/PostExpandBookmark.json func ExampleBookmarkClient_Expand() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,16 +30,11 @@ func ExampleBookmarkClient_Expand() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Expand(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - armsecurityinsights.BookmarkExpandParameters{ - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-24T17:21:00.000Z"); return t }()), - ExpansionID: to.Ptr("27f76e63-c41b-480f-bb18-12ad2e011d49"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-25T17:21:00.000Z"); return t }()), - }, - nil) + res, err := client.Expand(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.BookmarkExpandParameters{ + EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-24T17:21:00.000Z"); return t }()), + ExpansionID: to.Ptr("27f76e63-c41b-480f-bb18-12ad2e011d49"), + StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-25T17:21:00.000Z"); return t }()), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarkrelations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarkrelations_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client.go index a4ad0b73e113..11decdae2954 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarkrelations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -57,7 +58,7 @@ func NewBookmarkRelationsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates the bookmark relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -108,7 +109,7 @@ func (client *BookmarkRelationsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, relation) @@ -125,7 +126,7 @@ func (client *BookmarkRelationsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Delete the bookmark relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -175,7 +176,7 @@ func (client *BookmarkRelationsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,7 +184,7 @@ func (client *BookmarkRelationsClient) deleteCreateRequest(ctx context.Context, // Get - Gets a bookmark relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -232,7 +233,7 @@ func (client *BookmarkRelationsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,8 +249,7 @@ func (client *BookmarkRelationsClient) getHandleResponse(resp *http.Response) (B } // NewListPager - Gets all bookmark relations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -306,7 +306,7 @@ func (client *BookmarkRelationsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarkrelations_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client_example_test.go similarity index 72% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarkrelations_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client_example_test.go index 710b324e2bec..ab8cfa442616 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarkrelations_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarkrelations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/relations/GetAllBookmarkRelations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/relations/GetAllBookmarkRelations.json func ExampleBookmarkRelationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,11 @@ func ExampleBookmarkRelationsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - "2216d0e1-91e3-4902-89fd-d2df8c535096", - &armsecurityinsights.BookmarkRelationsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", &armsecurityinsights.BookmarkRelationsClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -48,7 +45,7 @@ func ExampleBookmarkRelationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/relations/GetBookmarkRelationByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/relations/GetBookmarkRelationByName.json func ExampleBookmarkRelationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,12 +56,7 @@ func ExampleBookmarkRelationsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "2216d0e1-91e3-4902-89fd-d2df8c535096", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -72,7 +64,7 @@ func ExampleBookmarkRelationsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/relations/CreateBookmarkRelation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/relations/CreateBookmarkRelation.json func ExampleBookmarkRelationsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,17 +75,11 @@ func ExampleBookmarkRelationsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "2216d0e1-91e3-4902-89fd-d2df8c535096", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - armsecurityinsights.Relation{ - Properties: &armsecurityinsights.RelationProperties{ - RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812"), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", armsecurityinsights.Relation{ + Properties: &armsecurityinsights.RelationProperties{ + RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +87,7 @@ func ExampleBookmarkRelationsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/relations/DeleteBookmarkRelation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/relations/DeleteBookmarkRelation.json func ExampleBookmarkRelationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,12 +98,7 @@ func ExampleBookmarkRelationsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "2216d0e1-91e3-4902-89fd-d2df8c535096", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "2216d0e1-91e3-4902-89fd-d2df8c535096", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarks_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarks_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go index 9b50e7a2704d..9c722ecb9591 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_bookmarks_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewBookmarksClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates the bookmark. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -102,7 +103,7 @@ func (client *BookmarksClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, bookmark) @@ -119,7 +120,7 @@ func (client *BookmarksClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete the bookmark. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -163,7 +164,7 @@ func (client *BookmarksClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +172,7 @@ func (client *BookmarksClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a bookmark. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // bookmarkID - Bookmark ID @@ -215,7 +216,7 @@ func (client *BookmarksClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,8 +232,7 @@ func (client *BookmarksClient) getHandleResponse(resp *http.Response) (Bookmarks } // NewListPager - Gets all bookmarks. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - BookmarksClientListOptions contains the optional parameters for the BookmarksClient.List method. @@ -284,7 +284,7 @@ func (client *BookmarksClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarks_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go similarity index 62% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarks_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go index d16a6d19e55d..cfe863eac746 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_bookmarks_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go @@ -19,7 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/GetBookmarks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/GetBookmarks.json func ExampleBookmarksClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,9 +30,7 @@ func ExampleBookmarksClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -45,7 +43,7 @@ func ExampleBookmarksClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/GetBookmarkById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/GetBookmarkById.json func ExampleBookmarksClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,11 +54,7 @@ func ExampleBookmarksClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +62,7 @@ func ExampleBookmarksClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/CreateBookmark.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/CreateBookmark.json func ExampleBookmarksClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,44 +73,39 @@ func ExampleBookmarksClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - armsecurityinsights.Bookmark{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.BookmarkProperties{ - Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T13:15:30Z"); return t }()), - CreatedBy: &armsecurityinsights.UserInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, - DisplayName: to.Ptr("My bookmark"), - EntityMappings: []*armsecurityinsights.BookmarkEntityMappings{ - { - EntityType: to.Ptr("Account"), - FieldMappings: []*armsecurityinsights.EntityFieldMapping{ - { - Identifier: to.Ptr("Fullname"), - Value: to.Ptr("johndoe@microsoft.com"), - }}, - }}, - Labels: []*string{ - to.Ptr("Tag1"), - to.Ptr("Tag2")}, - Notes: to.Ptr("Found a suspicious activity"), - Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), - QueryResult: to.Ptr("Security Event query result"), - Tactics: []*armsecurityinsights.AttackTactic{ - to.Ptr(armsecurityinsights.AttackTacticExecution)}, - Techniques: []*string{ - to.Ptr("T1609")}, - Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T13:15:30Z"); return t }()), - UpdatedBy: &armsecurityinsights.UserInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.Bookmark{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.BookmarkProperties{ + Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T13:15:30Z"); return t }()), + CreatedBy: &armsecurityinsights.UserInfo{ + ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), + }, + DisplayName: to.Ptr("My bookmark"), + EntityMappings: []*armsecurityinsights.BookmarkEntityMappings{ + { + EntityType: to.Ptr("Account"), + FieldMappings: []*armsecurityinsights.EntityFieldMapping{ + { + Identifier: to.Ptr("Fullname"), + Value: to.Ptr("johndoe@microsoft.com"), + }}, + }}, + Labels: []*string{ + to.Ptr("Tag1"), + to.Ptr("Tag2")}, + Notes: to.Ptr("Found a suspicious activity"), + Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), + QueryResult: to.Ptr("Security Event query result"), + Tactics: []*armsecurityinsights.AttackTactic{ + to.Ptr(armsecurityinsights.AttackTacticExecution)}, + Techniques: []*string{ + to.Ptr("T1609")}, + Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T13:15:30Z"); return t }()), + UpdatedBy: &armsecurityinsights.UserInfo{ + ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -124,7 +113,7 @@ func ExampleBookmarksClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/bookmarks/DeleteBookmark.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/bookmarks/DeleteBookmark.json func ExampleBookmarksClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -135,11 +124,7 @@ func ExampleBookmarksClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/build.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/build.go index 57629adb87a8..ee6fc113785e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/build.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/securityinsights/armsecurityinsights +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/securityinsights/armsecurityinsights package armsecurityinsights diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_constants.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go similarity index 90% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_constants.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go index 2097d51765eb..8076832d7f5a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_constants.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go @@ -5,12 +5,13 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights const ( moduleName = "armsecurityinsights" - moduleVersion = "v2.0.0-beta.1" + moduleVersion = "v2.0.0-beta.2" ) // ActionType - The type of the automation rule action. @@ -194,6 +195,24 @@ func PossibleAttackTacticValues() []AttackTactic { } } +type AutomationRuleBooleanConditionSupportedOperator string + +const ( + // AutomationRuleBooleanConditionSupportedOperatorAnd - Evaluates as true if all the item conditions are evaluated as true + AutomationRuleBooleanConditionSupportedOperatorAnd AutomationRuleBooleanConditionSupportedOperator = "And" + // AutomationRuleBooleanConditionSupportedOperatorOr - Evaluates as true if at least one of the item conditions are evaluated + // as true + AutomationRuleBooleanConditionSupportedOperatorOr AutomationRuleBooleanConditionSupportedOperator = "Or" +) + +// PossibleAutomationRuleBooleanConditionSupportedOperatorValues returns the possible values for the AutomationRuleBooleanConditionSupportedOperator const type. +func PossibleAutomationRuleBooleanConditionSupportedOperatorValues() []AutomationRuleBooleanConditionSupportedOperator { + return []AutomationRuleBooleanConditionSupportedOperator{ + AutomationRuleBooleanConditionSupportedOperatorAnd, + AutomationRuleBooleanConditionSupportedOperatorOr, + } +} + type AutomationRulePropertyArrayChangedConditionSupportedArrayType string const ( @@ -231,6 +250,39 @@ func PossibleAutomationRulePropertyArrayChangedConditionSupportedChangeTypeValue } } +type AutomationRulePropertyArrayConditionSupportedArrayConditionType string + +const ( + // AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem - Evaluate the condition as true if any item fulfills + // it + AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem AutomationRulePropertyArrayConditionSupportedArrayConditionType = "AnyItem" +) + +// PossibleAutomationRulePropertyArrayConditionSupportedArrayConditionTypeValues returns the possible values for the AutomationRulePropertyArrayConditionSupportedArrayConditionType const type. +func PossibleAutomationRulePropertyArrayConditionSupportedArrayConditionTypeValues() []AutomationRulePropertyArrayConditionSupportedArrayConditionType { + return []AutomationRulePropertyArrayConditionSupportedArrayConditionType{ + AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem, + } +} + +type AutomationRulePropertyArrayConditionSupportedArrayType string + +const ( + // AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues - Evaluate the condition on a custom detail's + // values + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues AutomationRulePropertyArrayConditionSupportedArrayType = "CustomDetailValues" + // AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails - Evaluate the condition on the custom detail keys + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails AutomationRulePropertyArrayConditionSupportedArrayType = "CustomDetails" +) + +// PossibleAutomationRulePropertyArrayConditionSupportedArrayTypeValues returns the possible values for the AutomationRulePropertyArrayConditionSupportedArrayType const type. +func PossibleAutomationRulePropertyArrayConditionSupportedArrayTypeValues() []AutomationRulePropertyArrayConditionSupportedArrayType { + return []AutomationRulePropertyArrayConditionSupportedArrayType{ + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues, + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails, + } +} + type AutomationRulePropertyChangedConditionSupportedChangedType string const ( @@ -332,6 +384,8 @@ const ( AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedProperty = "AccountSid" // AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix - The account user principal name suffix AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix AutomationRulePropertyConditionSupportedProperty = "AccountUPNSuffix" + // AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs - The analytic rule ids of the alert + AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs AutomationRulePropertyConditionSupportedProperty = "AlertAnalyticRuleIds" // AutomationRulePropertyConditionSupportedPropertyAlertProductNames - The name of the product of the alert AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedProperty = "AlertProductNames" // AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID - The Azure resource id @@ -362,6 +416,10 @@ const ( AutomationRulePropertyConditionSupportedPropertyHostOSVersion AutomationRulePropertyConditionSupportedProperty = "HostOSVersion" // AutomationRulePropertyConditionSupportedPropertyIPAddress - The IP address AutomationRulePropertyConditionSupportedPropertyIPAddress AutomationRulePropertyConditionSupportedProperty = "IPAddress" + // AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey - The incident custom detail key + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey AutomationRulePropertyConditionSupportedProperty = "IncidentCustomDetailsKey" + // AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue - The incident custom detail value + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue AutomationRulePropertyConditionSupportedProperty = "IncidentCustomDetailsValue" // AutomationRulePropertyConditionSupportedPropertyIncidentDescription - The description of the incident AutomationRulePropertyConditionSupportedPropertyIncidentDescription AutomationRulePropertyConditionSupportedProperty = "IncidentDescription" // AutomationRulePropertyConditionSupportedPropertyIncidentLabel - The labels of the incident @@ -378,6 +436,8 @@ const ( AutomationRulePropertyConditionSupportedPropertyIncidentTactics AutomationRulePropertyConditionSupportedProperty = "IncidentTactics" // AutomationRulePropertyConditionSupportedPropertyIncidentTitle - The title of the incident AutomationRulePropertyConditionSupportedPropertyIncidentTitle AutomationRulePropertyConditionSupportedProperty = "IncidentTitle" + // AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource - The update source of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource AutomationRulePropertyConditionSupportedProperty = "IncidentUpdatedBySource" // AutomationRulePropertyConditionSupportedPropertyIoTDeviceID - "The IoT device id AutomationRulePropertyConditionSupportedPropertyIoTDeviceID AutomationRulePropertyConditionSupportedProperty = "IoTDeviceId" // AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel - The IoT device model @@ -437,6 +497,7 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati AutomationRulePropertyConditionSupportedPropertyAccountPUID, AutomationRulePropertyConditionSupportedPropertyAccountSid, AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix, + AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs, AutomationRulePropertyConditionSupportedPropertyAlertProductNames, AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID, AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID, @@ -452,6 +513,8 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati AutomationRulePropertyConditionSupportedPropertyHostNetBiosName, AutomationRulePropertyConditionSupportedPropertyHostOSVersion, AutomationRulePropertyConditionSupportedPropertyIPAddress, + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey, + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue, AutomationRulePropertyConditionSupportedPropertyIncidentDescription, AutomationRulePropertyConditionSupportedPropertyIncidentLabel, AutomationRulePropertyConditionSupportedPropertyIncidentProviderName, @@ -460,6 +523,7 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati AutomationRulePropertyConditionSupportedPropertyIncidentStatus, AutomationRulePropertyConditionSupportedPropertyIncidentTactics, AutomationRulePropertyConditionSupportedPropertyIncidentTitle, + AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource, AutomationRulePropertyConditionSupportedPropertyIoTDeviceID, AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel, AutomationRulePropertyConditionSupportedPropertyIoTDeviceName, @@ -489,8 +553,12 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati type ConditionType string const ( + // ConditionTypeBoolean - Apply a boolean operator (e.g AND, OR) to conditions + ConditionTypeBoolean ConditionType = "Boolean" // ConditionTypeProperty - Evaluate an object property value ConditionTypeProperty ConditionType = "Property" + // ConditionTypePropertyArray - Evaluate an object array property value + ConditionTypePropertyArray ConditionType = "PropertyArray" // ConditionTypePropertyArrayChanged - Evaluate an object array property changed value ConditionTypePropertyArrayChanged ConditionType = "PropertyArrayChanged" // ConditionTypePropertyChanged - Evaluate an object property changed value @@ -500,7 +568,9 @@ const ( // PossibleConditionTypeValues returns the possible values for the ConditionType const type. func PossibleConditionTypeValues() []ConditionType { return []ConditionType{ + ConditionTypeBoolean, ConditionTypeProperty, + ConditionTypePropertyArray, ConditionTypePropertyArrayChanged, ConditionTypePropertyChanged, } @@ -737,6 +807,27 @@ func PossibleDataTypeStateValues() []DataTypeState { } } +// DeleteStatus - Indicates whether the file was deleted from the storage account. +type DeleteStatus string + +const ( + // DeleteStatusDeleted - The file was deleted. + DeleteStatusDeleted DeleteStatus = "Deleted" + // DeleteStatusNotDeleted - The file was not deleted. + DeleteStatusNotDeleted DeleteStatus = "NotDeleted" + // DeleteStatusUnspecified - Unspecified + DeleteStatusUnspecified DeleteStatus = "Unspecified" +) + +// PossibleDeleteStatusValues returns the possible values for the DeleteStatus const type. +func PossibleDeleteStatusValues() []DeleteStatus { + return []DeleteStatus{ + DeleteStatusDeleted, + DeleteStatusNotDeleted, + DeleteStatusUnspecified, + } +} + // DeliveryAction - The delivery action of this mail message like Delivered, Blocked, Replaced etc type DeliveryAction string @@ -859,6 +950,30 @@ func PossibleDeploymentStateValues() []DeploymentState { } } +// DeviceImportance - Device importance, determines if the device classified as 'crown jewel' +type DeviceImportance string + +const ( + // DeviceImportanceHigh - High + DeviceImportanceHigh DeviceImportance = "High" + // DeviceImportanceLow - Low + DeviceImportanceLow DeviceImportance = "Low" + // DeviceImportanceNormal - Normal + DeviceImportanceNormal DeviceImportance = "Normal" + // DeviceImportanceUnknown - Unknown - Default value + DeviceImportanceUnknown DeviceImportance = "Unknown" +) + +// PossibleDeviceImportanceValues returns the possible values for the DeviceImportance const type. +func PossibleDeviceImportanceValues() []DeviceImportance { + return []DeviceImportance{ + DeviceImportanceHigh, + DeviceImportanceLow, + DeviceImportanceNormal, + DeviceImportanceUnknown, + } +} + // ElevationToken - The elevation token associated with the process. type ElevationToken string @@ -926,6 +1041,8 @@ const ( EntityKindMailbox EntityKind = "Mailbox" // EntityKindMalware - Entity represents malware in the system. EntityKindMalware EntityKind = "Malware" + // EntityKindNic - Entity represents network interface in the system. + EntityKindNic EntityKind = "Nic" // EntityKindProcess - Entity represents process in the system. EntityKindProcess EntityKind = "Process" // EntityKindRegistryKey - Entity represents registry key in the system. @@ -959,6 +1076,7 @@ func PossibleEntityKindValues() []EntityKind { EntityKindMailMessage, EntityKindMailbox, EntityKindMalware, + EntityKindNic, EntityKindProcess, EntityKindRegistryKey, EntityKindRegistryValue, @@ -1139,6 +1257,8 @@ const ( EntityTypeMailbox EntityType = "Mailbox" // EntityTypeMalware - Entity represents malware in the system. EntityTypeMalware EntityType = "Malware" + // EntityTypeNic - Entity represents network interface in the system. + EntityTypeNic EntityType = "Nic" // EntityTypeProcess - Entity represents process in the system. EntityTypeProcess EntityType = "Process" // EntityTypeRegistryKey - Entity represents registry key in the system. @@ -1172,6 +1292,7 @@ func PossibleEntityTypeValues() []EntityType { EntityTypeMailMessage, EntityTypeMailbox, EntityTypeMalware, + EntityTypeNic, EntityTypeProcess, EntityTypeRegistryKey, EntityTypeRegistryValue, @@ -1226,6 +1347,27 @@ func PossibleEventGroupingAggregationKindValues() []EventGroupingAggregationKind } } +// FileFormat - The format of the file +type FileFormat string + +const ( + // FileFormatCSV - A CSV file. + FileFormatCSV FileFormat = "CSV" + // FileFormatJSON - A JSON file. + FileFormatJSON FileFormat = "JSON" + // FileFormatUnspecified - A file of other format. + FileFormatUnspecified FileFormat = "Unspecified" +) + +// PossibleFileFormatValues returns the possible values for the FileFormat const type. +func PossibleFileFormatValues() []FileFormat { + return []FileFormat{ + FileFormatCSV, + FileFormatJSON, + FileFormatUnspecified, + } +} + // FileHashAlgorithm - The hash algorithm type. type FileHashAlgorithm string @@ -1253,6 +1395,61 @@ func PossibleFileHashAlgorithmValues() []FileHashAlgorithm { } } +// FileImportContentType - The content type of this file. +type FileImportContentType string + +const ( + // FileImportContentTypeBasicIndicator - File containing records with the core fields of an indicator, plus the observables + // to construct the STIX pattern. + FileImportContentTypeBasicIndicator FileImportContentType = "BasicIndicator" + // FileImportContentTypeStixIndicator - File containing STIX indicators. + FileImportContentTypeStixIndicator FileImportContentType = "StixIndicator" + // FileImportContentTypeUnspecified - File containing other records. + FileImportContentTypeUnspecified FileImportContentType = "Unspecified" +) + +// PossibleFileImportContentTypeValues returns the possible values for the FileImportContentType const type. +func PossibleFileImportContentTypeValues() []FileImportContentType { + return []FileImportContentType{ + FileImportContentTypeBasicIndicator, + FileImportContentTypeStixIndicator, + FileImportContentTypeUnspecified, + } +} + +// FileImportState - The state of the file import. +type FileImportState string + +const ( + // FileImportStateFatalError - A fatal error has occurred while ingesting the file. + FileImportStateFatalError FileImportState = "FatalError" + // FileImportStateInProgress - The file ingestion is in progress. + FileImportStateInProgress FileImportState = "InProgress" + // FileImportStateIngested - The file has been ingested. + FileImportStateIngested FileImportState = "Ingested" + // FileImportStateIngestedWithErrors - The file has been ingested with errors. + FileImportStateIngestedWithErrors FileImportState = "IngestedWithErrors" + // FileImportStateInvalid - The file is invalid. + FileImportStateInvalid FileImportState = "Invalid" + // FileImportStateUnspecified - Unspecified state. + FileImportStateUnspecified FileImportState = "Unspecified" + // FileImportStateWaitingForUpload - Waiting for the file to be uploaded. + FileImportStateWaitingForUpload FileImportState = "WaitingForUpload" +) + +// PossibleFileImportStateValues returns the possible values for the FileImportState const type. +func PossibleFileImportStateValues() []FileImportState { + return []FileImportState{ + FileImportStateFatalError, + FileImportStateInProgress, + FileImportStateIngested, + FileImportStateIngestedWithErrors, + FileImportStateInvalid, + FileImportStateUnspecified, + FileImportStateWaitingForUpload, + } +} + // GetInsightsError - the query kind type GetInsightsError string @@ -1378,6 +1575,27 @@ func PossibleIncidentStatusValues() []IncidentStatus { } } +// IngestionMode - Describes how to ingest the records in the file. +type IngestionMode string + +const ( + // IngestionModeIngestAnyValidRecords - Valid records should still be ingested when invalid records are detected. + IngestionModeIngestAnyValidRecords IngestionMode = "IngestAnyValidRecords" + // IngestionModeIngestOnlyIfAllAreValid - No records should be ingested when invalid records are detected. + IngestionModeIngestOnlyIfAllAreValid IngestionMode = "IngestOnlyIfAllAreValid" + // IngestionModeUnspecified - Unspecified + IngestionModeUnspecified IngestionMode = "Unspecified" +) + +// PossibleIngestionModeValues returns the possible values for the IngestionMode const type. +func PossibleIngestionModeValues() []IngestionMode { + return []IngestionMode{ + IngestionModeIngestAnyValidRecords, + IngestionModeIngestOnlyIfAllAreValid, + IngestionModeUnspecified, + } +} + // KillChainIntent - Holds the alert intent stage(s) mapping for this alert. type KillChainIntent string @@ -2004,6 +2222,8 @@ func PossibleTriggerOperatorValues() []TriggerOperator { type TriggersOn string const ( + // TriggersOnAlerts - Trigger on Alerts + TriggersOnAlerts TriggersOn = "Alerts" // TriggersOnIncidents - Trigger on Incidents TriggersOnIncidents TriggersOn = "Incidents" ) @@ -2011,6 +2231,7 @@ const ( // PossibleTriggersOnValues returns the possible values for the TriggersOn const type. func PossibleTriggersOnValues() []TriggersOn { return []TriggersOn{ + TriggersOnAlerts, TriggersOnIncidents, } } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectors_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectors_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go index 59adf649bf38..135e58bd9dbf 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectors_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewDataConnectorsClient(subscriptionID string, credential azcore.TokenCrede // Connect - Connects a data connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorID - Connector ID @@ -101,7 +102,7 @@ func (client *DataConnectorsClient) connectCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, connectBody) @@ -109,7 +110,7 @@ func (client *DataConnectorsClient) connectCreateRequest(ctx context.Context, re // CreateOrUpdate - Creates or updates the data connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorID - Connector ID @@ -155,7 +156,7 @@ func (client *DataConnectorsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataConnector) @@ -172,7 +173,7 @@ func (client *DataConnectorsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Delete the data connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorID - Connector ID @@ -216,7 +217,7 @@ func (client *DataConnectorsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -224,7 +225,7 @@ func (client *DataConnectorsClient) deleteCreateRequest(ctx context.Context, res // Disconnect - Disconnect a data connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorID - Connector ID @@ -269,7 +270,7 @@ func (client *DataConnectorsClient) disconnectCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +278,7 @@ func (client *DataConnectorsClient) disconnectCreateRequest(ctx context.Context, // Get - Gets a data connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorID - Connector ID @@ -321,7 +322,7 @@ func (client *DataConnectorsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -337,8 +338,7 @@ func (client *DataConnectorsClient) getHandleResponse(resp *http.Response) (Data } // NewListPager - Gets all data connectors. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - DataConnectorsClientListOptions contains the optional parameters for the DataConnectorsClient.List method. @@ -390,7 +390,7 @@ func (client *DataConnectorsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go new file mode 100644 index 000000000000..76691f3ed7df --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go @@ -0,0 +1,1048 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetDataConnectors.json +func ExampleDataConnectorsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAPIPolling.json +func ExampleDataConnectorsClient_Get_getAApiPollingDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAzureSecurityCenterById.json +func ExampleDataConnectorsClient_Get_getAAscDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetDynamics365DataConnectorById.json +func ExampleDataConnectorsClient_Get_getADynamics365DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetGenericUI.json +func ExampleDataConnectorsClient_Get_getAGenericUiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetIoTById.json +func ExampleDataConnectorsClient_Get_getAIoTDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "d2e5dc7a-f3a2-429d-954b-939fa8c2932e", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetMicrosoftCloudAppSecurityById.json +func ExampleDataConnectorsClient_Get_getAMcasDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "b96d014d-b5c2-4a01-9aba-a8058f629d42", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json +func ExampleDataConnectorsClient_Get_getAMdatpDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetMicrosoftThreatIntelligenceById.json +func ExampleDataConnectorsClient_Get_getAMicrosoftThreatIntelligenceDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetMicrosoftThreatProtectionById.json +func ExampleDataConnectorsClient_Get_getAMicrosoftThreatProtectionDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetThreatIntelligenceTaxiiById.json +func ExampleDataConnectorsClient_Get_getATiTaxiiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c39bb458-02a7-4b3f-b0c8-71a1d2692652", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetThreatIntelligenceById.json +func ExampleDataConnectorsClient_Get_getATiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAzureActiveDirectoryById.json +func ExampleDataConnectorsClient_Get_getAnAadDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAzureAdvancedThreatProtectionById.json +func ExampleDataConnectorsClient_Get_getAnAatpDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "07e42cb3-e658-4e90-801c-efa0f29d3d44", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAmazonWebServicesS3ById.json +func ExampleDataConnectorsClient_Get_getAnAwsS3DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "afef3743-0c88-469c-84ff-ca2e87dc1e48", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetAmazonWebServicesCloudTrailById.json +func ExampleDataConnectorsClient_Get_getAnAwsCloudTrailDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetOffice365AdvancedThreatProtectionById.json +func ExampleDataConnectorsClient_Get_getAnOfficeAtpDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetMicrosoftInsiderRiskManagementById.json +func ExampleDataConnectorsClient_Get_getAnOfficeIrmDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "3d3e955e-33eb-401d-89a7-251c81ddd660", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetOfficePowerBIDataConnetorById.json +func ExampleDataConnectorsClient_Get_getAnOffice365PowerBiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetOffice365ProjectDataConnetorById.json +func ExampleDataConnectorsClient_Get_getAnOffice365ProjectDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/GetOfficeDataConnetorById.json +func ExampleDataConnectorsClient_Get_getAnOffice365DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateAPIPolling.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAApiPollingDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", &armsecurityinsights.CodelessAPIPollingDataConnector{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindAPIPolling), + Properties: &armsecurityinsights.APIPollingParameters{ + ConnectorUIConfig: &armsecurityinsights.CodelessUIConnectorConfigProperties{ + Availability: &armsecurityinsights.Availability{ + IsPreview: to.Ptr(true), + Status: to.Ptr[int32](1), + }, + ConnectivityCriteria: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem{ + { + Type: to.Ptr(armsecurityinsights.ConnectivityType("SentinelKindsV2")), + Value: []*string{}, + }}, + DataTypes: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesDataTypesItem{ + { + Name: to.Ptr("{{graphQueriesTableName}}"), + LastDataReceivedQuery: to.Ptr("{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"), + }}, + DescriptionMarkdown: to.Ptr("The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process."), + GraphQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesGraphQueriesItem{ + { + BaseQuery: to.Ptr("{{graphQueriesTableName}}"), + Legend: to.Ptr("GitHub audit log events"), + MetricName: to.Ptr("Total events received"), + }}, + GraphQueriesTableName: to.Ptr("GitHubAuditLogPolling_CL"), + InstructionSteps: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesInstructionStepsItem{ + { + Description: to.Ptr("Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key"), + Instructions: []*armsecurityinsights.InstructionStepsInstructionsItem{ + { + Type: to.Ptr(armsecurityinsights.SettingType("APIKey")), + Parameters: map[string]interface{}{ + "enable": "true", + "userRequestPlaceHoldersInput": []interface{}{ + map[string]interface{}{ + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "", + "requestObjectKey": "apiEndpoint", + }, + }, + }, + }}, + Title: to.Ptr("Connect GitHub Enterprise Audit Log to Azure Sentinel"), + }}, + Permissions: &armsecurityinsights.Permissions{ + Customs: []*armsecurityinsights.PermissionsCustomsItem{ + { + Name: to.Ptr("GitHub API personal token Key"), + Description: to.Ptr("You need access to GitHub personal token, the key should have 'admin:org' scope"), + }}, + ResourceProvider: []*armsecurityinsights.PermissionsResourceProviderItem{ + { + PermissionsDisplayText: to.Ptr("read and write permissions are required."), + Provider: to.Ptr(armsecurityinsights.ProviderNameMicrosoftOperationalInsightsWorkspaces), + ProviderDisplayName: to.Ptr("Workspace"), + RequiredPermissions: &armsecurityinsights.RequiredPermissions{ + Delete: to.Ptr(true), + Read: to.Ptr(true), + Write: to.Ptr(true), + }, + Scope: to.Ptr(armsecurityinsights.PermissionProviderScopeWorkspace), + }}, + }, + Publisher: to.Ptr("GitHub"), + SampleQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesSampleQueriesItem{ + { + Description: to.Ptr("All logs"), + Query: to.Ptr("{{graphQueriesTableName}}\n | take 10 "), + }}, + Title: to.Ptr("GitHub Enterprise Audit Log"), + }, + PollingConfig: &armsecurityinsights.CodelessConnectorPollingConfigProperties{ + Auth: &armsecurityinsights.CodelessConnectorPollingAuthProperties{ + APIKeyIdentifier: to.Ptr("token"), + APIKeyName: to.Ptr("Authorization"), + AuthType: to.Ptr("APIKey"), + }, + Paging: &armsecurityinsights.CodelessConnectorPollingPagingProperties{ + PageSizeParaName: to.Ptr("per_page"), + PagingType: to.Ptr("LinkHeader"), + }, + Response: &armsecurityinsights.CodelessConnectorPollingResponseProperties{ + EventsJSONPaths: []*string{ + to.Ptr("$")}, + }, + Request: &armsecurityinsights.CodelessConnectorPollingRequestProperties{ + APIEndpoint: to.Ptr("https://api.github.com/organizations/{{placeHolder1}}/audit-log"), + Headers: map[string]interface{}{ + "Accept": "application/json", + "User-Agent": "Scuba", + }, + HTTPMethod: to.Ptr("Get"), + QueryParameters: map[string]interface{}{ + "phrase": "created:{_QueryWindowStartTime}..{_QueryWindowEndTime}", + }, + QueryTimeFormat: to.Ptr("yyyy-MM-ddTHH:mm:ssZ"), + QueryWindowInMin: to.Ptr[int32](15), + RateLimitQPS: to.Ptr[int32](50), + RetryCount: to.Ptr[int32](2), + TimeoutInSeconds: to.Ptr[int32](60), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateDynamics365DataConnetor.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesADynamics365DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "c2541efb-c9a6-47fe-9501-87d1017d1512", &armsecurityinsights.Dynamics365DataConnector{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.DataConnectorKindDynamics365), + Properties: &armsecurityinsights.Dynamics365DataConnectorProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + DataTypes: &armsecurityinsights.Dynamics365DataConnectorDataTypes{ + Dynamics365CdsActivities: &armsecurityinsights.Dynamics365DataConnectorDataTypesDynamics365CdsActivities{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateGenericUI.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAGenericUiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", &armsecurityinsights.CodelessUIDataConnector{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindGenericUI), + Properties: &armsecurityinsights.CodelessParameters{ + ConnectorUIConfig: &armsecurityinsights.CodelessUIConnectorConfigProperties{ + Availability: &armsecurityinsights.Availability{ + IsPreview: to.Ptr(true), + Status: to.Ptr[int32](1), + }, + ConnectivityCriteria: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem{ + { + Type: to.Ptr(armsecurityinsights.ConnectivityTypeIsConnectedQuery), + Value: []*string{ + to.Ptr("{{graphQueriesTableName}}\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)")}, + }}, + DataTypes: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesDataTypesItem{ + { + Name: to.Ptr("{{graphQueriesTableName}}"), + LastDataReceivedQuery: to.Ptr("{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"), + }}, + DescriptionMarkdown: to.Ptr("The [Qualys Vulnerability Management (VM)](https://www.qualys.com/apps/vulnerability-management/) data connector provides the capability to ingest vulnerability host detection data into Azure Sentinel through the Qualys API. The connector provides visibility into host detection data from vulerability scans. This connector provides Azure Sentinel the capability to view dashboards, create custom alerts, and improve investigation "), + GraphQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesGraphQueriesItem{ + { + BaseQuery: to.Ptr("{{graphQueriesTableName}}"), + Legend: to.Ptr("{{graphQueriesTableName}}"), + MetricName: to.Ptr("Total data received"), + }}, + GraphQueriesTableName: to.Ptr("QualysHostDetection_CL"), + InstructionSteps: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesInstructionStepsItem{ + { + Description: to.Ptr(">**NOTE:** This connector uses Azure Functions to connect to Qualys VM to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr(">**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr("**STEP 1 - Configuration steps for the Qualys VM API**\n\n1. Log into the Qualys Vulnerability Management console with an administrator account, select the **Users** tab and the **Users** subtab. \n2. Click on the **New** drop-down menu and select **Users..**\n3. Create a username and password for the API account. \n4. In the **User Roles** tab, ensure the account role is set to **Manager** and access is allowed to **GUI** and **API**\n4. Log out of the administrator account and log into the console with the new API credentials for validation, then log out of the API account. \n5. Log back into the console using an administrator account and modify the API accounts User Roles, removing access to **GUI**. \n6. Save all changes."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr("**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the Qualys VM connector, have the Workspace ID and Workspace Primary Key (can be copied from the following), as well as the Qualys VM API Authorization Key(s), readily available."), + Instructions: []*armsecurityinsights.InstructionStepsInstructionsItem{ + { + Type: to.Ptr(armsecurityinsights.SettingTypeCopyableLabel), + Parameters: map[string]interface{}{ + "fillWith": []interface{}{ + "WorkspaceId", + }, + "label": "Workspace ID", + }, + }, + { + Type: to.Ptr(armsecurityinsights.SettingTypeCopyableLabel), + Parameters: map[string]interface{}{ + "fillWith": []interface{}{ + "PrimaryKey", + }, + "label": "Primary Key", + }, + }}, + Title: to.Ptr(""), + }, + { + Description: to.Ptr("Use this method for automated deployment of the Qualys VM connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n [![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://aka.ms/sentinelqualysvmazuredeploy)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**. \n3. Enter the **Workspace ID**, **Workspace Key**, **API Username**, **API Password** , update the **URI**, and any additional URI **Filter Parameters** (each filter should be separated by an \"&\" symbol, no spaces.) \n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348) -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format. \n - The default **Time Interval** is set to pull the last five (5) minutes of data. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly (in the function.json file, post deployment) to prevent overlapping data ingestion. \n> - Note: If using Azure Key Vault secrets for any of the values above, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."), + Title: to.Ptr("Option 1 - Azure Resource Manager (ARM) Template"), + }, + { + Description: to.Ptr("Use the following step-by-step instructions to deploy the Quayls VM connector manually with Azure Functions."), + Title: to.Ptr("Option 2 - Manual Deployment of Azure Functions"), + }, + { + Description: to.Ptr("**1. Create a Function App**\n\n1. From the Azure Portal, navigate to [Function App](https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Web%2Fsites/kind/functionapp), and select **+ Add**.\n2. In the **Basics** tab, ensure Runtime stack is set to **Powershell Core**. \n3. In the **Hosting** tab, ensure the **Consumption (Serverless)** plan type is selected.\n4. Make other preferrable configuration changes, if needed, then click **Create**."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr("**2. Import Function App Code**\n\n1. In the newly created Function App, select **Functions** on the left pane and click **+ New Function**.\n2. Select **Timer Trigger**.\n3. Enter a unique Function **Name** and leave the default cron schedule of every 5 minutes, then click **Create**.\n5. Click on **Code + Test** on the left pane. \n6. Copy the [Function App Code](https://aka.ms/sentinelqualysvmazurefunctioncode) and paste into the Function App `run.ps1` editor.\n7. Click **Save**."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr("**3. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select **+ New application setting**.\n3. Add each of the following seven (7) application settings individually, with their respective string values (case-sensitive): \n apiUsername\n apiPassword\n workspaceID\n workspaceKey\n uri\n filterParameters\n timeInterval\n> - Enter the URI that corresponds to your region. The complete list of API Server URLs can be [found here](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf#G4.735348). The `uri` value must follow the following schema: `https:///api/2.0/fo/asset/host/vm/detection/?action=list&vm_processed_after=` -- There is no need to add a time suffix to the URI, the Function App will dynamically append the Time Value to the URI in the proper format.\n> - Add any additional filter parameters, for the `filterParameters` variable, that need to be appended to the URI. Each parameter should be seperated by an \"&\" symbol and should not include any spaces.\n> - Set the `timeInterval` (in minutes) to the value of `5` to correspond to the Timer Trigger of every `5` minutes. If the time interval needs to be modified, it is recommended to change the Function App Timer Trigger accordingly to prevent overlapping data ingestion.\n> - Note: If using Azure Key Vault, use the`@Microsoft.KeyVault(SecretUri={Security Identifier})`schema in place of the string values. Refer to [Key Vault references documentation](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) for further details.\n4. Once all application settings have been entered, click **Save**."), + Title: to.Ptr(""), + }, + { + Description: to.Ptr("**4. Configure the host.json**.\n\nDue to the potentially large amount of Qualys host detection data being ingested, it can cause the execution time to surpass the default Function App timeout of five (5) minutes. Increase the default timeout duration to the maximum of ten (10) minutes, under the Consumption Plan, to allow more time for the Function App to execute.\n\n1. In the Function App, select the Function App Name and select the **App Service Editor** blade.\n2. Click **Go** to open the editor, then select the **host.json** file under the **wwwroot** directory.\n3. Add the line `\"functionTimeout\": \"00:10:00\",` above the `managedDependancy` line \n4. Ensure **SAVED** appears on the top right corner of the editor, then exit the editor.\n\n> NOTE: If a longer timeout duration is required, consider upgrading to an [App Service Plan](https://docs.microsoft.com/azure/azure-functions/functions-scale#timeout)"), + Title: to.Ptr(""), + }}, + Permissions: &armsecurityinsights.Permissions{ + Customs: []*armsecurityinsights.PermissionsCustomsItem{ + { + Name: to.Ptr("Microsoft.Web/sites permissions"), + Description: to.Ptr("Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."), + }, + { + Name: to.Ptr("Qualys API Key"), + Description: to.Ptr("A Qualys VM API username and password is required. [See the documentation to learn more about Qualys VM API](https://www.qualys.com/docs/qualys-api-vmpc-user-guide.pdf)."), + }}, + ResourceProvider: []*armsecurityinsights.PermissionsResourceProviderItem{ + { + PermissionsDisplayText: to.Ptr("read and write permissions on the workspace are required."), + Provider: to.Ptr(armsecurityinsights.ProviderNameMicrosoftOperationalInsightsWorkspaces), + ProviderDisplayName: to.Ptr("Workspace"), + RequiredPermissions: &armsecurityinsights.RequiredPermissions{ + Delete: to.Ptr(true), + Read: to.Ptr(true), + Write: to.Ptr(true), + }, + Scope: to.Ptr(armsecurityinsights.PermissionProviderScopeWorkspace), + }, + { + PermissionsDisplayText: to.Ptr("read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key)."), + Provider: to.Ptr(armsecurityinsights.ProviderNameMicrosoftOperationalInsightsWorkspacesSharedKeys), + ProviderDisplayName: to.Ptr("Keys"), + RequiredPermissions: &armsecurityinsights.RequiredPermissions{ + Action: to.Ptr(true), + }, + Scope: to.Ptr(armsecurityinsights.PermissionProviderScopeWorkspace), + }}, + }, + Publisher: to.Ptr("Qualys"), + SampleQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesSampleQueriesItem{ + { + Description: to.Ptr("Top 10 Vulerabilities detected"), + Query: to.Ptr("{{graphQueriesTableName}}\n | mv-expand todynamic(Detections_s)\n | extend Vulnerability = tostring(Detections_s.Results)\n | summarize count() by Vulnerability\n | top 10 by count_"), + }}, + Title: to.Ptr("Qualys Vulnerability Management (CCP DEMO)"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateThreatIntelligenceTaxiiDataConnector.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAThreatIntelligenceTaxiiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.TiTaxiiDataConnector{ + Etag: to.Ptr("d12423f6-a60b-4ca5-88c0-feb1a182d0f0"), + Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligenceTaxii), + Properties: &armsecurityinsights.TiTaxiiDataConnectorProperties{ + TenantID: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + CollectionID: to.Ptr("135"), + DataTypes: &armsecurityinsights.TiTaxiiDataConnectorDataTypes{ + TaxiiClient: &armsecurityinsights.TiTaxiiDataConnectorDataTypesTaxiiClient{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + FriendlyName: to.Ptr("testTaxii"), + Password: to.Ptr("--"), + PollingFrequency: to.Ptr(armsecurityinsights.PollingFrequencyOnceADay), + TaxiiLookbackPeriod: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T13:00:30.123Z"); return t }()), + TaxiiServer: to.Ptr("https://limo.anomali.com/api/v1/taxii2/feeds"), + UserName: to.Ptr("--"), + WorkspaceID: to.Ptr("dd124572-4962-4495-9bd2-9dade12314b4"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateOfficePowerBIDataConnector.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnOfficePowerBiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.OfficePowerBIDataConnector{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOfficePowerBI), + Properties: &armsecurityinsights.OfficePowerBIDataConnectorProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + DataTypes: &armsecurityinsights.OfficePowerBIConnectorDataTypes{ + Logs: &armsecurityinsights.OfficePowerBIConnectorDataTypesLogs{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateOffice365ProjectDataConnetor.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnOffice365ProjectDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.Office365ProjectDataConnector{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365Project), + Properties: &armsecurityinsights.Office365ProjectDataConnectorProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + DataTypes: &armsecurityinsights.Office365ProjectConnectorDataTypes{ + Logs: &armsecurityinsights.Office365ProjectConnectorDataTypesLogs{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateOfficeDataConnetor.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnOffice365DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.OfficeDataConnector{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365), + Properties: &armsecurityinsights.OfficeDataConnectorProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + DataTypes: &armsecurityinsights.OfficeDataConnectorDataTypes{ + Exchange: &armsecurityinsights.OfficeDataConnectorDataTypesExchange{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + SharePoint: &armsecurityinsights.OfficeDataConnectorDataTypesSharePoint{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + Teams: &armsecurityinsights.OfficeDataConnectorDataTypesTeams{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CreateThreatIntelligenceDataConnector.json +func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnThreatIntelligencePlatformDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.TIDataConnector{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), + Properties: &armsecurityinsights.TIDataConnectorProperties{ + TenantID: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), + DataTypes: &armsecurityinsights.TIDataConnectorDataTypes{ + Indicators: &armsecurityinsights.TIDataConnectorDataTypesIndicators{ + State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), + }, + }, + TipLookbackPeriod: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T13:00:30.123Z"); return t }()), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DeleteAPIPolling.json +func ExampleDataConnectorsClient_Delete_deleteAApiPollingDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DeleteGenericUI.json +func ExampleDataConnectorsClient_Delete_deleteAGenericUiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DeleteOfficePowerBIDataConnetor.json +func ExampleDataConnectorsClient_Delete_deleteAnOfficePowerBiDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DeleteOffice365ProjectDataConnetor.json +func ExampleDataConnectorsClient_Delete_deleteAnOffice365ProjectDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DeleteOfficeDataConnetor.json +func ExampleDataConnectorsClient_Delete_deleteAnOffice365DataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/ConnectAPIPollingV2Logs.json +func ExampleDataConnectorsClient_Connect_connectAnApiPollingV2LogsDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Connect(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", armsecurityinsights.DataConnectorConnectBody{ + APIKey: to.Ptr("123456789"), + DataCollectionEndpoint: to.Ptr("https://test.eastus.ingest.monitor.azure.com"), + DataCollectionRuleImmutableID: to.Ptr("dcr-34adsj9o7d6f9de204478b9cgb43b631"), + Kind: to.Ptr(armsecurityinsights.ConnectAuthKindAPIKey), + OutputStream: to.Ptr("Custom-MyTableRawData"), + RequestConfigUserInputValues: []interface{}{ + map[string]interface{}{ + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "somePlaceHolderValue", + "requestObjectKey": "apiEndpoint", + }}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/ConnectAPIPolling.json +func ExampleDataConnectorsClient_Connect_connectAnApiPollingDataConnector() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Connect(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", armsecurityinsights.DataConnectorConnectBody{ + APIKey: to.Ptr("123456789"), + Kind: to.Ptr(armsecurityinsights.ConnectAuthKindAPIKey), + RequestConfigUserInputValues: []interface{}{ + map[string]interface{}{ + "displayText": "Organization Name", + "placeHolderName": "{{placeHolder1}}", + "placeHolderValue": "somePlaceHolderValue", + "requestObjectKey": "apiEndpoint", + }}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/DisconnectAPIPolling.json +func ExampleDataConnectorsClient_Disconnect() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Disconnect(ctx, "myRg", "myWorkspace", "316ec55e-7138-4d63-ab18-90c8a60fd1c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectorscheckrequirements_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectorscheckrequirements_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client.go index ff369ed52039..79da37fa84f8 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_dataconnectorscheckrequirements_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewDataConnectorsCheckRequirementsClient(subscriptionID string, credential // Post - Get requirements state for a data connector type. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // dataConnectorsCheckRequirements - The parameters for requirements check message @@ -97,7 +98,7 @@ func (client *DataConnectorsCheckRequirementsClient) postCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, dataConnectorsCheckRequirements) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client_example_test.go new file mode 100644 index 000000000000..1ba67818cd48 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectorscheckrequirements_client_example_test.go @@ -0,0 +1,402 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectoryNoAuthorization.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForAadNoAuthorization() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.AADCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), + Properties: &armsecurityinsights.AADCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectoryNoLicense.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForAadNoLicense() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.AADCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), + Properties: &armsecurityinsights.AADCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectory.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForAad() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.AADCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), + Properties: &armsecurityinsights.AADCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsAzureSecurityCenter.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForAsc() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.ASCCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureSecurityCenter), + Properties: &armsecurityinsights.ASCCheckRequirementsProperties{ + SubscriptionID: to.Ptr("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsDynamics365.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForDynamics365() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.Dynamics365CheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindDynamics365), + Properties: &armsecurityinsights.Dynamics365CheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsIoT.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForIoT() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.IoTCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindIOT), + Properties: &armsecurityinsights.IoTCheckRequirementsProperties{ + SubscriptionID: to.Ptr("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftCloudAppSecurity.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForMcas() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.MCASCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftCloudAppSecurity), + Properties: &armsecurityinsights.MCASCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsMdatp.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForMdatp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.MCASCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftCloudAppSecurity), + Properties: &armsecurityinsights.MCASCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftThreatIntelligence.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForMicrosoftThreatIntelligence() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.MSTICheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftThreatIntelligence), + Properties: &armsecurityinsights.MSTICheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsMicrosoftThreatProtection.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForMicrosoftThreatProtection() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.MtpCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftThreatProtection), + Properties: &armsecurityinsights.MTPCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsOffice365Project.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForOffice365Project() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.Office365ProjectCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365Project), + Properties: &armsecurityinsights.Office365ProjectCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsOfficeATP.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForOfficeAtp() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.OfficeATPCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOfficeATP), + Properties: &armsecurityinsights.OfficeATPCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsOfficeIRM.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForOfficeIrm() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.OfficeIRMCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOfficeIRM), + Properties: &armsecurityinsights.OfficeIRMCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsOfficePowerBI.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForOfficePowerBi() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.OfficePowerBICheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindOfficePowerBI), + Properties: &armsecurityinsights.OfficePowerBICheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsThreatIntelligenceTaxii.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForTiTaxii() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.TiTaxiiCheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligenceTaxii), + Properties: &armsecurityinsights.TiTaxiiCheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/dataConnectors/CheckRequirementsThreatIntelligence.json +func ExampleDataConnectorsCheckRequirementsClient_Post_checkRequirementsForTi() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Post(ctx, "myRg", "myWorkspace", &armsecurityinsights.TICheckRequirements{ + Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), + Properties: &armsecurityinsights.TICheckRequirementsProperties{ + TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_date_type.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go similarity index 98% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_date_type.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go index 90fdb5cc71a6..aa29fe7cf6a2 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_date_type.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_domainwhois_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_domainwhois_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client.go index d3ac119a5780..8a5a53fc10c7 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_domainwhois_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewDomainWhoisClient(subscriptionID string, credential azcore.TokenCredenti // Get - Get whois information for a single domain name // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // domain - Domain name to be enriched // options - DomainWhoisClientGetOptions contains the optional parameters for the DomainWhoisClient.Get method. @@ -91,7 +92,7 @@ func (client *DomainWhoisClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") reqQP.Set("domain", domain) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_domainwhois_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client_example_test.go similarity index 90% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_domainwhois_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client_example_test.go index 5316fe5a5496..9fb7accfb0d2 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_domainwhois_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/domainwhois_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/enrichment/GetWhoisByDomainName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/enrichment/GetWhoisByDomainName.json func ExampleDomainWhoisClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleDomainWhoisClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "microsoft.com", - nil) + res, err := client.Get(ctx, "myRg", "microsoft.com", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entities_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entities_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client.go index 5bfe8b242a62..18c9e2741c20 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entities_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewEntitiesClient(subscriptionID string, credential azcore.TokenCredential, // Expand - Expands an entity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -101,7 +102,7 @@ func (client *EntitiesClient) expandCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -118,7 +119,7 @@ func (client *EntitiesClient) expandHandleResponse(resp *http.Response) (Entitie // Get - Gets an entity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -162,7 +163,7 @@ func (client *EntitiesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +180,7 @@ func (client *EntitiesClient) getHandleResponse(resp *http.Response) (EntitiesCl // GetInsights - Execute Insights for an entity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -224,7 +225,7 @@ func (client *EntitiesClient) getInsightsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -240,8 +241,7 @@ func (client *EntitiesClient) getInsightsHandleResponse(resp *http.Response) (En } // NewListPager - Gets all entities. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - EntitiesClientListOptions contains the optional parameters for the EntitiesClient.List method. @@ -293,7 +293,7 @@ func (client *EntitiesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +310,7 @@ func (client *EntitiesClient) listHandleResponse(resp *http.Response) (EntitiesC // Queries - Get Insights and Activities for an entity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -355,7 +355,7 @@ func (client *EntitiesClient) queriesCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") reqQP.Set("kind", string(kind)) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client_example_test.go new file mode 100644 index 000000000000..114a216ef742 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entities_client_example_test.go @@ -0,0 +1,491 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetEntities.json +func ExampleEntitiesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetCloudApplicationEntityById.json +func ExampleEntitiesClient_Get_getACloudApplicationEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetDnsEntityById.json +func ExampleEntitiesClient_Get_getADnsEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "f4e74920-f2c0-4412-a45f-66d94fdf01f8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetFileEntityById.json +func ExampleEntitiesClient_Get_getAFileEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetFileHashEntityById.json +func ExampleEntitiesClient_Get_getAFileHashEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "ea359fa6-c1e5-f878-e105-6344f3e399a1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetHostEntityById.json +func ExampleEntitiesClient_Get_getAHostEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetMailClusterEntityById.json +func ExampleEntitiesClient_Get_getAMailClusterEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetMailMessageEntityById.json +func ExampleEntitiesClient_Get_getAMailMessageEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetMailboxEntityById.json +func ExampleEntitiesClient_Get_getAMailboxEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetMalwareEntityById.json +func ExampleEntitiesClient_Get_getAMalwareEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "af378b21-b4aa-4fe7-bc70-13f8621a322f", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetProcessEntityById.json +func ExampleEntitiesClient_Get_getAProcessEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "7264685c-038c-42c6-948c-38e14ef1fb98", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetRegistryKeyEntityById.json +func ExampleEntitiesClient_Get_getARegistryKeyEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetRegistryValueEntityById.json +func ExampleEntitiesClient_Get_getARegistryValueEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "dc44bd11-b348-4d76-ad29-37bf7aa41356", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetSecurityAlertEntityById.json +func ExampleEntitiesClient_Get_getASecurityAlertEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "4aa486e0-6f85-41af-99ea-7acdce7be6c8", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetSecurityGroupEntityById.json +func ExampleEntitiesClient_Get_getASecurityGroupEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetSubmissionMailEntityById.json +func ExampleEntitiesClient_Get_getASubmissionMailEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetUrlEntityById.json +func ExampleEntitiesClient_Get_getAUrlEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetIoTDeviceEntityById.json +func ExampleEntitiesClient_Get_getAnIoTDeviceEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetAccountEntityById.json +func ExampleEntitiesClient_Get_getAnAccountEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetAzureResourceEntityById.json +func ExampleEntitiesClient_Get_getAnAzureResourceEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetIpEntityById.json +func ExampleEntitiesClient_Get_getAnIpEntity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/expand/PostExpandEntity.json +func ExampleEntitiesClient_Expand() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Expand(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", armsecurityinsights.EntityExpandParameters{ + EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-26T00:00:00.000Z"); return t }()), + ExpansionID: to.Ptr("a77992f3-25e9-4d01-99a4-5ff606cc410a"), + StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-25T00:00:00.000Z"); return t }()), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/GetQueries.json +func ExampleEntitiesClient_Queries() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Queries(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", armsecurityinsights.EntityItemQueryKindInsight, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/insights/PostGetInsights.json +func ExampleEntitiesClient_GetInsights() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.GetInsights(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", armsecurityinsights.EntityGetInsightsParameters{ + AddDefaultExtendedTimeRange: to.Ptr(false), + EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t }()), + InsightQueryIDs: []*string{ + to.Ptr("cae8d0aa-aa45-4d53-8d88-17dd64ffd4e4")}, + StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T00:00:00.000Z"); return t }()), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesgettimeline_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesgettimeline_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client.go index ea3075ab4d90..dd6a983a4888 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesgettimeline_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewEntitiesGetTimelineClient(subscriptionID string, credential azcore.Token // List - Timeline for an entity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -102,7 +103,7 @@ func (client *EntitiesGetTimelineClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesgettimeline_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client_example_test.go similarity index 71% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesgettimeline_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client_example_test.go index a6999843f7c2..1a6a22800bf9 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesgettimeline_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesgettimeline_client_example_test.go @@ -19,7 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/timeline/PostTimelineEntity.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/timeline/PostTimelineEntity.json func ExampleEntitiesGetTimelineClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,16 +30,11 @@ func ExampleEntitiesGetTimelineClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.List(ctx, - "myRg", - "myWorkspace", - "e1d3d618-e11f-478b-98e3-bb381539a8e1", - armsecurityinsights.EntityTimelineParameters{ - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t }()), - NumberOfBucket: to.Ptr[int32](4), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T00:00:00.000Z"); return t }()), - }, - nil) + res, err := client.List(ctx, "myRg", "myWorkspace", "e1d3d618-e11f-478b-98e3-bb381539a8e1", armsecurityinsights.EntityTimelineParameters{ + EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t }()), + NumberOfBucket: to.Ptr[int32](4), + StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T00:00:00.000Z"); return t }()), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesrelations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesrelations_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client.go index 2ebedba48f4b..11010f979f6d 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entitiesrelations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,8 +57,7 @@ func NewEntitiesRelationsClient(subscriptionID string, credential azcore.TokenCr } // NewListPager - Gets all relations of an entity. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -114,7 +114,7 @@ func (client *EntitiesRelationsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesrelations_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client_example_test.go similarity index 82% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesrelations_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client_example_test.go index 671afc361056..9dbcd0c16850 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entitiesrelations_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entitiesrelations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/relations/GetAllEntityRelations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/relations/GetAllEntityRelations.json func ExampleEntitiesRelationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,14 +27,11 @@ func ExampleEntitiesRelationsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - &armsecurityinsights.EntitiesRelationsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", &armsecurityinsights.EntitiesRelationsClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityqueries_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityqueries_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client.go index 7eddd4f75b23..c61f5708cd4b 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityqueries_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewEntityQueriesClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates or updates the entity query. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityQueryID - entity query ID @@ -102,7 +103,7 @@ func (client *EntityQueriesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, entityQuery) @@ -119,7 +120,7 @@ func (client *EntityQueriesClient) createOrUpdateHandleResponse(resp *http.Respo // Delete - Delete the entity query. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityQueryID - entity query ID @@ -163,7 +164,7 @@ func (client *EntityQueriesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +172,7 @@ func (client *EntityQueriesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets an entity query. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityQueryID - entity query ID @@ -215,7 +216,7 @@ func (client *EntityQueriesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,8 +232,7 @@ func (client *EntityQueriesClient) getHandleResponse(resp *http.Response) (Entit } // NewListPager - Gets all entity queries. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - EntityQueriesClientListOptions contains the optional parameters for the EntityQueriesClient.List method. @@ -287,7 +287,7 @@ func (client *EntityQueriesClient) listCreateRequest(ctx context.Context, resour if options != nil && options.Kind != nil { reqQP.Set("kind", string(*options.Kind)) } - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client_example_test.go new file mode 100644 index 000000000000..023087c22003 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityqueries_client_example_test.go @@ -0,0 +1,144 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueries/GetEntityQueries.json +func ExampleEntityQueriesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.EntityQueriesClientListOptions{Kind: to.Ptr(armsecurityinsights.Enum13Expansion)}) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueries/GetActivityEntityQueryById.json +func ExampleEntityQueriesClient_Get_getAnActivityEntityQuery() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueries/GetExpansionEntityQueryById.json +func ExampleEntityQueriesClient_Get_getAnExpansionEntityQuery() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueries/CreateEntityQueryActivity.json +func ExampleEntityQueriesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", &armsecurityinsights.ActivityCustomEntityQuery{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.CustomEntityQueryKindActivity), + Properties: &armsecurityinsights.ActivityEntityQueriesProperties{ + Description: to.Ptr("Account deleted on host"), + Content: to.Ptr("On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'"), + Enabled: to.Ptr(true), + EntitiesFilter: map[string][]*string{ + "Host_OsFamily": { + to.Ptr("Windows")}, + }, + InputEntityType: to.Ptr(armsecurityinsights.EntityTypeHost), + QueryDefinitions: &armsecurityinsights.ActivityEntityQueriesPropertiesQueryDefinitions{ + Query: to.Ptr("let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 "), + }, + RequiredInputFieldsSets: [][]*string{ + { + to.Ptr("Host_HostName"), + to.Ptr("Host_NTDomain")}, + { + to.Ptr("Host_HostName"), + to.Ptr("Host_DnsDomain")}, + { + to.Ptr("Host_AzureID")}, + { + to.Ptr("Host_OMSAgentID")}}, + Title: to.Ptr("An account was deleted on this host"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueries/DeleteEntityQuery.json +func ExampleEntityQueriesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityquerytemplates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityquerytemplates_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client.go index 75100848a320..1f4dac5c3bcc 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityquerytemplates_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewEntityQueryTemplatesClient(subscriptionID string, credential azcore.Toke // Get - Gets an entity query. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityQueryTemplateID - entity query template ID @@ -101,7 +102,7 @@ func (client *EntityQueryTemplatesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,8 +118,7 @@ func (client *EntityQueryTemplatesClient) getHandleResponse(resp *http.Response) } // NewListPager - Gets all entity query templates. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - EntityQueryTemplatesClientListOptions contains the optional parameters for the EntityQueryTemplatesClient.List @@ -174,7 +174,7 @@ func (client *EntityQueryTemplatesClient) listCreateRequest(ctx context.Context, if options != nil && options.Kind != nil { reqQP.Set("kind", string(*options.Kind)) } - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityquerytemplates_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client_example_test.go similarity index 84% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityquerytemplates_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client_example_test.go index 3be62acde0a2..728affba79eb 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityquerytemplates_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityquerytemplates_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueryTemplates/GetEntityQueryTemplates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueryTemplates/GetEntityQueryTemplates.json func ExampleEntityQueryTemplatesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleEntityQueryTemplatesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.EntityQueryTemplatesClientListOptions{Kind: to.Ptr(armsecurityinsights.Enum15Activity)}) + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.EntityQueryTemplatesClientListOptions{Kind: to.Ptr(armsecurityinsights.Enum15Activity)}) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleEntityQueryTemplatesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueryTemplates/GetActivityEntityQueryTemplateById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entityQueryTemplates/GetActivityEntityQueryTemplateById.json func ExampleEntityQueryTemplatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleEntityQueryTemplatesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "07da3cc8-c8ad-4710-a44e-334cdcb7882b", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "07da3cc8-c8ad-4710-a44e-334cdcb7882b", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityrelations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityrelations_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client.go index 5d711af04ae0..2bbe4177ebe1 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_entityrelations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewEntityRelationsClient(subscriptionID string, credential azcore.TokenCred // GetRelation - Gets an entity relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // entityID - entity ID @@ -106,7 +107,7 @@ func (client *EntityRelationsClient) getRelationCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityrelations_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client_example_test.go similarity index 85% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityrelations_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client_example_test.go index aed367dd35d5..61ab53b022c3 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityrelations_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/entityrelations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/relations/GetEntityRelationByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/entities/relations/GetEntityRelationByName.json func ExampleEntityRelationsClient_GetRelation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,12 +27,7 @@ func ExampleEntityRelationsClient_GetRelation() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetRelation(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + res, err := client.GetRelation(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client.go new file mode 100644 index 000000000000..401b4879be9e --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client.go @@ -0,0 +1,329 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FileImportsClient contains the methods for the FileImports group. +// Don't use this type directly, use NewFileImportsClient() instead. +type FileImportsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewFileImportsClient creates a new instance of FileImportsClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewFileImportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FileImportsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &FileImportsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Creates the file import. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-09-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// workspaceName - The name of the workspace. +// fileImportID - File import ID +// fileImport - The file import +// options - FileImportsClientCreateOptions contains the optional parameters for the FileImportsClient.Create method. +func (client *FileImportsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, fileImport FileImport, options *FileImportsClientCreateOptions) (FileImportsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, workspaceName, fileImportID, fileImport, options) + if err != nil { + return FileImportsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileImportsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return FileImportsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *FileImportsClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, fileImport FileImport, options *FileImportsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if fileImportID == "" { + return nil, errors.New("parameter fileImportID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileImportId}", url.PathEscape(fileImportID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, fileImport) +} + +// createHandleResponse handles the Create response. +func (client *FileImportsClient) createHandleResponse(resp *http.Response) (FileImportsClientCreateResponse, error) { + result := FileImportsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileImport); err != nil { + return FileImportsClientCreateResponse{}, err + } + return result, nil +} + +// BeginDelete - Delete the file import. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-09-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// workspaceName - The name of the workspace. +// fileImportID - File import ID +// options - FileImportsClientBeginDeleteOptions contains the optional parameters for the FileImportsClient.BeginDelete method. +func (client *FileImportsClient) BeginDelete(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, options *FileImportsClientBeginDeleteOptions) (*runtime.Poller[FileImportsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, workspaceName, fileImportID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FileImportsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[FileImportsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Delete the file import. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-09-01-preview +func (client *FileImportsClient) deleteOperation(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, options *FileImportsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, fileImportID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FileImportsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, options *FileImportsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if fileImportID == "" { + return nil, errors.New("parameter fileImportID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileImportId}", url.PathEscape(fileImportID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a file import. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-09-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// workspaceName - The name of the workspace. +// fileImportID - File import ID +// options - FileImportsClientGetOptions contains the optional parameters for the FileImportsClient.Get method. +func (client *FileImportsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, options *FileImportsClientGetOptions) (FileImportsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, fileImportID, options) + if err != nil { + return FileImportsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileImportsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileImportsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FileImportsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, fileImportID string, options *FileImportsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports/{fileImportId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if fileImportID == "" { + return nil, errors.New("parameter fileImportID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fileImportId}", url.PathEscape(fileImportID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FileImportsClient) getHandleResponse(resp *http.Response) (FileImportsClientGetResponse, error) { + result := FileImportsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileImport); err != nil { + return FileImportsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all file imports. +// Generated from API version 2022-09-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// workspaceName - The name of the workspace. +// options - FileImportsClientListOptions contains the optional parameters for the FileImportsClient.List method. +func (client *FileImportsClient) NewListPager(resourceGroupName string, workspaceName string, options *FileImportsClientListOptions) *runtime.Pager[FileImportsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FileImportsClientListResponse]{ + More: func(page FileImportsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FileImportsClientListResponse) (FileImportsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FileImportsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FileImportsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FileImportsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FileImportsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *FileImportsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/fileImports" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-09-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FileImportsClient) listHandleResponse(resp *http.Response) (FileImportsClientListResponse, error) { + result := FileImportsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FileImportList); err != nil { + return FileImportsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client_example_test.go new file mode 100644 index 000000000000..51d329343335 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fileimports_client_example_test.go @@ -0,0 +1,114 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/fileImports/GetFileImports.json +func ExampleFileImportsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewFileImportsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.FileImportsClientListOptions{Filter: nil, + Orderby: to.Ptr("properties/createdTimeUtc desc"), + Top: to.Ptr[int32](1), + SkipToken: nil, + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/fileImports/GetFileImportById.json +func ExampleFileImportsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewFileImportsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/fileImports/CreateFileImport.json +func ExampleFileImportsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewFileImportsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Create(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.FileImport{ + Properties: &armsecurityinsights.FileImportProperties{ + ContentType: to.Ptr(armsecurityinsights.FileImportContentTypeStixIndicator), + ImportFile: &armsecurityinsights.FileMetadata{ + FileFormat: to.Ptr(armsecurityinsights.FileFormatJSON), + FileName: to.Ptr("myFile.json"), + FileSize: to.Ptr[int32](4653), + }, + IngestionMode: to.Ptr(armsecurityinsights.IngestionModeIngestAnyValidRecords), + Source: to.Ptr("mySource"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/fileImports/DeleteFileImport.json +func ExampleFileImportsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewFileImportsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := client.BeginDelete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod index e546832e2d20..7474ea4574ae 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum index ed5b814680ee..8828b17b1853 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum @@ -1,11 +1,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentcomments_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentcomments_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go index 458c0ba87990..12e665f781a0 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentcomments_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -57,7 +58,7 @@ func NewIncidentCommentsClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Creates or updates the incident comment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -108,7 +109,7 @@ func (client *IncidentCommentsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, incidentComment) @@ -125,7 +126,7 @@ func (client *IncidentCommentsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Delete the incident comment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -174,7 +175,7 @@ func (client *IncidentCommentsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +183,7 @@ func (client *IncidentCommentsClient) deleteCreateRequest(ctx context.Context, r // Get - Gets an incident comment. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -231,7 +232,7 @@ func (client *IncidentCommentsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,8 +248,7 @@ func (client *IncidentCommentsClient) getHandleResponse(resp *http.Response) (In } // NewListPager - Gets all incident comments. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -305,7 +305,7 @@ func (client *IncidentCommentsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentcomments_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go similarity index 76% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentcomments_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go index 355b3cb95986..64a12c9830c7 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentcomments_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/comments/GetAllIncidentComments.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/comments/GetAllIncidentComments.json func ExampleIncidentCommentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,11 @@ func ExampleIncidentCommentsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - &armsecurityinsights.IncidentCommentsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.IncidentCommentsClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -48,7 +45,7 @@ func ExampleIncidentCommentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/comments/GetIncidentCommentById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/comments/GetIncidentCommentById.json func ExampleIncidentCommentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,12 +56,7 @@ func ExampleIncidentCommentsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -72,7 +64,7 @@ func ExampleIncidentCommentsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/comments/CreateIncidentComment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/comments/CreateIncidentComment.json func ExampleIncidentCommentsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,17 +75,11 @@ func ExampleIncidentCommentsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - armsecurityinsights.IncidentComment{ - Properties: &armsecurityinsights.IncidentCommentProperties{ - Message: to.Ptr("Some message"), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", armsecurityinsights.IncidentComment{ + Properties: &armsecurityinsights.IncidentCommentProperties{ + Message: to.Ptr("Some message"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +87,7 @@ func ExampleIncidentCommentsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/comments/DeleteIncidentComment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/comments/DeleteIncidentComment.json func ExampleIncidentCommentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,12 +98,7 @@ func ExampleIncidentCommentsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentrelations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentrelations_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go index 2ff16d6063a8..de86301b4536 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidentrelations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -57,7 +58,7 @@ func NewIncidentRelationsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates the incident relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -108,7 +109,7 @@ func (client *IncidentRelationsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, relation) @@ -125,7 +126,7 @@ func (client *IncidentRelationsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Delete the incident relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -175,7 +176,7 @@ func (client *IncidentRelationsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,7 +184,7 @@ func (client *IncidentRelationsClient) deleteCreateRequest(ctx context.Context, // Get - Gets an incident relation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -232,7 +233,7 @@ func (client *IncidentRelationsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,8 +249,7 @@ func (client *IncidentRelationsClient) getHandleResponse(resp *http.Response) (I } // NewListPager - Gets all incident relations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -306,7 +306,7 @@ func (client *IncidentRelationsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentrelations_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go similarity index 72% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentrelations_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go index ce6da0a4666b..197655dc4472 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidentrelations_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/relations/GetAllIncidentRelations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/relations/GetAllIncidentRelations.json func ExampleIncidentRelationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,14 +28,11 @@ func ExampleIncidentRelationsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - &armsecurityinsights.IncidentRelationsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", &armsecurityinsights.IncidentRelationsClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -48,7 +45,7 @@ func ExampleIncidentRelationsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/relations/GetIncidentRelationByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/relations/GetIncidentRelationByName.json func ExampleIncidentRelationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,12 +56,7 @@ func ExampleIncidentRelationsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -72,7 +64,7 @@ func ExampleIncidentRelationsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/relations/CreateIncidentRelation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/relations/CreateIncidentRelation.json func ExampleIncidentRelationsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,17 +75,11 @@ func ExampleIncidentRelationsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - armsecurityinsights.Relation{ - Properties: &armsecurityinsights.RelationProperties{ - RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", armsecurityinsights.Relation{ + Properties: &armsecurityinsights.RelationProperties{ + RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -101,7 +87,7 @@ func ExampleIncidentRelationsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/relations/DeleteIncidentRelation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/relations/DeleteIncidentRelation.json func ExampleIncidentRelationsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,12 +98,7 @@ func ExampleIncidentRelationsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidents_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidents_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go index 5d52d0914bbf..be3daad1d50b 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_incidents_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -57,7 +58,7 @@ func NewIncidentsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates the incident. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -103,7 +104,7 @@ func (client *IncidentsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, incident) @@ -120,7 +121,7 @@ func (client *IncidentsClient) createOrUpdateHandleResponse(resp *http.Response) // CreateTeam - Creates a Microsoft team to investigate the incident by sharing information and insights between participants. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -165,7 +166,7 @@ func (client *IncidentsClient) createTeamCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, teamProperties) @@ -182,7 +183,7 @@ func (client *IncidentsClient) createTeamHandleResponse(resp *http.Response) (In // Delete - Delete the incident. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -226,7 +227,7 @@ func (client *IncidentsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +235,7 @@ func (client *IncidentsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets an incident. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -278,7 +279,7 @@ func (client *IncidentsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -294,8 +295,7 @@ func (client *IncidentsClient) getHandleResponse(resp *http.Response) (Incidents } // NewListPager - Gets all incidents. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - IncidentsClientListOptions contains the optional parameters for the IncidentsClient.List method. @@ -347,7 +347,7 @@ func (client *IncidentsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -376,7 +376,7 @@ func (client *IncidentsClient) listHandleResponse(resp *http.Response) (Incident // ListAlerts - Gets all incident alerts. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -420,7 +420,7 @@ func (client *IncidentsClient) listAlertsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -437,7 +437,7 @@ func (client *IncidentsClient) listAlertsHandleResponse(resp *http.Response) (In // ListBookmarks - Gets all incident bookmarks. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -481,7 +481,7 @@ func (client *IncidentsClient) listBookmarksCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +498,7 @@ func (client *IncidentsClient) listBookmarksHandleResponse(resp *http.Response) // ListEntities - Gets all incident related entities. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // incidentID - Incident ID @@ -542,7 +542,7 @@ func (client *IncidentsClient) listEntitiesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -559,7 +559,7 @@ func (client *IncidentsClient) listEntitiesHandleResponse(resp *http.Response) ( // RunPlaybook - Triggers playbook on a specific incident // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - IncidentsClientRunPlaybookOptions contains the optional parameters for the IncidentsClient.RunPlaybook method. @@ -602,7 +602,7 @@ func (client *IncidentsClient) runPlaybookCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.RequestBody != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidents_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go similarity index 69% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidents_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go index 14b95b932d4a..c51eb046629a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_incidents_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go @@ -19,7 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/manualTrigger/Incidents_RunPlaybook.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/manualTrigger/Incidents_RunPlaybook.json func ExampleIncidentsClient_RunPlaybook() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,17 +30,13 @@ func ExampleIncidentsClient_RunPlaybook() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.RunPlaybook(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ar4", - &armsecurityinsights.IncidentsClientRunPlaybookOptions{RequestBody: nil}) + _, err = client.RunPlaybook(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ar4", &armsecurityinsights.IncidentsClientRunPlaybookOptions{RequestBody: nil}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/GetIncidents.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/GetIncidents.json func ExampleIncidentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -51,13 +47,11 @@ func ExampleIncidentsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.IncidentsClientListOptions{Filter: nil, - Orderby: to.Ptr("properties/createdTimeUtc desc"), - Top: to.Ptr[int32](1), - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.IncidentsClientListOptions{Filter: nil, + Orderby: to.Ptr("properties/createdTimeUtc desc"), + Top: to.Ptr[int32](1), + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -70,7 +64,7 @@ func ExampleIncidentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/GetIncidentById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/GetIncidentById.json func ExampleIncidentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,11 +75,7 @@ func ExampleIncidentsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -93,7 +83,7 @@ func ExampleIncidentsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/CreateIncident.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/CreateIncident.json func ExampleIncidentsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,28 +94,23 @@ func ExampleIncidentsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - armsecurityinsights.Incident{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.IncidentProperties{ - Description: to.Ptr("This is a demo incident"), - Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), - ClassificationComment: to.Ptr("Not a malicious activity"), - ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonIncorrectAlertLogic), - FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30Z"); return t }()), - LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30Z"); return t }()), - Owner: &armsecurityinsights.IncidentOwnerInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, - Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), - Title: to.Ptr("My incident"), + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.Incident{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.IncidentProperties{ + Description: to.Ptr("This is a demo incident"), + Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), + ClassificationComment: to.Ptr("Not a malicious activity"), + ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonIncorrectAlertLogic), + FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30Z"); return t }()), + LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30Z"); return t }()), + Owner: &armsecurityinsights.IncidentOwnerInfo{ + ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), }, + Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), + Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), + Title: to.Ptr("My incident"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -133,7 +118,7 @@ func ExampleIncidentsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/DeleteIncident.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/DeleteIncident.json func ExampleIncidentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,17 +129,13 @@ func ExampleIncidentsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/CreateTeam.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/CreateTeam.json func ExampleIncidentsClient_CreateTeam() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -165,15 +146,10 @@ func ExampleIncidentsClient_CreateTeam() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateTeam(ctx, - "ambawolvese5resourcegroup", - "AmbaE5WestCentralUS", - "69a30280-6a4c-4aa7-9af0-5d63f335d600", - armsecurityinsights.TeamProperties{ - TeamDescription: to.Ptr("Team description"), - TeamName: to.Ptr("Team name"), - }, - nil) + res, err := client.CreateTeam(ctx, "ambawolvese5resourcegroup", "AmbaE5WestCentralUS", "69a30280-6a4c-4aa7-9af0-5d63f335d600", armsecurityinsights.TeamProperties{ + TeamDescription: to.Ptr("Team description"), + TeamName: to.Ptr("Team name"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -181,7 +157,7 @@ func ExampleIncidentsClient_CreateTeam() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/GetAllIncidentAlerts.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/GetAllIncidentAlerts.json func ExampleIncidentsClient_ListAlerts() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -192,11 +168,7 @@ func ExampleIncidentsClient_ListAlerts() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListAlerts(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - nil) + res, err := client.ListAlerts(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -204,7 +176,7 @@ func ExampleIncidentsClient_ListAlerts() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/GetAllIncidentBookmarks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/GetAllIncidentBookmarks.json func ExampleIncidentsClient_ListBookmarks() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -215,11 +187,7 @@ func ExampleIncidentsClient_ListBookmarks() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListBookmarks(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - nil) + res, err := client.ListBookmarks(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -227,7 +195,7 @@ func ExampleIncidentsClient_ListBookmarks() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/incidents/entities/GetAllIncidentEntities.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/incidents/entities/GetAllIncidentEntities.json func ExampleIncidentsClient_ListEntities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -238,11 +206,7 @@ func ExampleIncidentsClient_ListEntities() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ListEntities(ctx, - "myRg", - "myWorkspace", - "afbd324f-6c48-459c-8710-8d1e1cd03812", - nil) + res, err := client.ListEntities(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_ipgeodata_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_ipgeodata_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client.go index 965c9716ec89..d184c69b321c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_ipgeodata_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewIPGeodataClient(subscriptionID string, credential azcore.TokenCredential // Get - Get geodata for a single IP address // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // ipAddress - IP address (v4 or v6) to be enriched // options - IPGeodataClientGetOptions contains the optional parameters for the IPGeodataClient.Get method. @@ -91,7 +92,7 @@ func (client *IPGeodataClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") reqQP.Set("ipAddress", ipAddress) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_ipgeodata_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client_example_test.go similarity index 90% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_ipgeodata_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client_example_test.go index b06584311c16..cf2b04bb098c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_ipgeodata_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/ipgeodata_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/enrichment/GetGeodataByIp.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/enrichment/GetGeodataByIp.json func ExampleIPGeodataClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleIPGeodataClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "1.2.3.4", - nil) + res, err := client.Get(ctx, "myRg", "1.2.3.4", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_metadata_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_metadata_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go index bcee62552034..5157dfc763f9 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_metadata_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -57,7 +58,7 @@ func NewMetadataClient(subscriptionID string, credential azcore.TokenCredential, // Create - Create a Metadata. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // metadataName - The Metadata name. @@ -102,7 +103,7 @@ func (client *MetadataClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, metadata) @@ -119,7 +120,7 @@ func (client *MetadataClient) createHandleResponse(resp *http.Response) (Metadat // Delete - Delete a Metadata. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // metadataName - The Metadata name. @@ -163,7 +164,7 @@ func (client *MetadataClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,7 +172,7 @@ func (client *MetadataClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a Metadata. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // metadataName - The Metadata name. @@ -215,7 +216,7 @@ func (client *MetadataClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,8 +232,7 @@ func (client *MetadataClient) getHandleResponse(resp *http.Response) (MetadataCl } // NewListPager - List of all metadata -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - MetadataClientListOptions contains the optional parameters for the MetadataClient.List method. @@ -284,7 +284,7 @@ func (client *MetadataClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -313,7 +313,7 @@ func (client *MetadataClient) listHandleResponse(resp *http.Response) (MetadataC // Update - Update an existing Metadata. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // metadataName - The Metadata name. @@ -358,7 +358,7 @@ func (client *MetadataClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, metadataPatch) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client_example_test.go new file mode 100644 index 000000000000..b2f59b3c516f --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client_example_test.go @@ -0,0 +1,261 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/GetAllMetadataOData.json +func ExampleMetadataClient_NewListPager_getAllMetadataWithODataFilterOrderbySkipTop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.MetadataClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + Skip: nil, + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/GetAllMetadata.json +func ExampleMetadataClient_NewListPager_getAllMetadata() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.MetadataClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + Skip: nil, + }) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/GetMetadata.json +func ExampleMetadataClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("2e1dc338-d04d-4443-b721-037eff4fdcac", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, "myRg", "myWorkspace", "metadataName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/DeleteMetadata.json +func ExampleMetadataClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, "myRg", "myWorkspace", "metadataName", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/PutMetadata.json +func ExampleMetadataClient_Create_createUpdateFullMetadata() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, "myRg", "myWorkspace", "metadataName", armsecurityinsights.MetadataModel{ + Properties: &armsecurityinsights.MetadataProperties{ + Author: &armsecurityinsights.MetadataAuthor{ + Name: to.Ptr("User Name"), + Email: to.Ptr("email@microsoft.com"), + }, + Categories: &armsecurityinsights.MetadataCategories{ + Domains: []*string{ + to.Ptr("Application"), + to.Ptr("Security – Insider Threat")}, + Verticals: []*string{ + to.Ptr("Healthcare")}, + }, + ContentID: to.Ptr("c00ee137-7475-47c8-9cce-ec6f0f1bedd0"), + ContentSchemaVersion: to.Ptr("2.0"), + CustomVersion: to.Ptr("1.0"), + Dependencies: &armsecurityinsights.MetadataDependencies{ + Criteria: []*armsecurityinsights.MetadataDependencies{ + { + Criteria: []*armsecurityinsights.MetadataDependencies{ + { + Name: to.Ptr("Microsoft Defender for Endpoint"), + ContentID: to.Ptr("045d06d0-ee72-4794-aba4-cf5646e4c756"), + Kind: to.Ptr(armsecurityinsights.KindDataConnector), + }, + { + ContentID: to.Ptr("dbfcb2cc-d782-40ef-8d94-fe7af58a6f2d"), + Kind: to.Ptr(armsecurityinsights.KindDataConnector), + }, + { + ContentID: to.Ptr("de4dca9b-eb37-47d6-a56f-b8b06b261593"), + Kind: to.Ptr(armsecurityinsights.KindDataConnector), + Version: to.Ptr("2.0"), + }}, + Operator: to.Ptr(armsecurityinsights.OperatorOR), + }, + { + ContentID: to.Ptr("31ee11cc-9989-4de8-b176-5e0ef5c4dbab"), + Kind: to.Ptr(armsecurityinsights.KindPlaybook), + Version: to.Ptr("1.0"), + }, + { + ContentID: to.Ptr("21ba424a-9438-4444-953a-7059539a7a1b"), + Kind: to.Ptr(armsecurityinsights.KindParser), + }}, + Operator: to.Ptr(armsecurityinsights.OperatorAND), + }, + FirstPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-05-18"); return t }()), + Kind: to.Ptr(armsecurityinsights.KindAnalyticsRule), + LastPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-05-18"); return t }()), + ParentID: to.Ptr("/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName"), + PreviewImages: []*string{ + to.Ptr("firstImage.png"), + to.Ptr("secondImage.jpeg")}, + PreviewImagesDark: []*string{ + to.Ptr("firstImageDark.png"), + to.Ptr("secondImageDark.jpeg")}, + Providers: []*string{ + to.Ptr("Amazon"), + to.Ptr("Microsoft")}, + Source: &armsecurityinsights.MetadataSource{ + Name: to.Ptr("Contoso Solution 1.0"), + Kind: to.Ptr(armsecurityinsights.SourceKindSolution), + SourceID: to.Ptr("b688a130-76f4-4a07-bf57-762222a3cadf"), + }, + Support: &armsecurityinsights.MetadataSupport{ + Name: to.Ptr("Microsoft"), + Email: to.Ptr("support@microsoft.com"), + Link: to.Ptr("https://support.microsoft.com/"), + Tier: to.Ptr(armsecurityinsights.SupportTierPartner), + }, + ThreatAnalysisTactics: []*string{ + to.Ptr("reconnaissance"), + to.Ptr("commandandcontrol")}, + ThreatAnalysisTechniques: []*string{ + to.Ptr("T1548"), + to.Ptr("T1548.001")}, + Version: to.Ptr("1.0.0.0"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/PutMetadataMinimal.json +func ExampleMetadataClient_Create_createUpdateMinimalMetadata() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, "myRg", "myWorkspace", "metadataName", armsecurityinsights.MetadataModel{ + Properties: &armsecurityinsights.MetadataProperties{ + ContentID: to.Ptr("c00ee137-7475-47c8-9cce-ec6f0f1bedd0"), + Kind: to.Ptr(armsecurityinsights.KindAnalyticsRule), + ParentID: to.Ptr("/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/metadata/PatchMetadata.json +func ExampleMetadataClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, "myRg", "myWorkspace", "metadataName", armsecurityinsights.MetadataPatch{ + Properties: &armsecurityinsights.MetadataPropertiesPatch{ + Author: &armsecurityinsights.MetadataAuthor{ + Name: to.Ptr("User Name"), + Email: to.Ptr("email@microsoft.com"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/models.go index 6cf39bbf320f..669b51845afe 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -299,12 +300,6 @@ type AccountEntityProperties struct { UpnSuffix *string `json:"upnSuffix,omitempty" azure:"ro"` } -// ActionPropertiesBase - Action property bag base. -type ActionPropertiesBase struct { - // REQUIRED; Logic App Resource Id, /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. - LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` -} - // ActionRequest - Action for alert rule. type ActionRequest struct { // Etag of the azure resource @@ -699,60 +694,6 @@ type AlertRuleTemplateDataSource struct { DataTypes []*string `json:"dataTypes,omitempty"` } -// AlertRuleTemplatePropertiesBase - Base alert rule template property bag. -type AlertRuleTemplatePropertiesBase struct { - // the number of alert rules that were created by this template - AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` - - // The description of the alert rule template. - Description *string `json:"description,omitempty"` - - // The display name for alert rule template. - DisplayName *string `json:"displayName,omitempty"` - - // The required data sources for this template - RequiredDataConnectors []*AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` - - // The alert rule template status. - Status *TemplateStatus `json:"status,omitempty"` - - // READ-ONLY; The time that this alert rule template has been added. - CreatedDateUTC *time.Time `json:"createdDateUTC,omitempty" azure:"ro"` - - // READ-ONLY; The last time that this alert rule template has been updated. - LastUpdatedDateUTC *time.Time `json:"lastUpdatedDateUTC,omitempty" azure:"ro"` -} - -// AlertRuleTemplateWithMitreProperties - Alert rule template with MITRE property bag. -type AlertRuleTemplateWithMitreProperties struct { - // the number of alert rules that were created by this template - AlertRulesCreatedByTemplateCount *int32 `json:"alertRulesCreatedByTemplateCount,omitempty"` - - // The description of the alert rule template. - Description *string `json:"description,omitempty"` - - // The display name for alert rule template. - DisplayName *string `json:"displayName,omitempty"` - - // The required data sources for this template - RequiredDataConnectors []*AlertRuleTemplateDataSource `json:"requiredDataConnectors,omitempty"` - - // The alert rule template status. - Status *TemplateStatus `json:"status,omitempty"` - - // The tactics of the alert rule - Tactics []*AttackTactic `json:"tactics,omitempty"` - - // The techniques of the alert rule - Techniques []*string `json:"techniques,omitempty"` - - // READ-ONLY; The time that this alert rule template has been added. - CreatedDateUTC *time.Time `json:"createdDateUTC,omitempty" azure:"ro"` - - // READ-ONLY; The last time that this alert rule template has been updated. - LastUpdatedDateUTC *time.Time `json:"lastUpdatedDateUTC,omitempty" azure:"ro"` -} - // AlertRuleTemplatesClientGetOptions contains the optional parameters for the AlertRuleTemplatesClient.Get method. type AlertRuleTemplatesClientGetOptions struct { // placeholder for future optional parameters @@ -1018,10 +959,16 @@ type AutomationRuleAction struct { // GetAutomationRuleAction implements the AutomationRuleActionClassification interface for type AutomationRuleAction. func (a *AutomationRuleAction) GetAutomationRuleAction() *AutomationRuleAction { return a } +type AutomationRuleBooleanCondition struct { + InnerConditions []AutomationRuleConditionClassification `json:"innerConditions,omitempty"` + Operator *AutomationRuleBooleanConditionSupportedOperator `json:"operator,omitempty"` +} + // AutomationRuleConditionClassification provides polymorphic access to related types. // Call the interface's GetAutomationRuleCondition() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AutomationRuleCondition, *PropertyArrayChangedConditionProperties, *PropertyChangedConditionProperties, *PropertyConditionProperties +// - *AutomationRuleCondition, *BooleanConditionProperties, *PropertyArrayChangedConditionProperties, *PropertyArrayConditionProperties, +// - *PropertyChangedConditionProperties, *PropertyConditionProperties type AutomationRuleConditionClassification interface { // GetAutomationRuleCondition returns the AutomationRuleCondition content of the underlying type. GetAutomationRuleCondition() *AutomationRuleCondition @@ -1086,6 +1033,12 @@ type AutomationRulePropertyArrayChangedValuesCondition struct { ChangeType *AutomationRulePropertyArrayChangedConditionSupportedChangeType `json:"changeType,omitempty"` } +type AutomationRulePropertyArrayValuesCondition struct { + ArrayConditionType *AutomationRulePropertyArrayConditionSupportedArrayConditionType `json:"arrayConditionType,omitempty"` + ArrayType *AutomationRulePropertyArrayConditionSupportedArrayType `json:"arrayType,omitempty"` + ItemConditions []AutomationRuleConditionClassification `json:"itemConditions,omitempty"` +} + type AutomationRulePropertyValuesChangedCondition struct { ChangeType *AutomationRulePropertyChangedConditionSupportedChangedType `json:"changeType,omitempty"` Operator *AutomationRulePropertyConditionSupportedOperator `json:"operator,omitempty"` @@ -1588,6 +1541,20 @@ type BookmarksClientListOptions struct { // placeholder for future optional parameters } +// BooleanConditionProperties - Describes an automation rule condition that applies a boolean operator (e.g AND, OR) to conditions +type BooleanConditionProperties struct { + // REQUIRED + ConditionType *ConditionType `json:"conditionType,omitempty"` + ConditionProperties *AutomationRuleBooleanCondition `json:"conditionProperties,omitempty"` +} + +// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type BooleanConditionProperties. +func (b *BooleanConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { + return &AutomationRuleCondition{ + ConditionType: b.ConditionType, + } +} + // ClientInfo - Information on the client (user or application) that made some action type ClientInfo struct { // The email of the client. @@ -1655,21 +1622,6 @@ type CloudApplicationEntityProperties struct { InstanceName *string `json:"instanceName,omitempty" azure:"ro"` } -// CloudError - Error response structure. -type CloudError struct { - // Error data - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - Error details. -type CloudErrorBody struct { - // READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty" azure:"ro"` -} - // CodelessAPIPollingDataConnector - Represents Codeless API Polling data connector. type CodelessAPIPollingDataConnector struct { // REQUIRED; The data connector kind @@ -1987,24 +1939,6 @@ type ConnectedEntity struct { TargetEntityID *string `json:"targetEntityId,omitempty"` } -// ConnectivityCriteria - Setting for the connector check connectivity -type ConnectivityCriteria struct { - // type of connectivity - Type *ConnectivityType `json:"type,omitempty"` - - // Queries for checking connectivity - Value []*string `json:"value,omitempty"` -} - -// ConnectorInstructionModelBase - Instruction step details -type ConnectorInstructionModelBase struct { - // REQUIRED; The kind of the setting - Type *SettingType `json:"type,omitempty"` - - // The parameters for the setting - Parameters interface{} `json:"parameters,omitempty"` -} - // ContentPathMap - The mapping of content type to a repo path. type ContentPathMap struct { // Content type. @@ -2047,24 +1981,6 @@ type CustomEntityQuery struct { // GetCustomEntityQuery implements the CustomEntityQueryClassification interface for type CustomEntityQuery. func (c *CustomEntityQuery) GetCustomEntityQuery() *CustomEntityQuery { return c } -// Customs permissions required for the connector -type Customs struct { - // Customs permissions description - Description *string `json:"description,omitempty"` - - // Customs permissions name - Name *string `json:"name,omitempty"` -} - -// CustomsPermission - Customs permissions required for the connector -type CustomsPermission struct { - // Customs permissions description - Description *string `json:"description,omitempty"` - - // Customs permissions name - Name *string `json:"name,omitempty"` -} - // DNSEntity - Represents a dns entity. type DNSEntity struct { // REQUIRED; The kind of the entity. @@ -2169,9 +2085,19 @@ type DataConnectorConnectBody struct { // The client secret of the OAuth 2.0 application. ClientSecret *string `json:"clientSecret,omitempty"` + // Used in v2 logs connector. Represents the data collection ingestion endpoint in log analytics. + DataCollectionEndpoint *string `json:"dataCollectionEndpoint,omitempty"` + + // Used in v2 logs connector. The data collection rule immutable id, the rule defines the transformation and data destination. + DataCollectionRuleImmutableID *string `json:"dataCollectionRuleImmutableId,omitempty"` + // The authentication kind used to poll the data Kind *ConnectAuthKind `json:"kind,omitempty"` + // Used in v2 logs connector. The stream we are sending the data to, this is the name of the streamDeclarations defined in + // the DCR. + OutputStream *string `json:"outputStream,omitempty"` + // The user password in the audit log server. Password *string `json:"password,omitempty"` RequestConfigUserInputValues []interface{} `json:"requestConfigUserInputValues,omitempty"` @@ -2204,18 +2130,6 @@ type DataConnectorRequirementsState struct { LicenseState *DataConnectorLicenseState `json:"licenseState,omitempty"` } -// DataConnectorTenantID - Properties data connector on tenant level. -type DataConnectorTenantID struct { - // REQUIRED; The tenant id to connect to, and get the data from. - TenantID *string `json:"tenantId,omitempty"` -} - -// DataConnectorWithAlertsProperties - Data connector properties. -type DataConnectorWithAlertsProperties struct { - // The available data types for the connector. - DataTypes *AlertsDataTypeOfDataConnector `json:"dataTypes,omitempty"` -} - // DataConnectorsCheckRequirementsClassification provides polymorphic access to related types. // Call the interface's GetDataConnectorsCheckRequirements() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2604,7 +2518,7 @@ type EntitiesRelationsClientListOptions struct { // Use a type switch to determine the concrete type. The possible types are: // - *AccountEntity, *AzureResourceEntity, *CloudApplicationEntity, *DNSEntity, *Entity, *FileEntity, *FileHashEntity, *HostEntity, // - *HuntingBookmark, *IPEntity, *IoTDeviceEntity, *MailClusterEntity, *MailMessageEntity, *MailboxEntity, *MalwareEntity, -// - *ProcessEntity, *RegistryKeyEntity, *RegistryValueEntity, *SecurityAlert, *SecurityGroupEntity, *SubmissionMailEntity, +// - *NicEntity, *ProcessEntity, *RegistryKeyEntity, *RegistryValueEntity, *SecurityAlert, *SecurityGroupEntity, *SubmissionMailEntity, // - *URLEntity type EntityClassification interface { // GetEntity returns the Entity content of the underlying type. @@ -2674,16 +2588,6 @@ type EntityAnalyticsProperties struct { EntityProviders []*EntityProviders `json:"entityProviders,omitempty"` } -// EntityCommonProperties - Entity common property bag. -type EntityCommonProperties struct { - // READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. - AdditionalData map[string]interface{} `json:"additionalData,omitempty" azure:"ro"` - - // READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property - // is optional and might be system generated. - FriendlyName *string `json:"friendlyName,omitempty" azure:"ro"` -} - // EntityEdges - The edge that connects the entity to the other entity. type EntityEdges struct { // A bag of custom fields that should be part of the entity and will be presented to the user. @@ -2879,21 +2783,6 @@ type EntityQueryItem struct { // GetEntityQueryItem implements the EntityQueryItemClassification interface for type EntityQueryItem. func (e *EntityQueryItem) GetEntityQueryItem() *EntityQueryItem { return e } -// EntityQueryItemProperties - An properties abstract Query item for entity -type EntityQueryItemProperties struct { - // Data types for template - DataTypes []*EntityQueryItemPropertiesDataTypesItem `json:"dataTypes,omitempty"` - - // The query applied only to entities matching to all filters - EntitiesFilter interface{} `json:"entitiesFilter,omitempty"` - - // The type of the entity - InputEntityType *EntityType `json:"inputEntityType,omitempty"` - - // Data types for template - RequiredInputFieldsSets [][]*string `json:"requiredInputFieldsSets,omitempty"` -} - type EntityQueryItemPropertiesDataTypesItem struct { // Data type name DataType *string `json:"dataType,omitempty"` @@ -3242,6 +3131,123 @@ type FileHashEntityProperties struct { HashValue *string `json:"hashValue,omitempty" azure:"ro"` } +// FileImport - Represents a file import in Azure Security Insights. +type FileImport struct { + // File import properties + Properties *FileImportProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FileImportList - List all the file imports. +type FileImportList struct { + // REQUIRED; Array of file imports. + Value []*FileImport `json:"value,omitempty"` + + // READ-ONLY; URL to fetch the next set of file imports. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// FileImportProperties - Describes the FileImport's properties +type FileImportProperties struct { + // REQUIRED; The content type of this file. + ContentType *FileImportContentType `json:"contentType,omitempty"` + + // REQUIRED; Represents the imported file. + ImportFile *FileMetadata `json:"importFile,omitempty"` + + // REQUIRED; Describes how to ingest the records in the file. + IngestionMode *IngestionMode `json:"ingestionMode,omitempty"` + + // REQUIRED; The source for the data in the file. + Source *string `json:"source,omitempty"` + + // READ-ONLY; The time the file was imported. + CreatedTimeUTC *time.Time `json:"createdTimeUTC,omitempty" azure:"ro"` + + // READ-ONLY; Represents the error file (if the import was ingested with errors or failed the validation). + ErrorFile *FileMetadata `json:"errorFile,omitempty" azure:"ro"` + + // READ-ONLY; An ordered list of some of the errors that were encountered during validation. + ErrorsPreview []*ValidationError `json:"errorsPreview,omitempty" azure:"ro"` + + // READ-ONLY; The time the files associated with this import are deleted from the storage account. + FilesValidUntilTimeUTC *time.Time `json:"filesValidUntilTimeUTC,omitempty" azure:"ro"` + + // READ-ONLY; The time the file import record is soft deleted from the database and history. + ImportValidUntilTimeUTC *time.Time `json:"importValidUntilTimeUTC,omitempty" azure:"ro"` + + // READ-ONLY; The number of records that have been successfully ingested. + IngestedRecordCount *int32 `json:"ingestedRecordCount,omitempty" azure:"ro"` + + // READ-ONLY; The state of the file import. + State *FileImportState `json:"state,omitempty" azure:"ro"` + + // READ-ONLY; The number of records in the file. + TotalRecordCount *int32 `json:"totalRecordCount,omitempty" azure:"ro"` + + // READ-ONLY; The number of records that have passed validation. + ValidRecordCount *int32 `json:"validRecordCount,omitempty" azure:"ro"` +} + +// FileImportsClientBeginDeleteOptions contains the optional parameters for the FileImportsClient.BeginDelete method. +type FileImportsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FileImportsClientCreateOptions contains the optional parameters for the FileImportsClient.Create method. +type FileImportsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FileImportsClientGetOptions contains the optional parameters for the FileImportsClient.Get method. +type FileImportsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FileImportsClientListOptions contains the optional parameters for the FileImportsClient.List method. +type FileImportsClientListOptions struct { + // Filters the results, based on a Boolean condition. Optional. + Filter *string + // Sorts the results. Optional. + Orderby *string + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. Optional. + SkipToken *string + // Returns only the first n results. Optional. + Top *int32 +} + +// FileMetadata - Represents a file. +type FileMetadata struct { + // The format of the file + FileFormat *FileFormat `json:"fileFormat,omitempty"` + + // The name of the file. + FileName *string `json:"fileName,omitempty"` + + // The size of the file. + FileSize *int32 `json:"fileSize,omitempty"` + + // READ-ONLY; Indicates whether the file was deleted from the storage account. + DeleteStatus *DeleteStatus `json:"deleteStatus,omitempty" azure:"ro"` + + // READ-ONLY; A URI with a valid SAS token to allow uploading / downloading the file. + FileContentURI *string `json:"fileContentUri,omitempty" azure:"ro"` +} + // FusionAlertRule - Represents Fusion alert rule. type FusionAlertRule struct { // REQUIRED; The kind of the alert rule @@ -3526,18 +3532,6 @@ type GitHubResourceInfo struct { AppInstallationID *string `json:"appInstallationId,omitempty"` } -// GraphQueries - The graph query to show the current data status -type GraphQueries struct { - // The base query for the graph - BaseQuery *string `json:"baseQuery,omitempty"` - - // The legend for the graph - Legend *string `json:"legend,omitempty"` - - // the metric that the query is checking - MetricName *string `json:"metricName,omitempty"` -} - // GroupingConfiguration - Grouping configuration property bag. type GroupingConfiguration struct { // REQUIRED; Grouping enabled @@ -4296,18 +4290,6 @@ type InsightsTableResultColumnsItem struct { Type *string `json:"type,omitempty"` } -// InstructionSteps - Instruction steps to enable the connector -type InstructionSteps struct { - // Instruction step description - Description *string `json:"description,omitempty"` - - // Instruction step details - Instructions []*InstructionStepsInstructionsItem `json:"instructions,omitempty"` - - // Instruction step title - Title *string `json:"title,omitempty"` -} - type InstructionStepsInstructionsItem struct { // REQUIRED; The kind of the setting Type *SettingType `json:"type,omitempty"` @@ -4417,6 +4399,9 @@ func (i *IoTDeviceEntity) GetEntity() *Entity { // IoTDeviceEntityProperties - IoTDevice entity property bag. type IoTDeviceEntityProperties struct { + // Device importance, determines if the device classified as 'crown jewel' + Importance *DeviceImportance `json:"importance,omitempty"` + // READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. AdditionalData map[string]interface{} `json:"additionalData,omitempty" azure:"ro"` @@ -4426,6 +4411,9 @@ type IoTDeviceEntityProperties struct { // READ-ONLY; The friendly name of the device DeviceName *string `json:"deviceName,omitempty" azure:"ro"` + // READ-ONLY; The subType of the device ('PLC', 'HMI', 'EWS', etc.) + DeviceSubType *string `json:"deviceSubType,omitempty" azure:"ro"` + // READ-ONLY; The type of the device DeviceType *string `json:"deviceType,omitempty" azure:"ro"` @@ -4451,21 +4439,45 @@ type IoTDeviceEntityProperties struct { // READ-ONLY; The ID of the security agent running on the device IotSecurityAgentID *string `json:"iotSecurityAgentId,omitempty" azure:"ro"` + // READ-ONLY; Determines whether the device classified as authorized device + IsAuthorized *bool `json:"isAuthorized,omitempty" azure:"ro"` + + // READ-ONLY; Determines whether the device classified as programming device + IsProgramming *bool `json:"isProgramming,omitempty" azure:"ro"` + + // READ-ONLY; Is the device classified as a scanner device + IsScanner *bool `json:"isScanner,omitempty" azure:"ro"` + // READ-ONLY; The MAC address of the device MacAddress *string `json:"macAddress,omitempty" azure:"ro"` // READ-ONLY; The model of the device Model *string `json:"model,omitempty" azure:"ro"` + // READ-ONLY; A list of Nic entity ids of the IoTDevice entity. + NicEntityIDs []*string `json:"nicEntityIds,omitempty" azure:"ro"` + // READ-ONLY; The operating system of the device OperatingSystem *string `json:"operatingSystem,omitempty" azure:"ro"` + // READ-ONLY; A list of owners of the IoTDevice entity. + Owners []*string `json:"owners,omitempty" azure:"ro"` + // READ-ONLY; A list of protocols of the IoTDevice entity. Protocols []*string `json:"protocols,omitempty" azure:"ro"` + // READ-ONLY; The Purdue Layer of the device + PurdueLayer *string `json:"purdueLayer,omitempty" azure:"ro"` + + // READ-ONLY; The sensor the device is monitored by + Sensor *string `json:"sensor,omitempty" azure:"ro"` + // READ-ONLY; The serial number of the device SerialNumber *string `json:"serialNumber,omitempty" azure:"ro"` + // READ-ONLY; The site of the device + Site *string `json:"site,omitempty" azure:"ro"` + // READ-ONLY; The source of the device Source *string `json:"source,omitempty" azure:"ro"` @@ -4474,15 +4486,9 @@ type IoTDeviceEntityProperties struct { // READ-ONLY; The vendor of the device Vendor *string `json:"vendor,omitempty" azure:"ro"` -} - -// LastDataReceivedDataType - Data type for last data received -type LastDataReceivedDataType struct { - // Query for indicate last data received - LastDataReceivedQuery *string `json:"lastDataReceivedQuery,omitempty"` - // Name of the data type to show in the graph. can be use with {{graphQueriesTableName}} placeholder - Name *string `json:"name,omitempty"` + // READ-ONLY; The zone location of the device within a site + Zone *string `json:"zone,omitempty" azure:"ro"` } // MCASCheckRequirements - Represents MCAS (Microsoft Cloud App Security) requirements check request. @@ -5228,6 +5234,7 @@ type MalwareEntityProperties struct { } type ManualTriggerRequestBody struct { + // REQUIRED LogicAppsResourceID *string `json:"logicAppsResourceId,omitempty"` TenantID *string `json:"tenantId,omitempty"` } @@ -5559,21 +5566,6 @@ func (m *MicrosoftSecurityIncidentCreationAlertRule) GetAlertRule() *AlertRule { } } -// MicrosoftSecurityIncidentCreationAlertRuleCommonProperties - MicrosoftSecurityIncidentCreation rule common property bag. -type MicrosoftSecurityIncidentCreationAlertRuleCommonProperties struct { - // REQUIRED; The alerts' productName on which the cases will be generated - ProductFilter *MicrosoftSecurityProductName `json:"productFilter,omitempty"` - - // the alerts' displayNames on which the cases will not be generated - DisplayNamesExcludeFilter []*string `json:"displayNamesExcludeFilter,omitempty"` - - // the alerts' displayNames on which the cases will be generated - DisplayNamesFilter []*string `json:"displayNamesFilter,omitempty"` - - // the alerts' severities on which the cases will be generated - SeveritiesFilter []*AlertSeverity `json:"severitiesFilter,omitempty"` -} - // MicrosoftSecurityIncidentCreationAlertRuleProperties - MicrosoftSecurityIncidentCreation rule property bag. type MicrosoftSecurityIncidentCreationAlertRuleProperties struct { // REQUIRED; The display name for alerts created by this alert rule. @@ -5688,6 +5680,57 @@ func (m *MtpCheckRequirements) GetDataConnectorsCheckRequirements() *DataConnect } } +// NicEntity - Represents an network interface entity. +type NicEntity struct { + // REQUIRED; The kind of the entity. + Kind *EntityKind `json:"kind,omitempty"` + + // Network interface entity properties + Properties *NicEntityProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GetEntity implements the EntityClassification interface for type NicEntity. +func (n *NicEntity) GetEntity() *Entity { + return &Entity{ + Kind: n.Kind, + ID: n.ID, + Name: n.Name, + Type: n.Type, + SystemData: n.SystemData, + } +} + +// NicEntityProperties - Nic entity property bag. +type NicEntityProperties struct { + // READ-ONLY; A bag of custom fields that should be part of the entity and will be presented to the user. + AdditionalData map[string]interface{} `json:"additionalData,omitempty" azure:"ro"` + + // READ-ONLY; The graph item display name which is a short humanly readable description of the graph item instance. This property + // is optional and might be system generated. + FriendlyName *string `json:"friendlyName,omitempty" azure:"ro"` + + // READ-ONLY; The IP entity id of this network interface + IPAddressEntityID *string `json:"ipAddressEntityId,omitempty" azure:"ro"` + + // READ-ONLY; The MAC address of this network interface + MacAddress *string `json:"macAddress,omitempty" azure:"ro"` + + // READ-ONLY; A list of VLANs of the network interface entity. + Vlans []*string `json:"vlans,omitempty" azure:"ro"` +} + // NrtAlertRule - Represents NRT alert rule. type NrtAlertRule struct { // REQUIRED; The kind of the alert rule @@ -5759,6 +5802,9 @@ type NrtAlertRuleProperties struct { // Array of the entity mappings of the alert rule EntityMappings []*EntityMapping `json:"entityMappings,omitempty"` + // The event grouping settings. + EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` + // The settings of the incidents that created from alerts triggered by this analytics rule IncidentConfiguration *IncidentConfiguration `json:"incidentConfiguration,omitempty"` @@ -5827,6 +5873,9 @@ type NrtAlertRuleTemplateProperties struct { // Array of the entity mappings of the alert rule EntityMappings []*EntityMapping `json:"entityMappings,omitempty"` + // The event grouping settings. + EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` + // The query that creates alerts for this rule. Query *string `json:"query,omitempty"` @@ -6463,6 +6512,20 @@ func (p *PropertyArrayChangedConditionProperties) GetAutomationRuleCondition() * } } +// PropertyArrayConditionProperties - Describes an automation rule condition that evaluates an array property's value +type PropertyArrayConditionProperties struct { + // REQUIRED + ConditionType *ConditionType `json:"conditionType,omitempty"` + ConditionProperties *AutomationRulePropertyArrayValuesCondition `json:"conditionProperties,omitempty"` +} + +// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type PropertyArrayConditionProperties. +func (p *PropertyArrayConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { + return &AutomationRuleCondition{ + ConditionType: p.ConditionType, + } +} + // PropertyChangedConditionProperties - Describes an automation rule condition that evaluates a property's value change type PropertyChangedConditionProperties struct { // REQUIRED @@ -6491,27 +6554,6 @@ func (p *PropertyConditionProperties) GetAutomationRuleCondition() *AutomationRu } } -// QueryBasedAlertRuleTemplateProperties - Query based alert rule template base property bag. -type QueryBasedAlertRuleTemplateProperties struct { - // The alert details override settings - AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` - - // Dictionary of string key-value pairs of columns to be attached to the alert - CustomDetails map[string]*string `json:"customDetails,omitempty"` - - // Array of the entity mappings of the alert rule - EntityMappings []*EntityMapping `json:"entityMappings,omitempty"` - - // The query that creates alerts for this rule. - Query *string `json:"query,omitempty"` - - // The severity for alerts created by this alert rule. - Severity *AlertSeverity `json:"severity,omitempty"` - - // The version of this template - in format , where all are numbers. For example . - Version *string `json:"version,omitempty"` -} - // RegistryKeyEntity - Represents a registry key entity. type RegistryKeyEntity struct { // REQUIRED; The kind of the entity. @@ -6726,66 +6768,6 @@ type RequiredPermissions struct { Write *bool `json:"write,omitempty"` } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ResourceProvider - Resource provider permissions required for the connector -type ResourceProvider struct { - // Permission description text - PermissionsDisplayText *string `json:"permissionsDisplayText,omitempty"` - - // Provider name - Provider *ProviderName `json:"provider,omitempty"` - - // Permission provider display name - ProviderDisplayName *string `json:"providerDisplayName,omitempty"` - - // Required permissions for the connector - RequiredPermissions *RequiredPermissions `json:"requiredPermissions,omitempty"` - - // Permission provider scope - Scope *PermissionProviderScope `json:"scope,omitempty"` -} - -// ResourceWithEtag - An azure resource object with an Etag property -type ResourceWithEtag struct { - // Etag of the azure resource - Etag *string `json:"etag,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// SampleQueries - The sample queries for the connector -type SampleQueries struct { - // The sample query description - Description *string `json:"description,omitempty"` - - // the sample query - Query *string `json:"query,omitempty"` -} - // ScheduledAlertRule - Represents scheduled alert rule. type ScheduledAlertRule struct { // REQUIRED; The kind of the alert rule @@ -6822,39 +6804,6 @@ func (s *ScheduledAlertRule) GetAlertRule() *AlertRule { } } -// ScheduledAlertRuleCommonProperties - Scheduled alert rule template property bag. -type ScheduledAlertRuleCommonProperties struct { - // The alert details override settings - AlertDetailsOverride *AlertDetailsOverride `json:"alertDetailsOverride,omitempty"` - - // Dictionary of string key-value pairs of columns to be attached to the alert - CustomDetails map[string]*string `json:"customDetails,omitempty"` - - // Array of the entity mappings of the alert rule - EntityMappings []*EntityMapping `json:"entityMappings,omitempty"` - - // The event grouping settings. - EventGroupingSettings *EventGroupingSettings `json:"eventGroupingSettings,omitempty"` - - // The query that creates alerts for this rule. - Query *string `json:"query,omitempty"` - - // The frequency (in ISO 8601 duration format) for this alert rule to run. - QueryFrequency *string `json:"queryFrequency,omitempty"` - - // The period (in ISO 8601 duration format) that this alert rule looks at. - QueryPeriod *string `json:"queryPeriod,omitempty"` - - // The severity for alerts created by this alert rule. - Severity *AlertSeverity `json:"severity,omitempty"` - - // The operation against the threshold that triggers alert rule. - TriggerOperator *TriggerOperator `json:"triggerOperator,omitempty"` - - // The threshold triggers this alert rule. - TriggerThreshold *int32 `json:"triggerThreshold,omitempty"` -} - // ScheduledAlertRuleProperties - Scheduled alert rule base property bag. type ScheduledAlertRuleProperties struct { // REQUIRED; The display name for alerts created by this alert rule. @@ -8472,6 +8421,15 @@ type UserInfo struct { Name *string `json:"name,omitempty" azure:"ro"` } +// ValidationError - Describes an error encountered in the file during validation. +type ValidationError struct { + // The number of the record that has the error. + RecordIndex *int32 `json:"recordIndex,omitempty"` + + // READ-ONLY; A list of descriptions of the error. + ErrorMessages []*string `json:"errorMessages,omitempty" azure:"ro"` +} + // Watchlist - Represents a Watchlist in Azure Security Insights. type Watchlist struct { // Etag of the azure resource diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go new file mode 100644 index 000000000000..9903e0c8d231 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go @@ -0,0 +1,16761 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armsecurityinsights + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AADCheckRequirements. +func (a AADCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindAzureActiveDirectory + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADCheckRequirements. +func (a *AADCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AADCheckRequirementsProperties. +func (a AADCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADCheckRequirementsProperties. +func (a *AADCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AADDataConnector. +func (a AADDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = DataConnectorKindAzureActiveDirectory + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADDataConnector. +func (a *AADDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AADDataConnectorProperties. +func (a AADDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADDataConnectorProperties. +func (a *AADDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AATPCheckRequirements. +func (a AATPCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindAzureAdvancedThreatProtection + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AATPCheckRequirements. +func (a *AATPCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AATPCheckRequirementsProperties. +func (a AATPCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AATPCheckRequirementsProperties. +func (a *AATPCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AATPDataConnector. +func (a AATPDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = DataConnectorKindAzureAdvancedThreatProtection + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AATPDataConnector. +func (a *AATPDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AATPDataConnectorProperties. +func (a AATPDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AATPDataConnectorProperties. +func (a *AATPDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIPollingParameters. +func (a APIPollingParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectorUiConfig", a.ConnectorUIConfig) + populate(objectMap, "pollingConfig", a.PollingConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIPollingParameters. +func (a *APIPollingParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectorUiConfig": + err = unpopulate(val, "ConnectorUIConfig", &a.ConnectorUIConfig) + delete(rawMsg, key) + case "pollingConfig": + err = unpopulate(val, "PollingConfig", &a.PollingConfig) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ASCCheckRequirements. +func (a ASCCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindAzureSecurityCenter + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ASCCheckRequirements. +func (a *ASCCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ASCCheckRequirementsProperties. +func (a ASCCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptionId", a.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ASCCheckRequirementsProperties. +func (a *ASCCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ASCDataConnector. +func (a ASCDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = DataConnectorKindAzureSecurityCenter + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ASCDataConnector. +func (a *ASCDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ASCDataConnectorProperties. +func (a ASCDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "subscriptionId", a.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ASCDataConnectorProperties. +func (a *ASCDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountEntity. +func (a AccountEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EntityKindAccount + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountEntity. +func (a *AccountEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountEntityProperties. +func (a AccountEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadTenantId", a.AADTenantID) + populate(objectMap, "aadUserId", a.AADUserID) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "dnsDomain", a.DNSDomain) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "hostEntityId", a.HostEntityID) + populate(objectMap, "isDomainJoined", a.IsDomainJoined) + populate(objectMap, "ntDomain", a.NtDomain) + populate(objectMap, "objectGuid", a.ObjectGUID) + populate(objectMap, "puid", a.Puid) + populate(objectMap, "sid", a.Sid) + populate(objectMap, "upnSuffix", a.UpnSuffix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountEntityProperties. +func (a *AccountEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadTenantId": + err = unpopulate(val, "AADTenantID", &a.AADTenantID) + delete(rawMsg, key) + case "aadUserId": + err = unpopulate(val, "AADUserID", &a.AADUserID) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, "AccountName", &a.AccountName) + delete(rawMsg, key) + case "additionalData": + err = unpopulate(val, "AdditionalData", &a.AdditionalData) + delete(rawMsg, key) + case "dnsDomain": + err = unpopulate(val, "DNSDomain", &a.DNSDomain) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) + delete(rawMsg, key) + case "hostEntityId": + err = unpopulate(val, "HostEntityID", &a.HostEntityID) + delete(rawMsg, key) + case "isDomainJoined": + err = unpopulate(val, "IsDomainJoined", &a.IsDomainJoined) + delete(rawMsg, key) + case "ntDomain": + err = unpopulate(val, "NtDomain", &a.NtDomain) + delete(rawMsg, key) + case "objectGuid": + err = unpopulate(val, "ObjectGUID", &a.ObjectGUID) + delete(rawMsg, key) + case "puid": + err = unpopulate(val, "Puid", &a.Puid) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &a.Sid) + delete(rawMsg, key) + case "upnSuffix": + err = unpopulate(val, "UpnSuffix", &a.UpnSuffix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionRequest. +func (a ActionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionRequest. +func (a *ActionRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionRequestProperties. +func (a ActionRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logicAppResourceId", a.LogicAppResourceID) + populate(objectMap, "triggerUri", a.TriggerURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionRequestProperties. +func (a *ActionRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &a.LogicAppResourceID) + delete(rawMsg, key) + case "triggerUri": + err = unpopulate(val, "TriggerURI", &a.TriggerURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionResponse. +func (a ActionResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionResponse. +func (a *ActionResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionResponseProperties. +func (a ActionResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logicAppResourceId", a.LogicAppResourceID) + populate(objectMap, "workflowId", a.WorkflowID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionResponseProperties. +func (a *ActionResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &a.LogicAppResourceID) + delete(rawMsg, key) + case "workflowId": + err = unpopulate(val, "WorkflowID", &a.WorkflowID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionsList. +func (a ActionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionsList. +func (a *ActionsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityCustomEntityQuery. +func (a ActivityCustomEntityQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = CustomEntityQueryKindActivity + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityCustomEntityQuery. +func (a *ActivityCustomEntityQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueriesProperties. +func (a ActivityEntityQueriesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", a.Content) + populateTimeRFC3339(objectMap, "createdTimeUtc", a.CreatedTimeUTC) + populate(objectMap, "description", a.Description) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "entitiesFilter", a.EntitiesFilter) + populate(objectMap, "inputEntityType", a.InputEntityType) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", a.LastModifiedTimeUTC) + populate(objectMap, "queryDefinitions", a.QueryDefinitions) + populate(objectMap, "requiredInputFieldsSets", a.RequiredInputFieldsSets) + populate(objectMap, "templateName", a.TemplateName) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueriesProperties. +func (a *ActivityEntityQueriesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "createdTimeUtc": + err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &a.CreatedTimeUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "entitiesFilter": + err = unpopulate(val, "EntitiesFilter", &a.EntitiesFilter) + delete(rawMsg, key) + case "inputEntityType": + err = unpopulate(val, "InputEntityType", &a.InputEntityType) + delete(rawMsg, key) + case "lastModifiedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &a.LastModifiedTimeUTC) + delete(rawMsg, key) + case "queryDefinitions": + err = unpopulate(val, "QueryDefinitions", &a.QueryDefinitions) + delete(rawMsg, key) + case "requiredInputFieldsSets": + err = unpopulate(val, "RequiredInputFieldsSets", &a.RequiredInputFieldsSets) + delete(rawMsg, key) + case "templateName": + err = unpopulate(val, "TemplateName", &a.TemplateName) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueriesPropertiesQueryDefinitions. +func (a ActivityEntityQueriesPropertiesQueryDefinitions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "query", a.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueriesPropertiesQueryDefinitions. +func (a *ActivityEntityQueriesPropertiesQueryDefinitions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "query": + err = unpopulate(val, "Query", &a.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQuery. +func (a ActivityEntityQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EntityQueryKindActivity + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQuery. +func (a *ActivityEntityQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueryTemplate. +func (a ActivityEntityQueryTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EntityQueryTemplateKindActivity + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueryTemplate. +func (a *ActivityEntityQueryTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueryTemplateProperties. +func (a ActivityEntityQueryTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", a.Content) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "description", a.Description) + populate(objectMap, "entitiesFilter", a.EntitiesFilter) + populate(objectMap, "inputEntityType", a.InputEntityType) + populate(objectMap, "queryDefinitions", a.QueryDefinitions) + populate(objectMap, "requiredInputFieldsSets", a.RequiredInputFieldsSets) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueryTemplateProperties. +func (a *ActivityEntityQueryTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "entitiesFilter": + err = unpopulate(val, "EntitiesFilter", &a.EntitiesFilter) + delete(rawMsg, key) + case "inputEntityType": + err = unpopulate(val, "InputEntityType", &a.InputEntityType) + delete(rawMsg, key) + case "queryDefinitions": + err = unpopulate(val, "QueryDefinitions", &a.QueryDefinitions) + delete(rawMsg, key) + case "requiredInputFieldsSets": + err = unpopulate(val, "RequiredInputFieldsSets", &a.RequiredInputFieldsSets) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueryTemplatePropertiesQueryDefinitions. +func (a ActivityEntityQueryTemplatePropertiesQueryDefinitions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "query", a.Query) + populate(objectMap, "summarizeBy", a.SummarizeBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueryTemplatePropertiesQueryDefinitions. +func (a *ActivityEntityQueryTemplatePropertiesQueryDefinitions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "query": + err = unpopulate(val, "Query", &a.Query) + delete(rawMsg, key) + case "summarizeBy": + err = unpopulate(val, "SummarizeBy", &a.SummarizeBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityTimelineItem. +func (a ActivityTimelineItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "bucketEndTimeUTC", a.BucketEndTimeUTC) + populateTimeRFC3339(objectMap, "bucketStartTimeUTC", a.BucketStartTimeUTC) + populate(objectMap, "content", a.Content) + populateTimeRFC3339(objectMap, "firstActivityTimeUTC", a.FirstActivityTimeUTC) + objectMap["kind"] = EntityTimelineKindActivity + populateTimeRFC3339(objectMap, "lastActivityTimeUTC", a.LastActivityTimeUTC) + populate(objectMap, "queryId", a.QueryID) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityTimelineItem. +func (a *ActivityTimelineItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bucketEndTimeUTC": + err = unpopulateTimeRFC3339(val, "BucketEndTimeUTC", &a.BucketEndTimeUTC) + delete(rawMsg, key) + case "bucketStartTimeUTC": + err = unpopulateTimeRFC3339(val, "BucketStartTimeUTC", &a.BucketStartTimeUTC) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "firstActivityTimeUTC": + err = unpopulateTimeRFC3339(val, "FirstActivityTimeUTC", &a.FirstActivityTimeUTC) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "lastActivityTimeUTC": + err = unpopulateTimeRFC3339(val, "LastActivityTimeUTC", &a.LastActivityTimeUTC) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, "QueryID", &a.QueryID) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertDetailsOverride. +func (a AlertDetailsOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDescriptionFormat", a.AlertDescriptionFormat) + populate(objectMap, "alertDisplayNameFormat", a.AlertDisplayNameFormat) + populate(objectMap, "alertSeverityColumnName", a.AlertSeverityColumnName) + populate(objectMap, "alertTacticsColumnName", a.AlertTacticsColumnName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertDetailsOverride. +func (a *AlertDetailsOverride) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertDescriptionFormat": + err = unpopulate(val, "AlertDescriptionFormat", &a.AlertDescriptionFormat) + delete(rawMsg, key) + case "alertDisplayNameFormat": + err = unpopulate(val, "AlertDisplayNameFormat", &a.AlertDisplayNameFormat) + delete(rawMsg, key) + case "alertSeverityColumnName": + err = unpopulate(val, "AlertSeverityColumnName", &a.AlertSeverityColumnName) + delete(rawMsg, key) + case "alertTacticsColumnName": + err = unpopulate(val, "AlertTacticsColumnName", &a.AlertTacticsColumnName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRule. +func (a AlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = a.Kind + populate(objectMap, "name", a.Name) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRule. +func (a *AlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplate. +func (a AlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["kind"] = a.Kind + populate(objectMap, "name", a.Name) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplate. +func (a *AlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplateDataSource. +func (a AlertRuleTemplateDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectorId", a.ConnectorID) + populate(objectMap, "dataTypes", a.DataTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplateDataSource. +func (a *AlertRuleTemplateDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectorId": + err = unpopulate(val, "ConnectorID", &a.ConnectorID) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplatesList. +func (a AlertRuleTemplatesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplatesList. +func (a *AlertRuleTemplatesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + a.Value, err = unmarshalAlertRuleTemplateClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRulesList. +func (a AlertRulesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulesList. +func (a *AlertRulesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + a.Value, err = unmarshalAlertRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertsDataTypeOfDataConnector. +func (a AlertsDataTypeOfDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alerts", a.Alerts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsDataTypeOfDataConnector. +func (a *AlertsDataTypeOfDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alerts": + err = unpopulate(val, "Alerts", &a.Alerts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Anomalies. +func (a Anomalies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = SettingKindAnomalies + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Anomalies. +func (a *Anomalies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AnomaliesSettingsProperties. +func (a AnomaliesSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isEnabled", a.IsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomaliesSettingsProperties. +func (a *AnomaliesSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettings. +func (a AnomalySecurityMLAnalyticsSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = SecurityMLAnalyticsSettingsKindAnomaly + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettings. +func (a *AnomalySecurityMLAnalyticsSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. +func (a AnomalySecurityMLAnalyticsSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "anomalySettingsVersion", a.AnomalySettingsVersion) + populate(objectMap, "anomalyVersion", a.AnomalyVersion) + populate(objectMap, "customizableObservations", &a.CustomizableObservations) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "frequency", a.Frequency) + populate(objectMap, "isDefaultSettings", a.IsDefaultSettings) + populateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) + populate(objectMap, "requiredDataConnectors", a.RequiredDataConnectors) + populate(objectMap, "settingsDefinitionId", a.SettingsDefinitionID) + populate(objectMap, "settingsStatus", a.SettingsStatus) + populate(objectMap, "tactics", a.Tactics) + populate(objectMap, "techniques", a.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. +func (a *AnomalySecurityMLAnalyticsSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "anomalySettingsVersion": + err = unpopulate(val, "AnomalySettingsVersion", &a.AnomalySettingsVersion) + delete(rawMsg, key) + case "anomalyVersion": + err = unpopulate(val, "AnomalyVersion", &a.AnomalyVersion) + delete(rawMsg, key) + case "customizableObservations": + err = unpopulate(val, "CustomizableObservations", &a.CustomizableObservations) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "frequency": + err = unpopulate(val, "Frequency", &a.Frequency) + delete(rawMsg, key) + case "isDefaultSettings": + err = unpopulate(val, "IsDefaultSettings", &a.IsDefaultSettings) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &a.RequiredDataConnectors) + delete(rawMsg, key) + case "settingsDefinitionId": + err = unpopulate(val, "SettingsDefinitionID", &a.SettingsDefinitionID) + delete(rawMsg, key) + case "settingsStatus": + err = unpopulate(val, "SettingsStatus", &a.SettingsStatus) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &a.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &a.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AnomalyTimelineItem. +func (a AnomalyTimelineItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureResourceId", a.AzureResourceID) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populateTimeRFC3339(objectMap, "endTimeUtc", a.EndTimeUTC) + populate(objectMap, "intent", a.Intent) + objectMap["kind"] = EntityTimelineKindAnomaly + populate(objectMap, "productName", a.ProductName) + populate(objectMap, "reasons", a.Reasons) + populateTimeRFC3339(objectMap, "startTimeUtc", a.StartTimeUTC) + populate(objectMap, "techniques", a.Techniques) + populateTimeRFC3339(objectMap, "timeGenerated", a.TimeGenerated) + populate(objectMap, "vendor", a.Vendor) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalyTimelineItem. +func (a *AnomalyTimelineItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureResourceId": + err = unpopulate(val, "AzureResourceID", &a.AzureResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) + delete(rawMsg, key) + case "intent": + err = unpopulate(val, "Intent", &a.Intent) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &a.ProductName) + delete(rawMsg, key) + case "reasons": + err = unpopulate(val, "Reasons", &a.Reasons) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &a.Techniques) + delete(rawMsg, key) + case "timeGenerated": + err = unpopulateTimeRFC3339(val, "TimeGenerated", &a.TimeGenerated) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &a.Vendor) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRule. +func (a AutomationRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRule. +func (a *AutomationRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleAction. +func (a AutomationRuleAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionType"] = a.ActionType + populate(objectMap, "order", a.Order) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleAction. +func (a *AutomationRuleAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &a.Order) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleBooleanCondition. +func (a AutomationRuleBooleanCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "innerConditions", a.InnerConditions) + populate(objectMap, "operator", a.Operator) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleBooleanCondition. +func (a *AutomationRuleBooleanCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "innerConditions": + a.InnerConditions, err = unmarshalAutomationRuleConditionClassificationArray(val) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleCondition. +func (a AutomationRuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["conditionType"] = a.ConditionType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleCondition. +func (a *AutomationRuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionType": + err = unpopulate(val, "ConditionType", &a.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleModifyPropertiesAction. +func (a AutomationRuleModifyPropertiesAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionConfiguration", a.ActionConfiguration) + objectMap["actionType"] = ActionTypeModifyProperties + populate(objectMap, "order", a.Order) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleModifyPropertiesAction. +func (a *AutomationRuleModifyPropertiesAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionConfiguration": + err = unpopulate(val, "ActionConfiguration", &a.ActionConfiguration) + delete(rawMsg, key) + case "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &a.Order) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleProperties. +func (a AutomationRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", a.Actions) + populate(objectMap, "createdBy", a.CreatedBy) + populateTimeRFC3339(objectMap, "createdTimeUtc", a.CreatedTimeUTC) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "lastModifiedBy", a.LastModifiedBy) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", a.LastModifiedTimeUTC) + populate(objectMap, "order", a.Order) + populate(objectMap, "triggeringLogic", a.TriggeringLogic) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleProperties. +func (a *AutomationRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + a.Actions, err = unmarshalAutomationRuleActionClassificationArray(val) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &a.CreatedBy) + delete(rawMsg, key) + case "createdTimeUtc": + err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &a.CreatedTimeUTC) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &a.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &a.LastModifiedTimeUTC) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &a.Order) + delete(rawMsg, key) + case "triggeringLogic": + err = unpopulate(val, "TriggeringLogic", &a.TriggeringLogic) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyArrayChangedValuesCondition. +func (a AutomationRulePropertyArrayChangedValuesCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arrayType", a.ArrayType) + populate(objectMap, "changeType", a.ChangeType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyArrayChangedValuesCondition. +func (a *AutomationRulePropertyArrayChangedValuesCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arrayType": + err = unpopulate(val, "ArrayType", &a.ArrayType) + delete(rawMsg, key) + case "changeType": + err = unpopulate(val, "ChangeType", &a.ChangeType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyArrayValuesCondition. +func (a AutomationRulePropertyArrayValuesCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arrayConditionType", a.ArrayConditionType) + populate(objectMap, "arrayType", a.ArrayType) + populate(objectMap, "itemConditions", a.ItemConditions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyArrayValuesCondition. +func (a *AutomationRulePropertyArrayValuesCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arrayConditionType": + err = unpopulate(val, "ArrayConditionType", &a.ArrayConditionType) + delete(rawMsg, key) + case "arrayType": + err = unpopulate(val, "ArrayType", &a.ArrayType) + delete(rawMsg, key) + case "itemConditions": + a.ItemConditions, err = unmarshalAutomationRuleConditionClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesChangedCondition. +func (a AutomationRulePropertyValuesChangedCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "changeType", a.ChangeType) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "propertyName", a.PropertyName) + populate(objectMap, "propertyValues", a.PropertyValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyValuesChangedCondition. +func (a *AutomationRulePropertyValuesChangedCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changeType": + err = unpopulate(val, "ChangeType", &a.ChangeType) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "propertyName": + err = unpopulate(val, "PropertyName", &a.PropertyName) + delete(rawMsg, key) + case "propertyValues": + err = unpopulate(val, "PropertyValues", &a.PropertyValues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesCondition. +func (a AutomationRulePropertyValuesCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "propertyName", a.PropertyName) + populate(objectMap, "propertyValues", a.PropertyValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyValuesCondition. +func (a *AutomationRulePropertyValuesCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "propertyName": + err = unpopulate(val, "PropertyName", &a.PropertyName) + delete(rawMsg, key) + case "propertyValues": + err = unpopulate(val, "PropertyValues", &a.PropertyValues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleRunPlaybookAction. +func (a AutomationRuleRunPlaybookAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionConfiguration", a.ActionConfiguration) + objectMap["actionType"] = ActionTypeRunPlaybook + populate(objectMap, "order", a.Order) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleRunPlaybookAction. +func (a *AutomationRuleRunPlaybookAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionConfiguration": + err = unpopulate(val, "ActionConfiguration", &a.ActionConfiguration) + delete(rawMsg, key) + case "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &a.Order) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRuleTriggeringLogic. +func (a AutomationRuleTriggeringLogic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditions", a.Conditions) + populateTimeRFC3339(objectMap, "expirationTimeUtc", a.ExpirationTimeUTC) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "triggersOn", a.TriggersOn) + populate(objectMap, "triggersWhen", a.TriggersWhen) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleTriggeringLogic. +func (a *AutomationRuleTriggeringLogic) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditions": + a.Conditions, err = unmarshalAutomationRuleConditionClassificationArray(val) + delete(rawMsg, key) + case "expirationTimeUtc": + err = unpopulateTimeRFC3339(val, "ExpirationTimeUTC", &a.ExpirationTimeUTC) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "triggersOn": + err = unpopulate(val, "TriggersOn", &a.TriggersOn) + delete(rawMsg, key) + case "triggersWhen": + err = unpopulate(val, "TriggersWhen", &a.TriggersWhen) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulesList. +func (a AutomationRulesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulesList. +func (a *AutomationRulesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Availability. +func (a Availability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isPreview", a.IsPreview) + objectMap["status"] = 1 + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Availability. +func (a *Availability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailCheckRequirements. +func (a AwsCloudTrailCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindAmazonWebServicesCloudTrail + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailCheckRequirements. +func (a *AwsCloudTrailCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailDataConnector. +func (a AwsCloudTrailDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = DataConnectorKindAmazonWebServicesCloudTrail + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailDataConnector. +func (a *AwsCloudTrailDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailDataConnectorDataTypes. +func (a AwsCloudTrailDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logs", a.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailDataConnectorDataTypes. +func (a *AwsCloudTrailDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &a.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailDataConnectorDataTypesLogs. +func (a AwsCloudTrailDataConnectorDataTypesLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailDataConnectorDataTypesLogs. +func (a *AwsCloudTrailDataConnectorDataTypesLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailDataConnectorProperties. +func (a AwsCloudTrailDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "awsRoleArn", a.AwsRoleArn) + populate(objectMap, "dataTypes", a.DataTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailDataConnectorProperties. +func (a *AwsCloudTrailDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "awsRoleArn": + err = unpopulate(val, "AwsRoleArn", &a.AwsRoleArn) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsS3CheckRequirements. +func (a AwsS3CheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindAmazonWebServicesS3 + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3CheckRequirements. +func (a *AwsS3CheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnector. +func (a AwsS3DataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = DataConnectorKindAmazonWebServicesS3 + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3DataConnector. +func (a *AwsS3DataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnectorDataTypes. +func (a AwsS3DataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logs", a.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3DataConnectorDataTypes. +func (a *AwsS3DataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &a.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnectorDataTypesLogs. +func (a AwsS3DataConnectorDataTypesLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", a.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3DataConnectorDataTypesLogs. +func (a *AwsS3DataConnectorDataTypesLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnectorProperties. +func (a AwsS3DataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "destinationTable", a.DestinationTable) + populate(objectMap, "roleArn", a.RoleArn) + populate(objectMap, "sqsUrls", a.SqsUrls) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3DataConnectorProperties. +func (a *AwsS3DataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "destinationTable": + err = unpopulate(val, "DestinationTable", &a.DestinationTable) + delete(rawMsg, key) + case "roleArn": + err = unpopulate(val, "RoleArn", &a.RoleArn) + delete(rawMsg, key) + case "sqsUrls": + err = unpopulate(val, "SqsUrls", &a.SqsUrls) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsResourceInfo. +func (a AzureDevOpsResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "pipelineId", a.PipelineID) + populate(objectMap, "serviceConnectionId", a.ServiceConnectionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsResourceInfo. +func (a *AzureDevOpsResourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pipelineId": + err = unpopulate(val, "PipelineID", &a.PipelineID) + delete(rawMsg, key) + case "serviceConnectionId": + err = unpopulate(val, "ServiceConnectionID", &a.ServiceConnectionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResourceEntity. +func (a AzureResourceEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["kind"] = EntityKindAzureResource + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceEntity. +func (a *AzureResourceEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResourceEntityProperties. +func (a AzureResourceEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "friendlyName", a.FriendlyName) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "subscriptionId", a.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceEntityProperties. +func (a *AzureResourceEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &a.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &a.FriendlyName) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Bookmark. +func (b Bookmark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Bookmark. +func (b *Bookmark) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkEntityMappings. +func (b BookmarkEntityMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "entityType", b.EntityType) + populate(objectMap, "fieldMappings", b.FieldMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkEntityMappings. +func (b *BookmarkEntityMappings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "entityType": + err = unpopulate(val, "EntityType", &b.EntityType) + delete(rawMsg, key) + case "fieldMappings": + err = unpopulate(val, "FieldMappings", &b.FieldMappings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkExpandParameters. +func (b BookmarkExpandParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", b.EndTime) + populate(objectMap, "expansionId", b.ExpansionID) + populateTimeRFC3339(objectMap, "startTime", b.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkExpandParameters. +func (b *BookmarkExpandParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &b.EndTime) + delete(rawMsg, key) + case "expansionId": + err = unpopulate(val, "ExpansionID", &b.ExpansionID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &b.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkExpandResponse. +func (b BookmarkExpandResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metaData", b.MetaData) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkExpandResponse. +func (b *BookmarkExpandResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metaData": + err = unpopulate(val, "MetaData", &b.MetaData) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkExpandResponseValue. +func (b BookmarkExpandResponseValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "edges", b.Edges) + populate(objectMap, "entities", b.Entities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkExpandResponseValue. +func (b *BookmarkExpandResponseValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "edges": + err = unpopulate(val, "Edges", &b.Edges) + delete(rawMsg, key) + case "entities": + b.Entities, err = unmarshalEntityClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkList. +func (b BookmarkList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkList. +func (b *BookmarkList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkProperties. +func (b BookmarkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", b.Created) + populate(objectMap, "createdBy", b.CreatedBy) + populate(objectMap, "displayName", b.DisplayName) + populate(objectMap, "entityMappings", b.EntityMappings) + populateTimeRFC3339(objectMap, "eventTime", b.EventTime) + populate(objectMap, "incidentInfo", b.IncidentInfo) + populate(objectMap, "labels", b.Labels) + populate(objectMap, "notes", b.Notes) + populate(objectMap, "query", b.Query) + populateTimeRFC3339(objectMap, "queryEndTime", b.QueryEndTime) + populate(objectMap, "queryResult", b.QueryResult) + populateTimeRFC3339(objectMap, "queryStartTime", b.QueryStartTime) + populate(objectMap, "tactics", b.Tactics) + populate(objectMap, "techniques", b.Techniques) + populateTimeRFC3339(objectMap, "updated", b.Updated) + populate(objectMap, "updatedBy", b.UpdatedBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkProperties. +func (b *BookmarkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeRFC3339(val, "Created", &b.Created) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &b.CreatedBy) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &b.DisplayName) + delete(rawMsg, key) + case "entityMappings": + err = unpopulate(val, "EntityMappings", &b.EntityMappings) + delete(rawMsg, key) + case "eventTime": + err = unpopulateTimeRFC3339(val, "EventTime", &b.EventTime) + delete(rawMsg, key) + case "incidentInfo": + err = unpopulate(val, "IncidentInfo", &b.IncidentInfo) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &b.Labels) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, "Notes", &b.Notes) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &b.Query) + delete(rawMsg, key) + case "queryEndTime": + err = unpopulateTimeRFC3339(val, "QueryEndTime", &b.QueryEndTime) + delete(rawMsg, key) + case "queryResult": + err = unpopulate(val, "QueryResult", &b.QueryResult) + delete(rawMsg, key) + case "queryStartTime": + err = unpopulateTimeRFC3339(val, "QueryStartTime", &b.QueryStartTime) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &b.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &b.Techniques) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &b.Updated) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &b.UpdatedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BookmarkTimelineItem. +func (b BookmarkTimelineItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureResourceId", b.AzureResourceID) + populate(objectMap, "createdBy", b.CreatedBy) + populate(objectMap, "displayName", b.DisplayName) + populateTimeRFC3339(objectMap, "endTimeUtc", b.EndTimeUTC) + populateTimeRFC3339(objectMap, "eventTime", b.EventTime) + objectMap["kind"] = EntityTimelineKindBookmark + populate(objectMap, "labels", b.Labels) + populate(objectMap, "notes", b.Notes) + populateTimeRFC3339(objectMap, "startTimeUtc", b.StartTimeUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkTimelineItem. +func (b *BookmarkTimelineItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureResourceId": + err = unpopulate(val, "AzureResourceID", &b.AzureResourceID) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &b.CreatedBy) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &b.DisplayName) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &b.EndTimeUTC) + delete(rawMsg, key) + case "eventTime": + err = unpopulateTimeRFC3339(val, "EventTime", &b.EventTime) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &b.Kind) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &b.Labels) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, "Notes", &b.Notes) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &b.StartTimeUTC) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BooleanConditionProperties. +func (b BooleanConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionProperties", b.ConditionProperties) + objectMap["conditionType"] = ConditionTypeBoolean + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BooleanConditionProperties. +func (b *BooleanConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &b.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &b.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClientInfo. +func (c ClientInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", c.Email) + populate(objectMap, "name", c.Name) + populate(objectMap, "objectId", c.ObjectID) + populate(objectMap, "userPrincipalName", c.UserPrincipalName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientInfo. +func (c *ClientInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &c.Email) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &c.ObjectID) + delete(rawMsg, key) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &c.UserPrincipalName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudApplicationEntity. +func (c CloudApplicationEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + objectMap["kind"] = EntityKindCloudApplication + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudApplicationEntity. +func (c *CloudApplicationEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudApplicationEntityProperties. +func (c CloudApplicationEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", c.AdditionalData) + populate(objectMap, "appId", c.AppID) + populate(objectMap, "appName", c.AppName) + populate(objectMap, "friendlyName", c.FriendlyName) + populate(objectMap, "instanceName", c.InstanceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudApplicationEntityProperties. +func (c *CloudApplicationEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &c.AdditionalData) + delete(rawMsg, key) + case "appId": + err = unpopulate(val, "AppID", &c.AppID) + delete(rawMsg, key) + case "appName": + err = unpopulate(val, "AppName", &c.AppName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &c.FriendlyName) + delete(rawMsg, key) + case "instanceName": + err = unpopulate(val, "InstanceName", &c.InstanceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessAPIPollingDataConnector. +func (c CodelessAPIPollingDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + objectMap["kind"] = DataConnectorKindAPIPolling + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessAPIPollingDataConnector. +func (c *CodelessAPIPollingDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingAuthProperties. +func (c CodelessConnectorPollingAuthProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKeyIdentifier", c.APIKeyIdentifier) + populate(objectMap, "apiKeyName", c.APIKeyName) + populate(objectMap, "authType", c.AuthType) + populate(objectMap, "authorizationEndpoint", c.AuthorizationEndpoint) + populate(objectMap, "authorizationEndpointQueryParameters", &c.AuthorizationEndpointQueryParameters) + populate(objectMap, "flowName", c.FlowName) + populate(objectMap, "isApiKeyInPostPayload", c.IsAPIKeyInPostPayload) + populate(objectMap, "isClientSecretInHeader", c.IsClientSecretInHeader) + populate(objectMap, "redirectionEndpoint", c.RedirectionEndpoint) + populate(objectMap, "scope", c.Scope) + populate(objectMap, "tokenEndpoint", c.TokenEndpoint) + populate(objectMap, "tokenEndpointHeaders", &c.TokenEndpointHeaders) + populate(objectMap, "tokenEndpointQueryParameters", &c.TokenEndpointQueryParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessConnectorPollingAuthProperties. +func (c *CodelessConnectorPollingAuthProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiKeyIdentifier": + err = unpopulate(val, "APIKeyIdentifier", &c.APIKeyIdentifier) + delete(rawMsg, key) + case "apiKeyName": + err = unpopulate(val, "APIKeyName", &c.APIKeyName) + delete(rawMsg, key) + case "authType": + err = unpopulate(val, "AuthType", &c.AuthType) + delete(rawMsg, key) + case "authorizationEndpoint": + err = unpopulate(val, "AuthorizationEndpoint", &c.AuthorizationEndpoint) + delete(rawMsg, key) + case "authorizationEndpointQueryParameters": + err = unpopulate(val, "AuthorizationEndpointQueryParameters", &c.AuthorizationEndpointQueryParameters) + delete(rawMsg, key) + case "flowName": + err = unpopulate(val, "FlowName", &c.FlowName) + delete(rawMsg, key) + case "isApiKeyInPostPayload": + err = unpopulate(val, "IsAPIKeyInPostPayload", &c.IsAPIKeyInPostPayload) + delete(rawMsg, key) + case "isClientSecretInHeader": + err = unpopulate(val, "IsClientSecretInHeader", &c.IsClientSecretInHeader) + delete(rawMsg, key) + case "redirectionEndpoint": + err = unpopulate(val, "RedirectionEndpoint", &c.RedirectionEndpoint) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &c.Scope) + delete(rawMsg, key) + case "tokenEndpoint": + err = unpopulate(val, "TokenEndpoint", &c.TokenEndpoint) + delete(rawMsg, key) + case "tokenEndpointHeaders": + err = unpopulate(val, "TokenEndpointHeaders", &c.TokenEndpointHeaders) + delete(rawMsg, key) + case "tokenEndpointQueryParameters": + err = unpopulate(val, "TokenEndpointQueryParameters", &c.TokenEndpointQueryParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingConfigProperties. +func (c CodelessConnectorPollingConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auth", c.Auth) + populate(objectMap, "isActive", c.IsActive) + populate(objectMap, "paging", c.Paging) + populate(objectMap, "request", c.Request) + populate(objectMap, "response", c.Response) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessConnectorPollingConfigProperties. +func (c *CodelessConnectorPollingConfigProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auth": + err = unpopulate(val, "Auth", &c.Auth) + delete(rawMsg, key) + case "isActive": + err = unpopulate(val, "IsActive", &c.IsActive) + delete(rawMsg, key) + case "paging": + err = unpopulate(val, "Paging", &c.Paging) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &c.Request) + delete(rawMsg, key) + case "response": + err = unpopulate(val, "Response", &c.Response) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingPagingProperties. +func (c CodelessConnectorPollingPagingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextPageParaName", c.NextPageParaName) + populate(objectMap, "nextPageTokenJsonPath", c.NextPageTokenJSONPath) + populate(objectMap, "pageCountAttributePath", c.PageCountAttributePath) + populate(objectMap, "pageSize", c.PageSize) + populate(objectMap, "pageSizeParaName", c.PageSizeParaName) + populate(objectMap, "pageTimeStampAttributePath", c.PageTimeStampAttributePath) + populate(objectMap, "pageTotalCountAttributePath", c.PageTotalCountAttributePath) + populate(objectMap, "pagingType", c.PagingType) + populate(objectMap, "searchTheLatestTimeStampFromEventsList", c.SearchTheLatestTimeStampFromEventsList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessConnectorPollingPagingProperties. +func (c *CodelessConnectorPollingPagingProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextPageParaName": + err = unpopulate(val, "NextPageParaName", &c.NextPageParaName) + delete(rawMsg, key) + case "nextPageTokenJsonPath": + err = unpopulate(val, "NextPageTokenJSONPath", &c.NextPageTokenJSONPath) + delete(rawMsg, key) + case "pageCountAttributePath": + err = unpopulate(val, "PageCountAttributePath", &c.PageCountAttributePath) + delete(rawMsg, key) + case "pageSize": + err = unpopulate(val, "PageSize", &c.PageSize) + delete(rawMsg, key) + case "pageSizeParaName": + err = unpopulate(val, "PageSizeParaName", &c.PageSizeParaName) + delete(rawMsg, key) + case "pageTimeStampAttributePath": + err = unpopulate(val, "PageTimeStampAttributePath", &c.PageTimeStampAttributePath) + delete(rawMsg, key) + case "pageTotalCountAttributePath": + err = unpopulate(val, "PageTotalCountAttributePath", &c.PageTotalCountAttributePath) + delete(rawMsg, key) + case "pagingType": + err = unpopulate(val, "PagingType", &c.PagingType) + delete(rawMsg, key) + case "searchTheLatestTimeStampFromEventsList": + err = unpopulate(val, "SearchTheLatestTimeStampFromEventsList", &c.SearchTheLatestTimeStampFromEventsList) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingRequestProperties. +func (c CodelessConnectorPollingRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiEndpoint", c.APIEndpoint) + populate(objectMap, "endTimeAttributeName", c.EndTimeAttributeName) + populate(objectMap, "httpMethod", c.HTTPMethod) + populate(objectMap, "headers", &c.Headers) + populate(objectMap, "queryParameters", &c.QueryParameters) + populate(objectMap, "queryParametersTemplate", c.QueryParametersTemplate) + populate(objectMap, "queryTimeFormat", c.QueryTimeFormat) + populate(objectMap, "queryWindowInMin", c.QueryWindowInMin) + populate(objectMap, "rateLimitQps", c.RateLimitQPS) + populate(objectMap, "retryCount", c.RetryCount) + populate(objectMap, "startTimeAttributeName", c.StartTimeAttributeName) + populate(objectMap, "timeoutInSeconds", c.TimeoutInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessConnectorPollingRequestProperties. +func (c *CodelessConnectorPollingRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiEndpoint": + err = unpopulate(val, "APIEndpoint", &c.APIEndpoint) + delete(rawMsg, key) + case "endTimeAttributeName": + err = unpopulate(val, "EndTimeAttributeName", &c.EndTimeAttributeName) + delete(rawMsg, key) + case "httpMethod": + err = unpopulate(val, "HTTPMethod", &c.HTTPMethod) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &c.Headers) + delete(rawMsg, key) + case "queryParameters": + err = unpopulate(val, "QueryParameters", &c.QueryParameters) + delete(rawMsg, key) + case "queryParametersTemplate": + err = unpopulate(val, "QueryParametersTemplate", &c.QueryParametersTemplate) + delete(rawMsg, key) + case "queryTimeFormat": + err = unpopulate(val, "QueryTimeFormat", &c.QueryTimeFormat) + delete(rawMsg, key) + case "queryWindowInMin": + err = unpopulate(val, "QueryWindowInMin", &c.QueryWindowInMin) + delete(rawMsg, key) + case "rateLimitQps": + err = unpopulate(val, "RateLimitQPS", &c.RateLimitQPS) + delete(rawMsg, key) + case "retryCount": + err = unpopulate(val, "RetryCount", &c.RetryCount) + delete(rawMsg, key) + case "startTimeAttributeName": + err = unpopulate(val, "StartTimeAttributeName", &c.StartTimeAttributeName) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &c.TimeoutInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingResponseProperties. +func (c CodelessConnectorPollingResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventsJsonPaths", c.EventsJSONPaths) + populate(objectMap, "isGzipCompressed", c.IsGzipCompressed) + populate(objectMap, "successStatusJsonPath", c.SuccessStatusJSONPath) + populate(objectMap, "successStatusValue", c.SuccessStatusValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessConnectorPollingResponseProperties. +func (c *CodelessConnectorPollingResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventsJsonPaths": + err = unpopulate(val, "EventsJSONPaths", &c.EventsJSONPaths) + delete(rawMsg, key) + case "isGzipCompressed": + err = unpopulate(val, "IsGzipCompressed", &c.IsGzipCompressed) + delete(rawMsg, key) + case "successStatusJsonPath": + err = unpopulate(val, "SuccessStatusJSONPath", &c.SuccessStatusJSONPath) + delete(rawMsg, key) + case "successStatusValue": + err = unpopulate(val, "SuccessStatusValue", &c.SuccessStatusValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessParameters. +func (c CodelessParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectorUiConfig", c.ConnectorUIConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessParameters. +func (c *CodelessParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectorUiConfig": + err = unpopulate(val, "ConnectorUIConfig", &c.ConnectorUIConfig) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigProperties. +func (c CodelessUIConnectorConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availability", c.Availability) + populate(objectMap, "connectivityCriteria", c.ConnectivityCriteria) + populate(objectMap, "customImage", c.CustomImage) + populate(objectMap, "dataTypes", c.DataTypes) + populate(objectMap, "descriptionMarkdown", c.DescriptionMarkdown) + populate(objectMap, "graphQueries", c.GraphQueries) + populate(objectMap, "graphQueriesTableName", c.GraphQueriesTableName) + populate(objectMap, "instructionSteps", c.InstructionSteps) + populate(objectMap, "permissions", c.Permissions) + populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "sampleQueries", c.SampleQueries) + populate(objectMap, "title", c.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigProperties. +func (c *CodelessUIConnectorConfigProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availability": + err = unpopulate(val, "Availability", &c.Availability) + delete(rawMsg, key) + case "connectivityCriteria": + err = unpopulate(val, "ConnectivityCriteria", &c.ConnectivityCriteria) + delete(rawMsg, key) + case "customImage": + err = unpopulate(val, "CustomImage", &c.CustomImage) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &c.DataTypes) + delete(rawMsg, key) + case "descriptionMarkdown": + err = unpopulate(val, "DescriptionMarkdown", &c.DescriptionMarkdown) + delete(rawMsg, key) + case "graphQueries": + err = unpopulate(val, "GraphQueries", &c.GraphQueries) + delete(rawMsg, key) + case "graphQueriesTableName": + err = unpopulate(val, "GraphQueriesTableName", &c.GraphQueriesTableName) + delete(rawMsg, key) + case "instructionSteps": + err = unpopulate(val, "InstructionSteps", &c.InstructionSteps) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &c.Permissions) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &c.Publisher) + delete(rawMsg, key) + case "sampleQueries": + err = unpopulate(val, "SampleQueries", &c.SampleQueries) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &c.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem. +func (c CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", c.Type) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem. +func (c *CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesDataTypesItem. +func (c CodelessUIConnectorConfigPropertiesDataTypesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lastDataReceivedQuery", c.LastDataReceivedQuery) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigPropertiesDataTypesItem. +func (c *CodelessUIConnectorConfigPropertiesDataTypesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastDataReceivedQuery": + err = unpopulate(val, "LastDataReceivedQuery", &c.LastDataReceivedQuery) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesGraphQueriesItem. +func (c CodelessUIConnectorConfigPropertiesGraphQueriesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseQuery", c.BaseQuery) + populate(objectMap, "legend", c.Legend) + populate(objectMap, "metricName", c.MetricName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigPropertiesGraphQueriesItem. +func (c *CodelessUIConnectorConfigPropertiesGraphQueriesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseQuery": + err = unpopulate(val, "BaseQuery", &c.BaseQuery) + delete(rawMsg, key) + case "legend": + err = unpopulate(val, "Legend", &c.Legend) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &c.MetricName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesInstructionStepsItem. +func (c CodelessUIConnectorConfigPropertiesInstructionStepsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "instructions", c.Instructions) + populate(objectMap, "title", c.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigPropertiesInstructionStepsItem. +func (c *CodelessUIConnectorConfigPropertiesInstructionStepsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "instructions": + err = unpopulate(val, "Instructions", &c.Instructions) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &c.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesSampleQueriesItem. +func (c CodelessUIConnectorConfigPropertiesSampleQueriesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "query", c.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIConnectorConfigPropertiesSampleQueriesItem. +func (c *CodelessUIConnectorConfigPropertiesSampleQueriesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &c.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CodelessUIDataConnector. +func (c CodelessUIDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + objectMap["kind"] = DataConnectorKindGenericUI + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIDataConnector. +func (c *CodelessUIDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectedEntity. +func (c ConnectedEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", &c.AdditionalData) + populate(objectMap, "targetEntityId", c.TargetEntityID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedEntity. +func (c *ConnectedEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &c.AdditionalData) + delete(rawMsg, key) + case "targetEntityId": + err = unpopulate(val, "TargetEntityID", &c.TargetEntityID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContentPathMap. +func (c ContentPathMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentType", c.ContentType) + populate(objectMap, "path", c.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentPathMap. +func (c *ContentPathMap) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentType": + err = unpopulate(val, "ContentType", &c.ContentType) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &c.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityQuery. +func (c CustomEntityQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + objectMap["kind"] = c.Kind + populate(objectMap, "name", c.Name) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityQuery. +func (c *CustomEntityQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSEntity. +func (d DNSEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + objectMap["kind"] = EntityKindDNSResolution + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSEntity. +func (d *DNSEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSEntityProperties. +func (d DNSEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", d.AdditionalData) + populate(objectMap, "dnsServerIpEntityId", d.DNSServerIPEntityID) + populate(objectMap, "domainName", d.DomainName) + populate(objectMap, "friendlyName", d.FriendlyName) + populate(objectMap, "hostIpAddressEntityId", d.HostIPAddressEntityID) + populate(objectMap, "ipAddressEntityIds", d.IPAddressEntityIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSEntityProperties. +func (d *DNSEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &d.AdditionalData) + delete(rawMsg, key) + case "dnsServerIpEntityId": + err = unpopulate(val, "DNSServerIPEntityID", &d.DNSServerIPEntityID) + delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &d.DomainName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &d.FriendlyName) + delete(rawMsg, key) + case "hostIpAddressEntityId": + err = unpopulate(val, "HostIPAddressEntityID", &d.HostIPAddressEntityID) + delete(rawMsg, key) + case "ipAddressEntityIds": + err = unpopulate(val, "IPAddressEntityIDs", &d.IPAddressEntityIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnector. +func (d DataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + objectMap["kind"] = d.Kind + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnector. +func (d *DataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectorConnectBody. +func (d DataConnectorConnectBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKey", d.APIKey) + populate(objectMap, "authorizationCode", d.AuthorizationCode) + populate(objectMap, "clientId", d.ClientID) + populate(objectMap, "clientSecret", d.ClientSecret) + populate(objectMap, "dataCollectionEndpoint", d.DataCollectionEndpoint) + populate(objectMap, "dataCollectionRuleImmutableId", d.DataCollectionRuleImmutableID) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "outputStream", d.OutputStream) + populate(objectMap, "password", d.Password) + populate(objectMap, "requestConfigUserInputValues", d.RequestConfigUserInputValues) + populate(objectMap, "userName", d.UserName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorConnectBody. +func (d *DataConnectorConnectBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiKey": + err = unpopulate(val, "APIKey", &d.APIKey) + delete(rawMsg, key) + case "authorizationCode": + err = unpopulate(val, "AuthorizationCode", &d.AuthorizationCode) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &d.ClientSecret) + delete(rawMsg, key) + case "dataCollectionEndpoint": + err = unpopulate(val, "DataCollectionEndpoint", &d.DataCollectionEndpoint) + delete(rawMsg, key) + case "dataCollectionRuleImmutableId": + err = unpopulate(val, "DataCollectionRuleImmutableID", &d.DataCollectionRuleImmutableID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "outputStream": + err = unpopulate(val, "OutputStream", &d.OutputStream) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &d.Password) + delete(rawMsg, key) + case "requestConfigUserInputValues": + err = unpopulate(val, "RequestConfigUserInputValues", &d.RequestConfigUserInputValues) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &d.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectorDataTypeCommon. +func (d DataConnectorDataTypeCommon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", d.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorDataTypeCommon. +func (d *DataConnectorDataTypeCommon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &d.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectorList. +func (d DataConnectorList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorList. +func (d *DataConnectorList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + d.Value, err = unmarshalDataConnectorClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectorRequirementsState. +func (d DataConnectorRequirementsState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorizationState", d.AuthorizationState) + populate(objectMap, "licenseState", d.LicenseState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorRequirementsState. +func (d *DataConnectorRequirementsState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizationState": + err = unpopulate(val, "AuthorizationState", &d.AuthorizationState) + delete(rawMsg, key) + case "licenseState": + err = unpopulate(val, "LicenseState", &d.LicenseState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectorsCheckRequirements. +func (d DataConnectorsCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = d.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorsCheckRequirements. +func (d *DataConnectorsCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTypeDefinitions. +func (d DataTypeDefinitions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataType", d.DataType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTypeDefinitions. +func (d *DataTypeDefinitions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataType": + err = unpopulate(val, "DataType", &d.DataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deploymentId", d.DeploymentID) + populate(objectMap, "deploymentLogsUrl", d.DeploymentLogsURL) + populate(objectMap, "deploymentResult", d.DeploymentResult) + populate(objectMap, "deploymentState", d.DeploymentState) + populateTimeRFC3339(objectMap, "deploymentTime", d.DeploymentTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Deployment. +func (d *Deployment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deploymentId": + err = unpopulate(val, "DeploymentID", &d.DeploymentID) + delete(rawMsg, key) + case "deploymentLogsUrl": + err = unpopulate(val, "DeploymentLogsURL", &d.DeploymentLogsURL) + delete(rawMsg, key) + case "deploymentResult": + err = unpopulate(val, "DeploymentResult", &d.DeploymentResult) + delete(rawMsg, key) + case "deploymentState": + err = unpopulate(val, "DeploymentState", &d.DeploymentState) + delete(rawMsg, key) + case "deploymentTime": + err = unpopulateTimeRFC3339(val, "DeploymentTime", &d.DeploymentTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentInfo. +func (d DeploymentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deployment", d.Deployment) + populate(objectMap, "deploymentFetchStatus", d.DeploymentFetchStatus) + populate(objectMap, "message", d.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentInfo. +func (d *DeploymentInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deployment": + err = unpopulate(val, "Deployment", &d.Deployment) + delete(rawMsg, key) + case "deploymentFetchStatus": + err = unpopulate(val, "DeploymentFetchStatus", &d.DeploymentFetchStatus) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365CheckRequirements. +func (d Dynamics365CheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindDynamics365 + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365CheckRequirements. +func (d *Dynamics365CheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365CheckRequirementsProperties. +func (d Dynamics365CheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", d.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365CheckRequirementsProperties. +func (d *Dynamics365CheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365DataConnector. +func (d Dynamics365DataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + objectMap["kind"] = DataConnectorKindDynamics365 + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365DataConnector. +func (d *Dynamics365DataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365DataConnectorDataTypes. +func (d Dynamics365DataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dynamics365CdsActivities", d.Dynamics365CdsActivities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365DataConnectorDataTypes. +func (d *Dynamics365DataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynamics365CdsActivities": + err = unpopulate(val, "Dynamics365CdsActivities", &d.Dynamics365CdsActivities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365DataConnectorDataTypesDynamics365CdsActivities. +func (d Dynamics365DataConnectorDataTypesDynamics365CdsActivities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", d.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365DataConnectorDataTypesDynamics365CdsActivities. +func (d *Dynamics365DataConnectorDataTypesDynamics365CdsActivities) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &d.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dynamics365DataConnectorProperties. +func (d Dynamics365DataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", d.DataTypes) + populate(objectMap, "tenantId", d.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365DataConnectorProperties. +func (d *Dynamics365DataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &d.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentDomainWhois. +func (e EnrichmentDomainWhois) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", e.Created) + populate(objectMap, "domain", e.Domain) + populateTimeRFC3339(objectMap, "expires", e.Expires) + populate(objectMap, "parsedWhois", e.ParsedWhois) + populate(objectMap, "server", e.Server) + populateTimeRFC3339(objectMap, "updated", e.Updated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhois. +func (e *EnrichmentDomainWhois) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeRFC3339(val, "Created", &e.Created) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &e.Domain) + delete(rawMsg, key) + case "expires": + err = unpopulateTimeRFC3339(val, "Expires", &e.Expires) + delete(rawMsg, key) + case "parsedWhois": + err = unpopulate(val, "ParsedWhois", &e.ParsedWhois) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &e.Server) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &e.Updated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentDomainWhoisContact. +func (e EnrichmentDomainWhoisContact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "city", e.City) + populate(objectMap, "country", e.Country) + populate(objectMap, "email", e.Email) + populate(objectMap, "fax", e.Fax) + populate(objectMap, "name", e.Name) + populate(objectMap, "org", e.Org) + populate(objectMap, "phone", e.Phone) + populate(objectMap, "postal", e.Postal) + populate(objectMap, "state", e.State) + populate(objectMap, "street", e.Street) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhoisContact. +func (e *EnrichmentDomainWhoisContact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &e.Country) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &e.Email) + delete(rawMsg, key) + case "fax": + err = unpopulate(val, "Fax", &e.Fax) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "org": + err = unpopulate(val, "Org", &e.Org) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &e.Phone) + delete(rawMsg, key) + case "postal": + err = unpopulate(val, "Postal", &e.Postal) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + case "street": + err = unpopulate(val, "Street", &e.Street) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentDomainWhoisContacts. +func (e EnrichmentDomainWhoisContacts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "admin", e.Admin) + populate(objectMap, "billing", e.Billing) + populate(objectMap, "registrant", e.Registrant) + populate(objectMap, "tech", e.Tech) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhoisContacts. +func (e *EnrichmentDomainWhoisContacts) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "admin": + err = unpopulate(val, "Admin", &e.Admin) + delete(rawMsg, key) + case "billing": + err = unpopulate(val, "Billing", &e.Billing) + delete(rawMsg, key) + case "registrant": + err = unpopulate(val, "Registrant", &e.Registrant) + delete(rawMsg, key) + case "tech": + err = unpopulate(val, "Tech", &e.Tech) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentDomainWhoisDetails. +func (e EnrichmentDomainWhoisDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contacts", e.Contacts) + populate(objectMap, "nameServers", e.NameServers) + populate(objectMap, "registrar", e.Registrar) + populate(objectMap, "statuses", e.Statuses) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhoisDetails. +func (e *EnrichmentDomainWhoisDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contacts": + err = unpopulate(val, "Contacts", &e.Contacts) + delete(rawMsg, key) + case "nameServers": + err = unpopulate(val, "NameServers", &e.NameServers) + delete(rawMsg, key) + case "registrar": + err = unpopulate(val, "Registrar", &e.Registrar) + delete(rawMsg, key) + case "statuses": + err = unpopulate(val, "Statuses", &e.Statuses) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentDomainWhoisRegistrarDetails. +func (e EnrichmentDomainWhoisRegistrarDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "abuseContactEmail", e.AbuseContactEmail) + populate(objectMap, "abuseContactPhone", e.AbuseContactPhone) + populate(objectMap, "ianaId", e.IanaID) + populate(objectMap, "name", e.Name) + populate(objectMap, "url", e.URL) + populate(objectMap, "whoisServer", e.WhoisServer) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhoisRegistrarDetails. +func (e *EnrichmentDomainWhoisRegistrarDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "abuseContactEmail": + err = unpopulate(val, "AbuseContactEmail", &e.AbuseContactEmail) + delete(rawMsg, key) + case "abuseContactPhone": + err = unpopulate(val, "AbuseContactPhone", &e.AbuseContactPhone) + delete(rawMsg, key) + case "ianaId": + err = unpopulate(val, "IanaID", &e.IanaID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &e.URL) + delete(rawMsg, key) + case "whoisServer": + err = unpopulate(val, "WhoisServer", &e.WhoisServer) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrichmentIPGeodata. +func (e EnrichmentIPGeodata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", e.Asn) + populate(objectMap, "carrier", e.Carrier) + populate(objectMap, "city", e.City) + populate(objectMap, "cityCf", e.CityCf) + populate(objectMap, "continent", e.Continent) + populate(objectMap, "country", e.Country) + populate(objectMap, "countryCf", e.CountryCf) + populate(objectMap, "ipAddr", e.IPAddr) + populate(objectMap, "ipRoutingType", e.IPRoutingType) + populate(objectMap, "latitude", e.Latitude) + populate(objectMap, "longitude", e.Longitude) + populate(objectMap, "organization", e.Organization) + populate(objectMap, "organizationType", e.OrganizationType) + populate(objectMap, "region", e.Region) + populate(objectMap, "state", e.State) + populate(objectMap, "stateCf", e.StateCf) + populate(objectMap, "stateCode", e.StateCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentIPGeodata. +func (e *EnrichmentIPGeodata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &e.Asn) + delete(rawMsg, key) + case "carrier": + err = unpopulate(val, "Carrier", &e.Carrier) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "cityCf": + err = unpopulate(val, "CityCf", &e.CityCf) + delete(rawMsg, key) + case "continent": + err = unpopulate(val, "Continent", &e.Continent) + delete(rawMsg, key) + case "country": + err = unpopulate(val, "Country", &e.Country) + delete(rawMsg, key) + case "countryCf": + err = unpopulate(val, "CountryCf", &e.CountryCf) + delete(rawMsg, key) + case "ipAddr": + err = unpopulate(val, "IPAddr", &e.IPAddr) + delete(rawMsg, key) + case "ipRoutingType": + err = unpopulate(val, "IPRoutingType", &e.IPRoutingType) + delete(rawMsg, key) + case "latitude": + err = unpopulate(val, "Latitude", &e.Latitude) + delete(rawMsg, key) + case "longitude": + err = unpopulate(val, "Longitude", &e.Longitude) + delete(rawMsg, key) + case "organization": + err = unpopulate(val, "Organization", &e.Organization) + delete(rawMsg, key) + case "organizationType": + err = unpopulate(val, "OrganizationType", &e.OrganizationType) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &e.Region) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + case "stateCf": + err = unpopulate(val, "StateCf", &e.StateCf) + delete(rawMsg, key) + case "stateCode": + err = unpopulate(val, "StateCode", &e.StateCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Entity. +func (e Entity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + objectMap["kind"] = e.Kind + populate(objectMap, "name", e.Name) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Entity. +func (e *Entity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityAnalytics. +func (e EntityAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + objectMap["kind"] = SettingKindEntityAnalytics + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityAnalytics. +func (e *EntityAnalytics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityAnalyticsProperties. +func (e EntityAnalyticsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "entityProviders", e.EntityProviders) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityAnalyticsProperties. +func (e *EntityAnalyticsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "entityProviders": + err = unpopulate(val, "EntityProviders", &e.EntityProviders) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityEdges. +func (e EntityEdges) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", e.AdditionalData) + populate(objectMap, "targetEntityId", e.TargetEntityID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityEdges. +func (e *EntityEdges) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &e.AdditionalData) + delete(rawMsg, key) + case "targetEntityId": + err = unpopulate(val, "TargetEntityID", &e.TargetEntityID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityExpandParameters. +func (e EntityExpandParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) + populate(objectMap, "expansionId", e.ExpansionID) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityExpandParameters. +func (e *EntityExpandParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) + delete(rawMsg, key) + case "expansionId": + err = unpopulate(val, "ExpansionID", &e.ExpansionID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityExpandResponse. +func (e EntityExpandResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metaData", e.MetaData) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityExpandResponse. +func (e *EntityExpandResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metaData": + err = unpopulate(val, "MetaData", &e.MetaData) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityExpandResponseValue. +func (e EntityExpandResponseValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "edges", e.Edges) + populate(objectMap, "entities", e.Entities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityExpandResponseValue. +func (e *EntityExpandResponseValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "edges": + err = unpopulate(val, "Edges", &e.Edges) + delete(rawMsg, key) + case "entities": + e.Entities, err = unmarshalEntityClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityFieldMapping. +func (e EntityFieldMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identifier", e.Identifier) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityFieldMapping. +func (e *EntityFieldMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifier": + err = unpopulate(val, "Identifier", &e.Identifier) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityGetInsightsParameters. +func (e EntityGetInsightsParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "addDefaultExtendedTimeRange", e.AddDefaultExtendedTimeRange) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) + populate(objectMap, "insightQueryIds", e.InsightQueryIDs) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityGetInsightsParameters. +func (e *EntityGetInsightsParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addDefaultExtendedTimeRange": + err = unpopulate(val, "AddDefaultExtendedTimeRange", &e.AddDefaultExtendedTimeRange) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) + delete(rawMsg, key) + case "insightQueryIds": + err = unpopulate(val, "InsightQueryIDs", &e.InsightQueryIDs) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityGetInsightsResponse. +func (e EntityGetInsightsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metaData", e.MetaData) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityGetInsightsResponse. +func (e *EntityGetInsightsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metaData": + err = unpopulate(val, "MetaData", &e.MetaData) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityInsightItem. +func (e EntityInsightItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "chartQueryResults", e.ChartQueryResults) + populate(objectMap, "queryId", e.QueryID) + populate(objectMap, "queryTimeInterval", e.QueryTimeInterval) + populate(objectMap, "tableQueryResults", e.TableQueryResults) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityInsightItem. +func (e *EntityInsightItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "chartQueryResults": + err = unpopulate(val, "ChartQueryResults", &e.ChartQueryResults) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, "QueryID", &e.QueryID) + delete(rawMsg, key) + case "queryTimeInterval": + err = unpopulate(val, "QueryTimeInterval", &e.QueryTimeInterval) + delete(rawMsg, key) + case "tableQueryResults": + err = unpopulate(val, "TableQueryResults", &e.TableQueryResults) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityInsightItemQueryTimeInterval. +func (e EntityInsightItemQueryTimeInterval) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityInsightItemQueryTimeInterval. +func (e *EntityInsightItemQueryTimeInterval) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityList. +func (e EntityList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityList. +func (e *EntityList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + e.Value, err = unmarshalEntityClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityMapping. +func (e EntityMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "entityType", e.EntityType) + populate(objectMap, "fieldMappings", e.FieldMappings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityMapping. +func (e *EntityMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "entityType": + err = unpopulate(val, "EntityType", &e.EntityType) + delete(rawMsg, key) + case "fieldMappings": + err = unpopulate(val, "FieldMappings", &e.FieldMappings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQuery. +func (e EntityQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + objectMap["kind"] = e.Kind + populate(objectMap, "name", e.Name) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQuery. +func (e *EntityQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQueryItem. +func (e EntityQueryItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + objectMap["kind"] = e.Kind + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryItem. +func (e *EntityQueryItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQueryItemPropertiesDataTypesItem. +func (e EntityQueryItemPropertiesDataTypesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataType", e.DataType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryItemPropertiesDataTypesItem. +func (e *EntityQueryItemPropertiesDataTypesItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataType": + err = unpopulate(val, "DataType", &e.DataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQueryList. +func (e EntityQueryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryList. +func (e *EntityQueryList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + e.Value, err = unmarshalEntityQueryClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQueryTemplate. +func (e EntityQueryTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + objectMap["kind"] = e.Kind + populate(objectMap, "name", e.Name) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryTemplate. +func (e *EntityQueryTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityQueryTemplateList. +func (e EntityQueryTemplateList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryTemplateList. +func (e *EntityQueryTemplateList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + e.Value, err = unmarshalEntityQueryTemplateClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityTimelineItem. +func (e EntityTimelineItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = e.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTimelineItem. +func (e *EntityTimelineItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityTimelineParameters. +func (e EntityTimelineParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) + populate(objectMap, "kinds", e.Kinds) + populate(objectMap, "numberOfBucket", e.NumberOfBucket) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTimelineParameters. +func (e *EntityTimelineParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) + delete(rawMsg, key) + case "kinds": + err = unpopulate(val, "Kinds", &e.Kinds) + delete(rawMsg, key) + case "numberOfBucket": + err = unpopulate(val, "NumberOfBucket", &e.NumberOfBucket) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EntityTimelineResponse. +func (e EntityTimelineResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metaData", e.MetaData) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTimelineResponse. +func (e *EntityTimelineResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metaData": + err = unpopulate(val, "MetaData", &e.MetaData) + delete(rawMsg, key) + case "value": + e.Value, err = unmarshalEntityTimelineItemClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventGroupingSettings. +func (e EventGroupingSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationKind", e.AggregationKind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGroupingSettings. +func (e *EventGroupingSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationKind": + err = unpopulate(val, "AggregationKind", &e.AggregationKind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpansionEntityQueriesProperties. +func (e ExpansionEntityQueriesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataSources", e.DataSources) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "inputEntityType", e.InputEntityType) + populate(objectMap, "inputFields", e.InputFields) + populate(objectMap, "outputEntityTypes", e.OutputEntityTypes) + populate(objectMap, "queryTemplate", e.QueryTemplate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpansionEntityQueriesProperties. +func (e *ExpansionEntityQueriesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSources": + err = unpopulate(val, "DataSources", &e.DataSources) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "inputEntityType": + err = unpopulate(val, "InputEntityType", &e.InputEntityType) + delete(rawMsg, key) + case "inputFields": + err = unpopulate(val, "InputFields", &e.InputFields) + delete(rawMsg, key) + case "outputEntityTypes": + err = unpopulate(val, "OutputEntityTypes", &e.OutputEntityTypes) + delete(rawMsg, key) + case "queryTemplate": + err = unpopulate(val, "QueryTemplate", &e.QueryTemplate) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpansionEntityQuery. +func (e ExpansionEntityQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + objectMap["kind"] = EntityQueryKindExpansion + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpansionEntityQuery. +func (e *ExpansionEntityQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpansionResultAggregation. +func (e ExpansionResultAggregation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", e.AggregationType) + populate(objectMap, "count", e.Count) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "entityKind", e.EntityKind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpansionResultAggregation. +func (e *ExpansionResultAggregation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationType": + err = unpopulate(val, "AggregationType", &e.AggregationType) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &e.Count) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "entityKind": + err = unpopulate(val, "EntityKind", &e.EntityKind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExpansionResultsMetadata. +func (e ExpansionResultsMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregations", e.Aggregations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExpansionResultsMetadata. +func (e *ExpansionResultsMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregations": + err = unpopulate(val, "Aggregations", &e.Aggregations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EyesOn. +func (e EyesOn) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + objectMap["kind"] = SettingKindEyesOn + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EyesOn. +func (e *EyesOn) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EyesOnSettingsProperties. +func (e EyesOnSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isEnabled", e.IsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EyesOnSettingsProperties. +func (e *EyesOnSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isEnabled": + err = unpopulate(val, "IsEnabled", &e.IsEnabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FieldMapping. +func (f FieldMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnName", f.ColumnName) + populate(objectMap, "identifier", f.Identifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FieldMapping. +func (f *FieldMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columnName": + err = unpopulate(val, "ColumnName", &f.ColumnName) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &f.Identifier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileEntity. +func (f FileEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + objectMap["kind"] = EntityKindFile + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileEntity. +func (f *FileEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &f.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileEntityProperties. +func (f FileEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", f.AdditionalData) + populate(objectMap, "directory", f.Directory) + populate(objectMap, "fileHashEntityIds", f.FileHashEntityIDs) + populate(objectMap, "fileName", f.FileName) + populate(objectMap, "friendlyName", f.FriendlyName) + populate(objectMap, "hostEntityId", f.HostEntityID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileEntityProperties. +func (f *FileEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &f.AdditionalData) + delete(rawMsg, key) + case "directory": + err = unpopulate(val, "Directory", &f.Directory) + delete(rawMsg, key) + case "fileHashEntityIds": + err = unpopulate(val, "FileHashEntityIDs", &f.FileHashEntityIDs) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &f.FileName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &f.FriendlyName) + delete(rawMsg, key) + case "hostEntityId": + err = unpopulate(val, "HostEntityID", &f.HostEntityID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileHashEntity. +func (f FileHashEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + objectMap["kind"] = EntityKindFileHash + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileHashEntity. +func (f *FileHashEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &f.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileHashEntityProperties. +func (f FileHashEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", f.AdditionalData) + populate(objectMap, "algorithm", f.Algorithm) + populate(objectMap, "friendlyName", f.FriendlyName) + populate(objectMap, "hashValue", f.HashValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileHashEntityProperties. +func (f *FileHashEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &f.AdditionalData) + delete(rawMsg, key) + case "algorithm": + err = unpopulate(val, "Algorithm", &f.Algorithm) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &f.FriendlyName) + delete(rawMsg, key) + case "hashValue": + err = unpopulate(val, "HashValue", &f.HashValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileImport. +func (f FileImport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileImport. +func (f *FileImport) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileImportList. +func (f FileImportList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileImportList. +func (f *FileImportList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileImportProperties. +func (f FileImportProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentType", f.ContentType) + populateTimeRFC3339(objectMap, "createdTimeUTC", f.CreatedTimeUTC) + populate(objectMap, "errorFile", f.ErrorFile) + populate(objectMap, "errorsPreview", f.ErrorsPreview) + populateTimeRFC3339(objectMap, "filesValidUntilTimeUTC", f.FilesValidUntilTimeUTC) + populate(objectMap, "importFile", f.ImportFile) + populateTimeRFC3339(objectMap, "importValidUntilTimeUTC", f.ImportValidUntilTimeUTC) + populate(objectMap, "ingestedRecordCount", f.IngestedRecordCount) + populate(objectMap, "ingestionMode", f.IngestionMode) + populate(objectMap, "source", f.Source) + populate(objectMap, "state", f.State) + populate(objectMap, "totalRecordCount", f.TotalRecordCount) + populate(objectMap, "validRecordCount", f.ValidRecordCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileImportProperties. +func (f *FileImportProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentType": + err = unpopulate(val, "ContentType", &f.ContentType) + delete(rawMsg, key) + case "createdTimeUTC": + err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &f.CreatedTimeUTC) + delete(rawMsg, key) + case "errorFile": + err = unpopulate(val, "ErrorFile", &f.ErrorFile) + delete(rawMsg, key) + case "errorsPreview": + err = unpopulate(val, "ErrorsPreview", &f.ErrorsPreview) + delete(rawMsg, key) + case "filesValidUntilTimeUTC": + err = unpopulateTimeRFC3339(val, "FilesValidUntilTimeUTC", &f.FilesValidUntilTimeUTC) + delete(rawMsg, key) + case "importFile": + err = unpopulate(val, "ImportFile", &f.ImportFile) + delete(rawMsg, key) + case "importValidUntilTimeUTC": + err = unpopulateTimeRFC3339(val, "ImportValidUntilTimeUTC", &f.ImportValidUntilTimeUTC) + delete(rawMsg, key) + case "ingestedRecordCount": + err = unpopulate(val, "IngestedRecordCount", &f.IngestedRecordCount) + delete(rawMsg, key) + case "ingestionMode": + err = unpopulate(val, "IngestionMode", &f.IngestionMode) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &f.Source) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &f.State) + delete(rawMsg, key) + case "totalRecordCount": + err = unpopulate(val, "TotalRecordCount", &f.TotalRecordCount) + delete(rawMsg, key) + case "validRecordCount": + err = unpopulate(val, "ValidRecordCount", &f.ValidRecordCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileMetadata. +func (f FileMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteStatus", f.DeleteStatus) + populate(objectMap, "fileContentUri", f.FileContentURI) + populate(objectMap, "fileFormat", f.FileFormat) + populate(objectMap, "fileName", f.FileName) + populate(objectMap, "fileSize", f.FileSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileMetadata. +func (f *FileMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deleteStatus": + err = unpopulate(val, "DeleteStatus", &f.DeleteStatus) + delete(rawMsg, key) + case "fileContentUri": + err = unpopulate(val, "FileContentURI", &f.FileContentURI) + delete(rawMsg, key) + case "fileFormat": + err = unpopulate(val, "FileFormat", &f.FileFormat) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &f.FileName) + delete(rawMsg, key) + case "fileSize": + err = unpopulate(val, "FileSize", &f.FileSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionAlertRule. +func (f FusionAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "id", f.ID) + objectMap["kind"] = AlertRuleKindFusion + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRule. +func (f *FusionAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &f.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleProperties. +func (f FusionAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRuleTemplateName", f.AlertRuleTemplateName) + populate(objectMap, "description", f.Description) + populate(objectMap, "displayName", f.DisplayName) + populate(objectMap, "enabled", f.Enabled) + populateTimeRFC3339(objectMap, "lastModifiedUtc", f.LastModifiedUTC) + populate(objectMap, "scenarioExclusionPatterns", f.ScenarioExclusionPatterns) + populate(objectMap, "severity", f.Severity) + populate(objectMap, "sourceSettings", f.SourceSettings) + populate(objectMap, "tactics", f.Tactics) + populate(objectMap, "techniques", f.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleProperties. +func (f *FusionAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &f.AlertRuleTemplateName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &f.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &f.LastModifiedUTC) + delete(rawMsg, key) + case "scenarioExclusionPatterns": + err = unpopulate(val, "ScenarioExclusionPatterns", &f.ScenarioExclusionPatterns) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &f.Severity) + delete(rawMsg, key) + case "sourceSettings": + err = unpopulate(val, "SourceSettings", &f.SourceSettings) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &f.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &f.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleTemplate. +func (f FusionAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + objectMap["kind"] = AlertRuleKindFusion + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleTemplate. +func (f *FusionAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &f.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleTemplateProperties. +func (f FusionAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRulesCreatedByTemplateCount", f.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", f.CreatedDateUTC) + populate(objectMap, "description", f.Description) + populate(objectMap, "displayName", f.DisplayName) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", f.LastUpdatedDateUTC) + populate(objectMap, "requiredDataConnectors", f.RequiredDataConnectors) + populate(objectMap, "severity", f.Severity) + populate(objectMap, "sourceSettings", f.SourceSettings) + populate(objectMap, "status", f.Status) + populate(objectMap, "tactics", f.Tactics) + populate(objectMap, "techniques", f.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleTemplateProperties. +func (f *FusionAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &f.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &f.CreatedDateUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &f.DisplayName) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &f.LastUpdatedDateUTC) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &f.RequiredDataConnectors) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &f.Severity) + delete(rawMsg, key) + case "sourceSettings": + err = unpopulate(val, "SourceSettings", &f.SourceSettings) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &f.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &f.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionScenarioExclusionPattern. +func (f FusionScenarioExclusionPattern) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dateAddedInUTC", f.DateAddedInUTC) + populate(objectMap, "exclusionPattern", f.ExclusionPattern) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionScenarioExclusionPattern. +func (f *FusionScenarioExclusionPattern) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dateAddedInUTC": + err = unpopulate(val, "DateAddedInUTC", &f.DateAddedInUTC) + delete(rawMsg, key) + case "exclusionPattern": + err = unpopulate(val, "ExclusionPattern", &f.ExclusionPattern) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionSourceSettings. +func (f FusionSourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "sourceName", f.SourceName) + populate(objectMap, "sourceSubTypes", f.SourceSubTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionSourceSettings. +func (f *FusionSourceSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "sourceName": + err = unpopulate(val, "SourceName", &f.SourceName) + delete(rawMsg, key) + case "sourceSubTypes": + err = unpopulate(val, "SourceSubTypes", &f.SourceSubTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionSourceSubTypeSetting. +func (f FusionSourceSubTypeSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "severityFilters", f.SeverityFilters) + populate(objectMap, "sourceSubTypeDisplayName", f.SourceSubTypeDisplayName) + populate(objectMap, "sourceSubTypeName", f.SourceSubTypeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionSourceSubTypeSetting. +func (f *FusionSourceSubTypeSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "severityFilters": + err = unpopulate(val, "SeverityFilters", &f.SeverityFilters) + delete(rawMsg, key) + case "sourceSubTypeDisplayName": + err = unpopulate(val, "SourceSubTypeDisplayName", &f.SourceSubTypeDisplayName) + delete(rawMsg, key) + case "sourceSubTypeName": + err = unpopulate(val, "SourceSubTypeName", &f.SourceSubTypeName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionSubTypeSeverityFilter. +func (f FusionSubTypeSeverityFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filters", f.Filters) + populate(objectMap, "isSupported", f.IsSupported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionSubTypeSeverityFilter. +func (f *FusionSubTypeSeverityFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filters": + err = unpopulate(val, "Filters", &f.Filters) + delete(rawMsg, key) + case "isSupported": + err = unpopulate(val, "IsSupported", &f.IsSupported) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionSubTypeSeverityFiltersItem. +func (f FusionSubTypeSeverityFiltersItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", f.Enabled) + populate(objectMap, "severity", f.Severity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionSubTypeSeverityFiltersItem. +func (f *FusionSubTypeSeverityFiltersItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &f.Enabled) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &f.Severity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionTemplateSourceSetting. +func (f FusionTemplateSourceSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceName", f.SourceName) + populate(objectMap, "sourceSubTypes", f.SourceSubTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionTemplateSourceSetting. +func (f *FusionTemplateSourceSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sourceName": + err = unpopulate(val, "SourceName", &f.SourceName) + delete(rawMsg, key) + case "sourceSubTypes": + err = unpopulate(val, "SourceSubTypes", &f.SourceSubTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionTemplateSourceSubType. +func (f FusionTemplateSourceSubType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "severityFilter", f.SeverityFilter) + populate(objectMap, "sourceSubTypeDisplayName", f.SourceSubTypeDisplayName) + populate(objectMap, "sourceSubTypeName", f.SourceSubTypeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionTemplateSourceSubType. +func (f *FusionTemplateSourceSubType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "severityFilter": + err = unpopulate(val, "SeverityFilter", &f.SeverityFilter) + delete(rawMsg, key) + case "sourceSubTypeDisplayName": + err = unpopulate(val, "SourceSubTypeDisplayName", &f.SourceSubTypeDisplayName) + delete(rawMsg, key) + case "sourceSubTypeName": + err = unpopulate(val, "SourceSubTypeName", &f.SourceSubTypeName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FusionTemplateSubTypeSeverityFilter. +func (f FusionTemplateSubTypeSeverityFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isSupported", f.IsSupported) + populate(objectMap, "severityFilters", f.SeverityFilters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FusionTemplateSubTypeSeverityFilter. +func (f *FusionTemplateSubTypeSeverityFilter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isSupported": + err = unpopulate(val, "IsSupported", &f.IsSupported) + delete(rawMsg, key) + case "severityFilters": + err = unpopulate(val, "SeverityFilters", &f.SeverityFilters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GeoLocation. +func (g GeoLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "asn", g.Asn) + populate(objectMap, "city", g.City) + populate(objectMap, "countryCode", g.CountryCode) + populate(objectMap, "countryName", g.CountryName) + populate(objectMap, "latitude", g.Latitude) + populate(objectMap, "longitude", g.Longitude) + populate(objectMap, "state", g.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GeoLocation. +func (g *GeoLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "asn": + err = unpopulate(val, "Asn", &g.Asn) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &g.City) + delete(rawMsg, key) + case "countryCode": + err = unpopulate(val, "CountryCode", &g.CountryCode) + delete(rawMsg, key) + case "countryName": + err = unpopulate(val, "CountryName", &g.CountryName) + delete(rawMsg, key) + case "latitude": + err = unpopulate(val, "Latitude", &g.Latitude) + delete(rawMsg, key) + case "longitude": + err = unpopulate(val, "Longitude", &g.Longitude) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &g.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetInsightsErrorKind. +func (g GetInsightsErrorKind) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessage", g.ErrorMessage) + populate(objectMap, "kind", g.Kind) + populate(objectMap, "queryId", g.QueryID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetInsightsErrorKind. +func (g *GetInsightsErrorKind) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &g.ErrorMessage) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &g.Kind) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, "QueryID", &g.QueryID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetInsightsResultsMetadata. +func (g GetInsightsResultsMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errors", g.Errors) + populate(objectMap, "totalCount", g.TotalCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetInsightsResultsMetadata. +func (g *GetInsightsResultsMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errors": + err = unpopulate(val, "Errors", &g.Errors) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &g.TotalCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetQueriesResponse. +func (g GetQueriesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetQueriesResponse. +func (g *GetQueriesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + g.Value, err = unmarshalEntityQueryItemClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GitHubResourceInfo. +func (g GitHubResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "appInstallationId", g.AppInstallationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubResourceInfo. +func (g *GitHubResourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appInstallationId": + err = unpopulate(val, "AppInstallationID", &g.AppInstallationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupingConfiguration. +func (g GroupingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", g.Enabled) + populate(objectMap, "groupByAlertDetails", g.GroupByAlertDetails) + populate(objectMap, "groupByCustomDetails", g.GroupByCustomDetails) + populate(objectMap, "groupByEntities", g.GroupByEntities) + populate(objectMap, "lookbackDuration", g.LookbackDuration) + populate(objectMap, "matchingMethod", g.MatchingMethod) + populate(objectMap, "reopenClosedIncident", g.ReopenClosedIncident) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupingConfiguration. +func (g *GroupingConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &g.Enabled) + delete(rawMsg, key) + case "groupByAlertDetails": + err = unpopulate(val, "GroupByAlertDetails", &g.GroupByAlertDetails) + delete(rawMsg, key) + case "groupByCustomDetails": + err = unpopulate(val, "GroupByCustomDetails", &g.GroupByCustomDetails) + delete(rawMsg, key) + case "groupByEntities": + err = unpopulate(val, "GroupByEntities", &g.GroupByEntities) + delete(rawMsg, key) + case "lookbackDuration": + err = unpopulate(val, "LookbackDuration", &g.LookbackDuration) + delete(rawMsg, key) + case "matchingMethod": + err = unpopulate(val, "MatchingMethod", &g.MatchingMethod) + delete(rawMsg, key) + case "reopenClosedIncident": + err = unpopulate(val, "ReopenClosedIncident", &g.ReopenClosedIncident) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HostEntity. +func (h HostEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", h.ID) + objectMap["kind"] = EntityKindHost + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HostEntity. +func (h *HostEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &h.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HostEntityProperties. +func (h HostEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", h.AdditionalData) + populate(objectMap, "azureID", h.AzureID) + populate(objectMap, "dnsDomain", h.DNSDomain) + populate(objectMap, "friendlyName", h.FriendlyName) + populate(objectMap, "hostName", h.HostName) + populate(objectMap, "isDomainJoined", h.IsDomainJoined) + populate(objectMap, "netBiosName", h.NetBiosName) + populate(objectMap, "ntDomain", h.NtDomain) + populate(objectMap, "osFamily", h.OSFamily) + populate(objectMap, "osVersion", h.OSVersion) + populate(objectMap, "omsAgentID", h.OmsAgentID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HostEntityProperties. +func (h *HostEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &h.AdditionalData) + delete(rawMsg, key) + case "azureID": + err = unpopulate(val, "AzureID", &h.AzureID) + delete(rawMsg, key) + case "dnsDomain": + err = unpopulate(val, "DNSDomain", &h.DNSDomain) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &h.FriendlyName) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &h.HostName) + delete(rawMsg, key) + case "isDomainJoined": + err = unpopulate(val, "IsDomainJoined", &h.IsDomainJoined) + delete(rawMsg, key) + case "netBiosName": + err = unpopulate(val, "NetBiosName", &h.NetBiosName) + delete(rawMsg, key) + case "ntDomain": + err = unpopulate(val, "NtDomain", &h.NtDomain) + delete(rawMsg, key) + case "osFamily": + err = unpopulate(val, "OSFamily", &h.OSFamily) + delete(rawMsg, key) + case "osVersion": + err = unpopulate(val, "OSVersion", &h.OSVersion) + delete(rawMsg, key) + case "omsAgentID": + err = unpopulate(val, "OmsAgentID", &h.OmsAgentID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HuntingBookmark. +func (h HuntingBookmark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", h.ID) + objectMap["kind"] = EntityKindBookmark + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HuntingBookmark. +func (h *HuntingBookmark) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &h.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HuntingBookmarkProperties. +func (h HuntingBookmarkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", h.AdditionalData) + populateTimeRFC3339(objectMap, "created", h.Created) + populate(objectMap, "createdBy", h.CreatedBy) + populate(objectMap, "displayName", h.DisplayName) + populateTimeRFC3339(objectMap, "eventTime", h.EventTime) + populate(objectMap, "friendlyName", h.FriendlyName) + populate(objectMap, "incidentInfo", h.IncidentInfo) + populate(objectMap, "labels", h.Labels) + populate(objectMap, "notes", h.Notes) + populate(objectMap, "query", h.Query) + populate(objectMap, "queryResult", h.QueryResult) + populateTimeRFC3339(objectMap, "updated", h.Updated) + populate(objectMap, "updatedBy", h.UpdatedBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HuntingBookmarkProperties. +func (h *HuntingBookmarkProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &h.AdditionalData) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, "Created", &h.Created) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &h.CreatedBy) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &h.DisplayName) + delete(rawMsg, key) + case "eventTime": + err = unpopulateTimeRFC3339(val, "EventTime", &h.EventTime) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &h.FriendlyName) + delete(rawMsg, key) + case "incidentInfo": + err = unpopulate(val, "IncidentInfo", &h.IncidentInfo) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &h.Labels) + delete(rawMsg, key) + case "notes": + err = unpopulate(val, "Notes", &h.Notes) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &h.Query) + delete(rawMsg, key) + case "queryResult": + err = unpopulate(val, "QueryResult", &h.QueryResult) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &h.Updated) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &h.UpdatedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPEntity. +func (i IPEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + objectMap["kind"] = EntityKindIP + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPEntity. +func (i *IPEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPEntityProperties. +func (i IPEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", i.AdditionalData) + populate(objectMap, "address", i.Address) + populate(objectMap, "friendlyName", i.FriendlyName) + populate(objectMap, "location", i.Location) + populate(objectMap, "threatIntelligence", i.ThreatIntelligence) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPEntityProperties. +func (i *IPEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &i.AdditionalData) + delete(rawMsg, key) + case "address": + err = unpopulate(val, "Address", &i.Address) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &i.FriendlyName) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "threatIntelligence": + err = unpopulate(val, "ThreatIntelligence", &i.ThreatIntelligence) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Incident. +func (i Incident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Incident. +func (i *Incident) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentAdditionalData. +func (i IncidentAdditionalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertProductNames", i.AlertProductNames) + populate(objectMap, "alertsCount", i.AlertsCount) + populate(objectMap, "bookmarksCount", i.BookmarksCount) + populate(objectMap, "commentsCount", i.CommentsCount) + populate(objectMap, "providerIncidentUrl", i.ProviderIncidentURL) + populate(objectMap, "tactics", i.Tactics) + populate(objectMap, "techniques", i.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentAdditionalData. +func (i *IncidentAdditionalData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertProductNames": + err = unpopulate(val, "AlertProductNames", &i.AlertProductNames) + delete(rawMsg, key) + case "alertsCount": + err = unpopulate(val, "AlertsCount", &i.AlertsCount) + delete(rawMsg, key) + case "bookmarksCount": + err = unpopulate(val, "BookmarksCount", &i.BookmarksCount) + delete(rawMsg, key) + case "commentsCount": + err = unpopulate(val, "CommentsCount", &i.CommentsCount) + delete(rawMsg, key) + case "providerIncidentUrl": + err = unpopulate(val, "ProviderIncidentURL", &i.ProviderIncidentURL) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &i.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &i.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentAlertList. +func (i IncidentAlertList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentAlertList. +func (i *IncidentAlertList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentBookmarkList. +func (i IncidentBookmarkList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentBookmarkList. +func (i *IncidentBookmarkList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentComment. +func (i IncidentComment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentComment. +func (i *IncidentComment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentCommentList. +func (i IncidentCommentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentCommentList. +func (i *IncidentCommentList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentCommentProperties. +func (i IncidentCommentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "author", i.Author) + populateTimeRFC3339(objectMap, "createdTimeUtc", i.CreatedTimeUTC) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", i.LastModifiedTimeUTC) + populate(objectMap, "message", i.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentCommentProperties. +func (i *IncidentCommentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &i.Author) + delete(rawMsg, key) + case "createdTimeUtc": + err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &i.CreatedTimeUTC) + delete(rawMsg, key) + case "lastModifiedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &i.LastModifiedTimeUTC) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &i.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentConfiguration. +func (i IncidentConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createIncident", i.CreateIncident) + populate(objectMap, "groupingConfiguration", i.GroupingConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentConfiguration. +func (i *IncidentConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createIncident": + err = unpopulate(val, "CreateIncident", &i.CreateIncident) + delete(rawMsg, key) + case "groupingConfiguration": + err = unpopulate(val, "GroupingConfiguration", &i.GroupingConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentEntitiesResponse. +func (i IncidentEntitiesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "entities", i.Entities) + populate(objectMap, "metaData", i.MetaData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentEntitiesResponse. +func (i *IncidentEntitiesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "entities": + i.Entities, err = unmarshalEntityClassificationArray(val) + delete(rawMsg, key) + case "metaData": + err = unpopulate(val, "MetaData", &i.MetaData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentEntitiesResultsMetadata. +func (i IncidentEntitiesResultsMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", i.Count) + populate(objectMap, "entityKind", i.EntityKind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentEntitiesResultsMetadata. +func (i *IncidentEntitiesResultsMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &i.Count) + delete(rawMsg, key) + case "entityKind": + err = unpopulate(val, "EntityKind", &i.EntityKind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentInfo. +func (i IncidentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "incidentId", i.IncidentID) + populate(objectMap, "relationName", i.RelationName) + populate(objectMap, "severity", i.Severity) + populate(objectMap, "title", i.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentInfo. +func (i *IncidentInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "incidentId": + err = unpopulate(val, "IncidentID", &i.IncidentID) + delete(rawMsg, key) + case "relationName": + err = unpopulate(val, "RelationName", &i.RelationName) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &i.Severity) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &i.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentLabel. +func (i IncidentLabel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "labelName", i.LabelName) + populate(objectMap, "labelType", i.LabelType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentLabel. +func (i *IncidentLabel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "labelName": + err = unpopulate(val, "LabelName", &i.LabelName) + delete(rawMsg, key) + case "labelType": + err = unpopulate(val, "LabelType", &i.LabelType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentList. +func (i IncidentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentList. +func (i *IncidentList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentOwnerInfo. +func (i IncidentOwnerInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assignedTo", i.AssignedTo) + populate(objectMap, "email", i.Email) + populate(objectMap, "objectId", i.ObjectID) + populate(objectMap, "ownerType", i.OwnerType) + populate(objectMap, "userPrincipalName", i.UserPrincipalName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentOwnerInfo. +func (i *IncidentOwnerInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignedTo": + err = unpopulate(val, "AssignedTo", &i.AssignedTo) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &i.Email) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &i.ObjectID) + delete(rawMsg, key) + case "ownerType": + err = unpopulate(val, "OwnerType", &i.OwnerType) + delete(rawMsg, key) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &i.UserPrincipalName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentProperties. +func (i IncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", i.AdditionalData) + populate(objectMap, "classification", i.Classification) + populate(objectMap, "classificationComment", i.ClassificationComment) + populate(objectMap, "classificationReason", i.ClassificationReason) + populateTimeRFC3339(objectMap, "createdTimeUtc", i.CreatedTimeUTC) + populate(objectMap, "description", i.Description) + populateTimeRFC3339(objectMap, "firstActivityTimeUtc", i.FirstActivityTimeUTC) + populate(objectMap, "incidentNumber", i.IncidentNumber) + populate(objectMap, "incidentUrl", i.IncidentURL) + populate(objectMap, "labels", i.Labels) + populateTimeRFC3339(objectMap, "lastActivityTimeUtc", i.LastActivityTimeUTC) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", i.LastModifiedTimeUTC) + populate(objectMap, "owner", i.Owner) + populate(objectMap, "providerIncidentId", i.ProviderIncidentID) + populate(objectMap, "providerName", i.ProviderName) + populate(objectMap, "relatedAnalyticRuleIds", i.RelatedAnalyticRuleIDs) + populate(objectMap, "severity", i.Severity) + populate(objectMap, "status", i.Status) + populate(objectMap, "teamInformation", i.TeamInformation) + populate(objectMap, "title", i.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentProperties. +func (i *IncidentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &i.AdditionalData) + delete(rawMsg, key) + case "classification": + err = unpopulate(val, "Classification", &i.Classification) + delete(rawMsg, key) + case "classificationComment": + err = unpopulate(val, "ClassificationComment", &i.ClassificationComment) + delete(rawMsg, key) + case "classificationReason": + err = unpopulate(val, "ClassificationReason", &i.ClassificationReason) + delete(rawMsg, key) + case "createdTimeUtc": + err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &i.CreatedTimeUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "firstActivityTimeUtc": + err = unpopulateTimeRFC3339(val, "FirstActivityTimeUTC", &i.FirstActivityTimeUTC) + delete(rawMsg, key) + case "incidentNumber": + err = unpopulate(val, "IncidentNumber", &i.IncidentNumber) + delete(rawMsg, key) + case "incidentUrl": + err = unpopulate(val, "IncidentURL", &i.IncidentURL) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &i.Labels) + delete(rawMsg, key) + case "lastActivityTimeUtc": + err = unpopulateTimeRFC3339(val, "LastActivityTimeUTC", &i.LastActivityTimeUTC) + delete(rawMsg, key) + case "lastModifiedTimeUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &i.LastModifiedTimeUTC) + delete(rawMsg, key) + case "owner": + err = unpopulate(val, "Owner", &i.Owner) + delete(rawMsg, key) + case "providerIncidentId": + err = unpopulate(val, "ProviderIncidentID", &i.ProviderIncidentID) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &i.ProviderName) + delete(rawMsg, key) + case "relatedAnalyticRuleIds": + err = unpopulate(val, "RelatedAnalyticRuleIDs", &i.RelatedAnalyticRuleIDs) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &i.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "teamInformation": + err = unpopulate(val, "TeamInformation", &i.TeamInformation) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &i.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentPropertiesAction. +func (i IncidentPropertiesAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classification", i.Classification) + populate(objectMap, "classificationComment", i.ClassificationComment) + populate(objectMap, "classificationReason", i.ClassificationReason) + populate(objectMap, "labels", i.Labels) + populate(objectMap, "owner", i.Owner) + populate(objectMap, "severity", i.Severity) + populate(objectMap, "status", i.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentPropertiesAction. +func (i *IncidentPropertiesAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classification": + err = unpopulate(val, "Classification", &i.Classification) + delete(rawMsg, key) + case "classificationComment": + err = unpopulate(val, "ClassificationComment", &i.ClassificationComment) + delete(rawMsg, key) + case "classificationReason": + err = unpopulate(val, "ClassificationReason", &i.ClassificationReason) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &i.Labels) + delete(rawMsg, key) + case "owner": + err = unpopulate(val, "Owner", &i.Owner) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &i.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItem. +func (i InsightQueryItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + objectMap["kind"] = EntityQueryKindInsight + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItem. +func (i *InsightQueryItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemProperties. +func (i InsightQueryItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalQuery", i.AdditionalQuery) + populate(objectMap, "baseQuery", i.BaseQuery) + populate(objectMap, "chartQuery", &i.ChartQuery) + populate(objectMap, "dataTypes", i.DataTypes) + populate(objectMap, "defaultTimeRange", i.DefaultTimeRange) + populate(objectMap, "description", i.Description) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "entitiesFilter", &i.EntitiesFilter) + populate(objectMap, "inputEntityType", i.InputEntityType) + populate(objectMap, "referenceTimeRange", i.ReferenceTimeRange) + populate(objectMap, "requiredInputFieldsSets", i.RequiredInputFieldsSets) + populate(objectMap, "tableQuery", i.TableQuery) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemProperties. +func (i *InsightQueryItemProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalQuery": + err = unpopulate(val, "AdditionalQuery", &i.AdditionalQuery) + delete(rawMsg, key) + case "baseQuery": + err = unpopulate(val, "BaseQuery", &i.BaseQuery) + delete(rawMsg, key) + case "chartQuery": + err = unpopulate(val, "ChartQuery", &i.ChartQuery) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &i.DataTypes) + delete(rawMsg, key) + case "defaultTimeRange": + err = unpopulate(val, "DefaultTimeRange", &i.DefaultTimeRange) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "entitiesFilter": + err = unpopulate(val, "EntitiesFilter", &i.EntitiesFilter) + delete(rawMsg, key) + case "inputEntityType": + err = unpopulate(val, "InputEntityType", &i.InputEntityType) + delete(rawMsg, key) + case "referenceTimeRange": + err = unpopulate(val, "ReferenceTimeRange", &i.ReferenceTimeRange) + delete(rawMsg, key) + case "requiredInputFieldsSets": + err = unpopulate(val, "RequiredInputFieldsSets", &i.RequiredInputFieldsSets) + delete(rawMsg, key) + case "tableQuery": + err = unpopulate(val, "TableQuery", &i.TableQuery) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesAdditionalQuery. +func (i InsightQueryItemPropertiesAdditionalQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "query", i.Query) + populate(objectMap, "text", i.Text) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesAdditionalQuery. +func (i *InsightQueryItemPropertiesAdditionalQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "query": + err = unpopulate(val, "Query", &i.Query) + delete(rawMsg, key) + case "text": + err = unpopulate(val, "Text", &i.Text) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesDefaultTimeRange. +func (i InsightQueryItemPropertiesDefaultTimeRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "afterRange", i.AfterRange) + populate(objectMap, "beforeRange", i.BeforeRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesDefaultTimeRange. +func (i *InsightQueryItemPropertiesDefaultTimeRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "afterRange": + err = unpopulate(val, "AfterRange", &i.AfterRange) + delete(rawMsg, key) + case "beforeRange": + err = unpopulate(val, "BeforeRange", &i.BeforeRange) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesReferenceTimeRange. +func (i InsightQueryItemPropertiesReferenceTimeRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "beforeRange", i.BeforeRange) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesReferenceTimeRange. +func (i *InsightQueryItemPropertiesReferenceTimeRange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "beforeRange": + err = unpopulate(val, "BeforeRange", &i.BeforeRange) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesTableQuery. +func (i InsightQueryItemPropertiesTableQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnsDefinitions", i.ColumnsDefinitions) + populate(objectMap, "queriesDefinitions", i.QueriesDefinitions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesTableQuery. +func (i *InsightQueryItemPropertiesTableQuery) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columnsDefinitions": + err = unpopulate(val, "ColumnsDefinitions", &i.ColumnsDefinitions) + delete(rawMsg, key) + case "queriesDefinitions": + err = unpopulate(val, "QueriesDefinitions", &i.QueriesDefinitions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem. +func (i InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "header", i.Header) + populate(objectMap, "outputType", i.OutputType) + populate(objectMap, "supportDeepLink", i.SupportDeepLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem. +func (i *InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "header": + err = unpopulate(val, "Header", &i.Header) + delete(rawMsg, key) + case "outputType": + err = unpopulate(val, "OutputType", &i.OutputType) + delete(rawMsg, key) + case "supportDeepLink": + err = unpopulate(val, "SupportDeepLink", &i.SupportDeepLink) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem. +func (i InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filter", i.Filter) + populate(objectMap, "linkColumnsDefinitions", i.LinkColumnsDefinitions) + populate(objectMap, "project", i.Project) + populate(objectMap, "summarize", i.Summarize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem. +func (i *InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filter": + err = unpopulate(val, "Filter", &i.Filter) + delete(rawMsg, key) + case "linkColumnsDefinitions": + err = unpopulate(val, "LinkColumnsDefinitions", &i.LinkColumnsDefinitions) + delete(rawMsg, key) + case "project": + err = unpopulate(val, "Project", &i.Project) + delete(rawMsg, key) + case "summarize": + err = unpopulate(val, "Summarize", &i.Summarize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem. +func (i InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "projectedName", i.ProjectedName) + populate(objectMap, "Query", i.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem. +func (i *InsightQueryItemPropertiesTableQueryQueriesDefinitionsPropertiesItemsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "projectedName": + err = unpopulate(val, "ProjectedName", &i.ProjectedName) + delete(rawMsg, key) + case "Query": + err = unpopulate(val, "Query", &i.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightsTableResult. +func (i InsightsTableResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columns", i.Columns) + populate(objectMap, "rows", i.Rows) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightsTableResult. +func (i *InsightsTableResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &i.Columns) + delete(rawMsg, key) + case "rows": + err = unpopulate(val, "Rows", &i.Rows) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InsightsTableResultColumnsItem. +func (i InsightsTableResultColumnsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", i.Name) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InsightsTableResultColumnsItem. +func (i *InsightsTableResultColumnsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InstructionStepsInstructionsItem. +func (i InstructionStepsInstructionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "parameters", &i.Parameters) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstructionStepsInstructionsItem. +func (i *InstructionStepsInstructionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "parameters": + err = unpopulate(val, "Parameters", &i.Parameters) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTCheckRequirements. +func (i IoTCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindIOT + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTCheckRequirements. +func (i *IoTCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTCheckRequirementsProperties. +func (i IoTCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "subscriptionId", i.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTCheckRequirementsProperties. +func (i *IoTCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &i.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTDataConnector. +func (i IoTDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "id", i.ID) + objectMap["kind"] = DataConnectorKindIOT + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDataConnector. +func (i *IoTDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &i.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTDataConnectorProperties. +func (i IoTDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", i.DataTypes) + populate(objectMap, "subscriptionId", i.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDataConnectorProperties. +func (i *IoTDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &i.DataTypes) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &i.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTDeviceEntity. +func (i IoTDeviceEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + objectMap["kind"] = EntityKindIoTDevice + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDeviceEntity. +func (i *IoTDeviceEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &i.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IoTDeviceEntityProperties. +func (i IoTDeviceEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", i.AdditionalData) + populate(objectMap, "deviceId", i.DeviceID) + populate(objectMap, "deviceName", i.DeviceName) + populate(objectMap, "deviceSubType", i.DeviceSubType) + populate(objectMap, "deviceType", i.DeviceType) + populate(objectMap, "edgeId", i.EdgeID) + populate(objectMap, "firmwareVersion", i.FirmwareVersion) + populate(objectMap, "friendlyName", i.FriendlyName) + populate(objectMap, "hostEntityId", i.HostEntityID) + populate(objectMap, "ipAddressEntityId", i.IPAddressEntityID) + populate(objectMap, "importance", i.Importance) + populate(objectMap, "iotHubEntityId", i.IotHubEntityID) + populate(objectMap, "iotSecurityAgentId", i.IotSecurityAgentID) + populate(objectMap, "isAuthorized", i.IsAuthorized) + populate(objectMap, "isProgramming", i.IsProgramming) + populate(objectMap, "isScanner", i.IsScanner) + populate(objectMap, "macAddress", i.MacAddress) + populate(objectMap, "model", i.Model) + populate(objectMap, "nicEntityIds", i.NicEntityIDs) + populate(objectMap, "operatingSystem", i.OperatingSystem) + populate(objectMap, "owners", i.Owners) + populate(objectMap, "protocols", i.Protocols) + populate(objectMap, "purdueLayer", i.PurdueLayer) + populate(objectMap, "sensor", i.Sensor) + populate(objectMap, "serialNumber", i.SerialNumber) + populate(objectMap, "site", i.Site) + populate(objectMap, "source", i.Source) + populate(objectMap, "threatIntelligence", i.ThreatIntelligence) + populate(objectMap, "vendor", i.Vendor) + populate(objectMap, "zone", i.Zone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDeviceEntityProperties. +func (i *IoTDeviceEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &i.AdditionalData) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &i.DeviceID) + delete(rawMsg, key) + case "deviceName": + err = unpopulate(val, "DeviceName", &i.DeviceName) + delete(rawMsg, key) + case "deviceSubType": + err = unpopulate(val, "DeviceSubType", &i.DeviceSubType) + delete(rawMsg, key) + case "deviceType": + err = unpopulate(val, "DeviceType", &i.DeviceType) + delete(rawMsg, key) + case "edgeId": + err = unpopulate(val, "EdgeID", &i.EdgeID) + delete(rawMsg, key) + case "firmwareVersion": + err = unpopulate(val, "FirmwareVersion", &i.FirmwareVersion) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &i.FriendlyName) + delete(rawMsg, key) + case "hostEntityId": + err = unpopulate(val, "HostEntityID", &i.HostEntityID) + delete(rawMsg, key) + case "ipAddressEntityId": + err = unpopulate(val, "IPAddressEntityID", &i.IPAddressEntityID) + delete(rawMsg, key) + case "importance": + err = unpopulate(val, "Importance", &i.Importance) + delete(rawMsg, key) + case "iotHubEntityId": + err = unpopulate(val, "IotHubEntityID", &i.IotHubEntityID) + delete(rawMsg, key) + case "iotSecurityAgentId": + err = unpopulate(val, "IotSecurityAgentID", &i.IotSecurityAgentID) + delete(rawMsg, key) + case "isAuthorized": + err = unpopulate(val, "IsAuthorized", &i.IsAuthorized) + delete(rawMsg, key) + case "isProgramming": + err = unpopulate(val, "IsProgramming", &i.IsProgramming) + delete(rawMsg, key) + case "isScanner": + err = unpopulate(val, "IsScanner", &i.IsScanner) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &i.MacAddress) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &i.Model) + delete(rawMsg, key) + case "nicEntityIds": + err = unpopulate(val, "NicEntityIDs", &i.NicEntityIDs) + delete(rawMsg, key) + case "operatingSystem": + err = unpopulate(val, "OperatingSystem", &i.OperatingSystem) + delete(rawMsg, key) + case "owners": + err = unpopulate(val, "Owners", &i.Owners) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &i.Protocols) + delete(rawMsg, key) + case "purdueLayer": + err = unpopulate(val, "PurdueLayer", &i.PurdueLayer) + delete(rawMsg, key) + case "sensor": + err = unpopulate(val, "Sensor", &i.Sensor) + delete(rawMsg, key) + case "serialNumber": + err = unpopulate(val, "SerialNumber", &i.SerialNumber) + delete(rawMsg, key) + case "site": + err = unpopulate(val, "Site", &i.Site) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &i.Source) + delete(rawMsg, key) + case "threatIntelligence": + err = unpopulate(val, "ThreatIntelligence", &i.ThreatIntelligence) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &i.Vendor) + delete(rawMsg, key) + case "zone": + err = unpopulate(val, "Zone", &i.Zone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MCASCheckRequirements. +func (m MCASCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindMicrosoftCloudAppSecurity + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MCASCheckRequirements. +func (m *MCASCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MCASCheckRequirementsProperties. +func (m MCASCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MCASCheckRequirementsProperties. +func (m *MCASCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MCASDataConnector. +func (m MCASDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = DataConnectorKindMicrosoftCloudAppSecurity + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MCASDataConnector. +func (m *MCASDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MCASDataConnectorDataTypes. +func (m MCASDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alerts", m.Alerts) + populate(objectMap, "discoveryLogs", m.DiscoveryLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MCASDataConnectorDataTypes. +func (m *MCASDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alerts": + err = unpopulate(val, "Alerts", &m.Alerts) + delete(rawMsg, key) + case "discoveryLogs": + err = unpopulate(val, "DiscoveryLogs", &m.DiscoveryLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MCASDataConnectorProperties. +func (m MCASDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", m.DataTypes) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MCASDataConnectorProperties. +func (m *MCASDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &m.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MDATPCheckRequirements. +func (m MDATPCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindMicrosoftDefenderAdvancedThreatProtection + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPCheckRequirements. +func (m *MDATPCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MDATPCheckRequirementsProperties. +func (m MDATPCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPCheckRequirementsProperties. +func (m *MDATPCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MDATPDataConnector. +func (m MDATPDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = DataConnectorKindMicrosoftDefenderAdvancedThreatProtection + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPDataConnector. +func (m *MDATPDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MDATPDataConnectorProperties. +func (m MDATPDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", m.DataTypes) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPDataConnectorProperties. +func (m *MDATPDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &m.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRule. +func (m MLBehaviorAnalyticsAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMLBehaviorAnalytics + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRule. +func (m *MLBehaviorAnalyticsAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleProperties. +func (m MLBehaviorAnalyticsAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enabled", m.Enabled) + populateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) + populate(objectMap, "severity", m.Severity) + populate(objectMap, "tactics", m.Tactics) + populate(objectMap, "techniques", m.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleProperties. +func (m *MLBehaviorAnalyticsAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &m.Severity) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &m.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &m.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleTemplate. +func (m MLBehaviorAnalyticsAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMLBehaviorAnalytics + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleTemplate. +func (m *MLBehaviorAnalyticsAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleTemplateProperties. +func (m MLBehaviorAnalyticsAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) + populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) + populate(objectMap, "severity", m.Severity) + populate(objectMap, "status", m.Status) + populate(objectMap, "tactics", m.Tactics) + populate(objectMap, "techniques", m.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleTemplateProperties. +func (m *MLBehaviorAnalyticsAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &m.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &m.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &m.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTICheckRequirements. +func (m MSTICheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindMicrosoftThreatIntelligence + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTICheckRequirements. +func (m *MSTICheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTICheckRequirementsProperties. +func (m MSTICheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTICheckRequirementsProperties. +func (m *MSTICheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnector. +func (m MSTIDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = DataConnectorKindMicrosoftThreatIntelligence + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnector. +func (m *MSTIDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnectorDataTypes. +func (m MSTIDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bingSafetyPhishingURL", m.BingSafetyPhishingURL) + populate(objectMap, "microsoftEmergingThreatFeed", m.MicrosoftEmergingThreatFeed) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnectorDataTypes. +func (m *MSTIDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bingSafetyPhishingURL": + err = unpopulate(val, "BingSafetyPhishingURL", &m.BingSafetyPhishingURL) + delete(rawMsg, key) + case "microsoftEmergingThreatFeed": + err = unpopulate(val, "MicrosoftEmergingThreatFeed", &m.MicrosoftEmergingThreatFeed) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnectorDataTypesBingSafetyPhishingURL. +func (m MSTIDataConnectorDataTypesBingSafetyPhishingURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lookbackPeriod", m.LookbackPeriod) + populate(objectMap, "state", m.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnectorDataTypesBingSafetyPhishingURL. +func (m *MSTIDataConnectorDataTypesBingSafetyPhishingURL) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lookbackPeriod": + err = unpopulate(val, "LookbackPeriod", &m.LookbackPeriod) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed. +func (m MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lookbackPeriod", m.LookbackPeriod) + populate(objectMap, "state", m.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed. +func (m *MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lookbackPeriod": + err = unpopulate(val, "LookbackPeriod", &m.LookbackPeriod) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnectorProperties. +func (m MSTIDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", m.DataTypes) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnectorProperties. +func (m *MSTIDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &m.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MTPCheckRequirementsProperties. +func (m MTPCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MTPCheckRequirementsProperties. +func (m *MTPCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MTPDataConnector. +func (m MTPDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = DataConnectorKindMicrosoftThreatProtection + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MTPDataConnector. +func (m *MTPDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MTPDataConnectorDataTypes. +func (m MTPDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "incidents", m.Incidents) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MTPDataConnectorDataTypes. +func (m *MTPDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "incidents": + err = unpopulate(val, "Incidents", &m.Incidents) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MTPDataConnectorDataTypesIncidents. +func (m MTPDataConnectorDataTypesIncidents) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", m.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MTPDataConnectorDataTypesIncidents. +func (m *MTPDataConnectorDataTypesIncidents) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MTPDataConnectorProperties. +func (m MTPDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", m.DataTypes) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MTPDataConnectorProperties. +func (m *MTPDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &m.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailClusterEntity. +func (m MailClusterEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = EntityKindMailCluster + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailClusterEntity. +func (m *MailClusterEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailClusterEntityProperties. +func (m MailClusterEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", m.AdditionalData) + populate(objectMap, "clusterGroup", m.ClusterGroup) + populateTimeRFC3339(objectMap, "clusterQueryEndTime", m.ClusterQueryEndTime) + populateTimeRFC3339(objectMap, "clusterQueryStartTime", m.ClusterQueryStartTime) + populate(objectMap, "clusterSourceIdentifier", m.ClusterSourceIdentifier) + populate(objectMap, "clusterSourceType", m.ClusterSourceType) + populate(objectMap, "countByDeliveryStatus", &m.CountByDeliveryStatus) + populate(objectMap, "countByProtectionStatus", &m.CountByProtectionStatus) + populate(objectMap, "countByThreatType", &m.CountByThreatType) + populate(objectMap, "friendlyName", m.FriendlyName) + populate(objectMap, "isVolumeAnomaly", m.IsVolumeAnomaly) + populate(objectMap, "mailCount", m.MailCount) + populate(objectMap, "networkMessageIds", m.NetworkMessageIDs) + populate(objectMap, "query", m.Query) + populateTimeRFC3339(objectMap, "queryTime", m.QueryTime) + populate(objectMap, "source", m.Source) + populate(objectMap, "threats", m.Threats) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailClusterEntityProperties. +func (m *MailClusterEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &m.AdditionalData) + delete(rawMsg, key) + case "clusterGroup": + err = unpopulate(val, "ClusterGroup", &m.ClusterGroup) + delete(rawMsg, key) + case "clusterQueryEndTime": + err = unpopulateTimeRFC3339(val, "ClusterQueryEndTime", &m.ClusterQueryEndTime) + delete(rawMsg, key) + case "clusterQueryStartTime": + err = unpopulateTimeRFC3339(val, "ClusterQueryStartTime", &m.ClusterQueryStartTime) + delete(rawMsg, key) + case "clusterSourceIdentifier": + err = unpopulate(val, "ClusterSourceIdentifier", &m.ClusterSourceIdentifier) + delete(rawMsg, key) + case "clusterSourceType": + err = unpopulate(val, "ClusterSourceType", &m.ClusterSourceType) + delete(rawMsg, key) + case "countByDeliveryStatus": + err = unpopulate(val, "CountByDeliveryStatus", &m.CountByDeliveryStatus) + delete(rawMsg, key) + case "countByProtectionStatus": + err = unpopulate(val, "CountByProtectionStatus", &m.CountByProtectionStatus) + delete(rawMsg, key) + case "countByThreatType": + err = unpopulate(val, "CountByThreatType", &m.CountByThreatType) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &m.FriendlyName) + delete(rawMsg, key) + case "isVolumeAnomaly": + err = unpopulate(val, "IsVolumeAnomaly", &m.IsVolumeAnomaly) + delete(rawMsg, key) + case "mailCount": + err = unpopulate(val, "MailCount", &m.MailCount) + delete(rawMsg, key) + case "networkMessageIds": + err = unpopulate(val, "NetworkMessageIDs", &m.NetworkMessageIDs) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &m.Query) + delete(rawMsg, key) + case "queryTime": + err = unpopulateTimeRFC3339(val, "QueryTime", &m.QueryTime) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "threats": + err = unpopulate(val, "Threats", &m.Threats) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailMessageEntity. +func (m MailMessageEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = EntityKindMailMessage + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailMessageEntity. +func (m *MailMessageEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailMessageEntityProperties. +func (m MailMessageEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", m.AdditionalData) + populate(objectMap, "antispamDirection", m.AntispamDirection) + populate(objectMap, "bodyFingerprintBin1", m.BodyFingerprintBin1) + populate(objectMap, "bodyFingerprintBin2", m.BodyFingerprintBin2) + populate(objectMap, "bodyFingerprintBin3", m.BodyFingerprintBin3) + populate(objectMap, "bodyFingerprintBin4", m.BodyFingerprintBin4) + populate(objectMap, "bodyFingerprintBin5", m.BodyFingerprintBin5) + populate(objectMap, "deliveryAction", m.DeliveryAction) + populate(objectMap, "deliveryLocation", m.DeliveryLocation) + populate(objectMap, "fileEntityIds", m.FileEntityIDs) + populate(objectMap, "friendlyName", m.FriendlyName) + populate(objectMap, "internetMessageId", m.InternetMessageID) + populate(objectMap, "language", m.Language) + populate(objectMap, "networkMessageId", m.NetworkMessageID) + populate(objectMap, "p1Sender", m.P1Sender) + populate(objectMap, "p1SenderDisplayName", m.P1SenderDisplayName) + populate(objectMap, "p1SenderDomain", m.P1SenderDomain) + populate(objectMap, "p2Sender", m.P2Sender) + populate(objectMap, "p2SenderDisplayName", m.P2SenderDisplayName) + populate(objectMap, "p2SenderDomain", m.P2SenderDomain) + populateTimeRFC3339(objectMap, "receiveDate", m.ReceiveDate) + populate(objectMap, "recipient", m.Recipient) + populate(objectMap, "senderIP", m.SenderIP) + populate(objectMap, "subject", m.Subject) + populate(objectMap, "threatDetectionMethods", m.ThreatDetectionMethods) + populate(objectMap, "threats", m.Threats) + populate(objectMap, "urls", m.Urls) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailMessageEntityProperties. +func (m *MailMessageEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &m.AdditionalData) + delete(rawMsg, key) + case "antispamDirection": + err = unpopulate(val, "AntispamDirection", &m.AntispamDirection) + delete(rawMsg, key) + case "bodyFingerprintBin1": + err = unpopulate(val, "BodyFingerprintBin1", &m.BodyFingerprintBin1) + delete(rawMsg, key) + case "bodyFingerprintBin2": + err = unpopulate(val, "BodyFingerprintBin2", &m.BodyFingerprintBin2) + delete(rawMsg, key) + case "bodyFingerprintBin3": + err = unpopulate(val, "BodyFingerprintBin3", &m.BodyFingerprintBin3) + delete(rawMsg, key) + case "bodyFingerprintBin4": + err = unpopulate(val, "BodyFingerprintBin4", &m.BodyFingerprintBin4) + delete(rawMsg, key) + case "bodyFingerprintBin5": + err = unpopulate(val, "BodyFingerprintBin5", &m.BodyFingerprintBin5) + delete(rawMsg, key) + case "deliveryAction": + err = unpopulate(val, "DeliveryAction", &m.DeliveryAction) + delete(rawMsg, key) + case "deliveryLocation": + err = unpopulate(val, "DeliveryLocation", &m.DeliveryLocation) + delete(rawMsg, key) + case "fileEntityIds": + err = unpopulate(val, "FileEntityIDs", &m.FileEntityIDs) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &m.FriendlyName) + delete(rawMsg, key) + case "internetMessageId": + err = unpopulate(val, "InternetMessageID", &m.InternetMessageID) + delete(rawMsg, key) + case "language": + err = unpopulate(val, "Language", &m.Language) + delete(rawMsg, key) + case "networkMessageId": + err = unpopulate(val, "NetworkMessageID", &m.NetworkMessageID) + delete(rawMsg, key) + case "p1Sender": + err = unpopulate(val, "P1Sender", &m.P1Sender) + delete(rawMsg, key) + case "p1SenderDisplayName": + err = unpopulate(val, "P1SenderDisplayName", &m.P1SenderDisplayName) + delete(rawMsg, key) + case "p1SenderDomain": + err = unpopulate(val, "P1SenderDomain", &m.P1SenderDomain) + delete(rawMsg, key) + case "p2Sender": + err = unpopulate(val, "P2Sender", &m.P2Sender) + delete(rawMsg, key) + case "p2SenderDisplayName": + err = unpopulate(val, "P2SenderDisplayName", &m.P2SenderDisplayName) + delete(rawMsg, key) + case "p2SenderDomain": + err = unpopulate(val, "P2SenderDomain", &m.P2SenderDomain) + delete(rawMsg, key) + case "receiveDate": + err = unpopulateTimeRFC3339(val, "ReceiveDate", &m.ReceiveDate) + delete(rawMsg, key) + case "recipient": + err = unpopulate(val, "Recipient", &m.Recipient) + delete(rawMsg, key) + case "senderIP": + err = unpopulate(val, "SenderIP", &m.SenderIP) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &m.Subject) + delete(rawMsg, key) + case "threatDetectionMethods": + err = unpopulate(val, "ThreatDetectionMethods", &m.ThreatDetectionMethods) + delete(rawMsg, key) + case "threats": + err = unpopulate(val, "Threats", &m.Threats) + delete(rawMsg, key) + case "urls": + err = unpopulate(val, "Urls", &m.Urls) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailboxEntity. +func (m MailboxEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = EntityKindMailbox + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailboxEntity. +func (m *MailboxEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MailboxEntityProperties. +func (m MailboxEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", m.AdditionalData) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "externalDirectoryObjectId", m.ExternalDirectoryObjectID) + populate(objectMap, "friendlyName", m.FriendlyName) + populate(objectMap, "mailboxPrimaryAddress", m.MailboxPrimaryAddress) + populate(objectMap, "upn", m.Upn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MailboxEntityProperties. +func (m *MailboxEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &m.AdditionalData) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "externalDirectoryObjectId": + err = unpopulate(val, "ExternalDirectoryObjectID", &m.ExternalDirectoryObjectID) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &m.FriendlyName) + delete(rawMsg, key) + case "mailboxPrimaryAddress": + err = unpopulate(val, "MailboxPrimaryAddress", &m.MailboxPrimaryAddress) + delete(rawMsg, key) + case "upn": + err = unpopulate(val, "Upn", &m.Upn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MalwareEntity. +func (m MalwareEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = EntityKindMalware + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareEntity. +func (m *MalwareEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MalwareEntityProperties. +func (m MalwareEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", m.AdditionalData) + populate(objectMap, "category", m.Category) + populate(objectMap, "fileEntityIds", m.FileEntityIDs) + populate(objectMap, "friendlyName", m.FriendlyName) + populate(objectMap, "malwareName", m.MalwareName) + populate(objectMap, "processEntityIds", m.ProcessEntityIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareEntityProperties. +func (m *MalwareEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &m.AdditionalData) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "fileEntityIds": + err = unpopulate(val, "FileEntityIDs", &m.FileEntityIDs) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &m.FriendlyName) + delete(rawMsg, key) + case "malwareName": + err = unpopulate(val, "MalwareName", &m.MalwareName) + delete(rawMsg, key) + case "processEntityIds": + err = unpopulate(val, "ProcessEntityIDs", &m.ProcessEntityIDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManualTriggerRequestBody. +func (m ManualTriggerRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logicAppsResourceId", m.LogicAppsResourceID) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManualTriggerRequestBody. +func (m *ManualTriggerRequestBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppsResourceId": + err = unpopulate(val, "LogicAppsResourceID", &m.LogicAppsResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataAuthor. +func (m MetadataAuthor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", m.Email) + populate(objectMap, "link", m.Link) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataAuthor. +func (m *MetadataAuthor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &m.Email) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &m.Link) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataCategories. +func (m MetadataCategories) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "domains", m.Domains) + populate(objectMap, "verticals", m.Verticals) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataCategories. +func (m *MetadataCategories) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "domains": + err = unpopulate(val, "Domains", &m.Domains) + delete(rawMsg, key) + case "verticals": + err = unpopulate(val, "Verticals", &m.Verticals) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataDependencies. +func (m MetadataDependencies) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "name", m.Name) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataDependencies. +func (m *MetadataDependencies) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "criteria": + err = unpopulate(val, "Criteria", &m.Criteria) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataList. +func (m MetadataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataList. +func (m *MetadataList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataModel. +func (m MetadataModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataModel. +func (m *MetadataModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataPatch. +func (m MetadataPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataPatch. +func (m *MetadataPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataProperties. +func (m MetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "author", m.Author) + populate(objectMap, "categories", m.Categories) + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) + populate(objectMap, "customVersion", m.CustomVersion) + populate(objectMap, "dependencies", m.Dependencies) + populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) + populate(objectMap, "icon", m.Icon) + populate(objectMap, "kind", m.Kind) + populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) + populate(objectMap, "parentId", m.ParentID) + populate(objectMap, "previewImages", m.PreviewImages) + populate(objectMap, "previewImagesDark", m.PreviewImagesDark) + populate(objectMap, "providers", m.Providers) + populate(objectMap, "source", m.Source) + populate(objectMap, "support", m.Support) + populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataProperties. +func (m *MetadataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &m.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &m.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &m.CustomVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &m.Dependencies) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &m.Icon) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) + delete(rawMsg, key) + case "parentId": + err = unpopulate(val, "ParentID", &m.ParentID) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &m.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &m.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &m.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataPropertiesPatch. +func (m MetadataPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "author", m.Author) + populate(objectMap, "categories", m.Categories) + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) + populate(objectMap, "customVersion", m.CustomVersion) + populate(objectMap, "dependencies", m.Dependencies) + populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) + populate(objectMap, "icon", m.Icon) + populate(objectMap, "kind", m.Kind) + populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) + populate(objectMap, "parentId", m.ParentID) + populate(objectMap, "previewImages", m.PreviewImages) + populate(objectMap, "previewImagesDark", m.PreviewImagesDark) + populate(objectMap, "providers", m.Providers) + populate(objectMap, "source", m.Source) + populate(objectMap, "support", m.Support) + populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataPropertiesPatch. +func (m *MetadataPropertiesPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &m.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &m.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &m.CustomVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &m.Dependencies) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &m.Icon) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) + delete(rawMsg, key) + case "parentId": + err = unpopulate(val, "ParentID", &m.ParentID) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &m.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &m.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &m.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataSource. +func (m MetadataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "name", m.Name) + populate(objectMap, "sourceId", m.SourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSource. +func (m *MetadataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &m.SourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataSupport. +func (m MetadataSupport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", m.Email) + populate(objectMap, "link", m.Link) + populate(objectMap, "name", m.Name) + populate(objectMap, "tier", m.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSupport. +func (m *MetadataSupport) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &m.Email) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &m.Link) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &m.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. +func (m MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. +func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. +func (m MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) + populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) + populate(objectMap, "enabled", m.Enabled) + populateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) + populate(objectMap, "productFilter", m.ProductFilter) + populate(objectMap, "severitiesFilter", m.SeveritiesFilter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. +func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "displayNamesExcludeFilter": + err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) + delete(rawMsg, key) + case "displayNamesFilter": + err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) + delete(rawMsg, key) + case "productFilter": + err = unpopulate(val, "ProductFilter", &m.ProductFilter) + delete(rawMsg, key) + case "severitiesFilter": + err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (m MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. +func (m MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) + populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) + populate(objectMap, "productFilter", m.ProductFilter) + populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) + populate(objectMap, "severitiesFilter", m.SeveritiesFilter) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. +func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "displayNamesExcludeFilter": + err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) + delete(rawMsg, key) + case "displayNamesFilter": + err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) + delete(rawMsg, key) + case "productFilter": + err = unpopulate(val, "ProductFilter", &m.ProductFilter) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) + delete(rawMsg, key) + case "severitiesFilter": + err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MtpCheckRequirements. +func (m MtpCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindMicrosoftThreatProtection + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MtpCheckRequirements. +func (m *MtpCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NicEntity. +func (n NicEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", n.ID) + objectMap["kind"] = EntityKindNic + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NicEntity. +func (n *NicEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &n.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NicEntityProperties. +func (n NicEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", n.AdditionalData) + populate(objectMap, "friendlyName", n.FriendlyName) + populate(objectMap, "ipAddressEntityId", n.IPAddressEntityID) + populate(objectMap, "macAddress", n.MacAddress) + populate(objectMap, "vlans", n.Vlans) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NicEntityProperties. +func (n *NicEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &n.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &n.FriendlyName) + delete(rawMsg, key) + case "ipAddressEntityId": + err = unpopulate(val, "IPAddressEntityID", &n.IPAddressEntityID) + delete(rawMsg, key) + case "macAddress": + err = unpopulate(val, "MacAddress", &n.MacAddress) + delete(rawMsg, key) + case "vlans": + err = unpopulate(val, "Vlans", &n.Vlans) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NrtAlertRule. +func (n NrtAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", n.Etag) + populate(objectMap, "id", n.ID) + objectMap["kind"] = AlertRuleKindNRT + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRule. +func (n *NrtAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &n.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &n.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleProperties. +func (n NrtAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDetailsOverride", n.AlertDetailsOverride) + populate(objectMap, "alertRuleTemplateName", n.AlertRuleTemplateName) + populate(objectMap, "customDetails", n.CustomDetails) + populate(objectMap, "description", n.Description) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "enabled", n.Enabled) + populate(objectMap, "entityMappings", n.EntityMappings) + populate(objectMap, "eventGroupingSettings", n.EventGroupingSettings) + populate(objectMap, "incidentConfiguration", n.IncidentConfiguration) + populateTimeRFC3339(objectMap, "lastModifiedUtc", n.LastModifiedUTC) + populate(objectMap, "query", n.Query) + populate(objectMap, "severity", n.Severity) + populate(objectMap, "suppressionDuration", n.SuppressionDuration) + populate(objectMap, "suppressionEnabled", n.SuppressionEnabled) + populate(objectMap, "tactics", n.Tactics) + populate(objectMap, "techniques", n.Techniques) + populate(objectMap, "templateVersion", n.TemplateVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleProperties. +func (n *NrtAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertDetailsOverride": + err = unpopulate(val, "AlertDetailsOverride", &n.AlertDetailsOverride) + delete(rawMsg, key) + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &n.AlertRuleTemplateName) + delete(rawMsg, key) + case "customDetails": + err = unpopulate(val, "CustomDetails", &n.CustomDetails) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &n.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &n.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &n.Enabled) + delete(rawMsg, key) + case "entityMappings": + err = unpopulate(val, "EntityMappings", &n.EntityMappings) + delete(rawMsg, key) + case "eventGroupingSettings": + err = unpopulate(val, "EventGroupingSettings", &n.EventGroupingSettings) + delete(rawMsg, key) + case "incidentConfiguration": + err = unpopulate(val, "IncidentConfiguration", &n.IncidentConfiguration) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &n.LastModifiedUTC) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &n.Query) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &n.Severity) + delete(rawMsg, key) + case "suppressionDuration": + err = unpopulate(val, "SuppressionDuration", &n.SuppressionDuration) + delete(rawMsg, key) + case "suppressionEnabled": + err = unpopulate(val, "SuppressionEnabled", &n.SuppressionEnabled) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &n.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &n.Techniques) + delete(rawMsg, key) + case "templateVersion": + err = unpopulate(val, "TemplateVersion", &n.TemplateVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleTemplate. +func (n NrtAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", n.ID) + objectMap["kind"] = AlertRuleKindNRT + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleTemplate. +func (n *NrtAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &n.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleTemplateProperties. +func (n NrtAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDetailsOverride", n.AlertDetailsOverride) + populate(objectMap, "alertRulesCreatedByTemplateCount", n.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", n.CreatedDateUTC) + populate(objectMap, "customDetails", n.CustomDetails) + populate(objectMap, "description", n.Description) + populate(objectMap, "displayName", n.DisplayName) + populate(objectMap, "entityMappings", n.EntityMappings) + populate(objectMap, "eventGroupingSettings", n.EventGroupingSettings) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", n.LastUpdatedDateUTC) + populate(objectMap, "query", n.Query) + populate(objectMap, "requiredDataConnectors", n.RequiredDataConnectors) + populate(objectMap, "severity", n.Severity) + populate(objectMap, "status", n.Status) + populate(objectMap, "tactics", n.Tactics) + populate(objectMap, "techniques", n.Techniques) + populate(objectMap, "version", n.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleTemplateProperties. +func (n *NrtAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertDetailsOverride": + err = unpopulate(val, "AlertDetailsOverride", &n.AlertDetailsOverride) + delete(rawMsg, key) + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &n.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &n.CreatedDateUTC) + delete(rawMsg, key) + case "customDetails": + err = unpopulate(val, "CustomDetails", &n.CustomDetails) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &n.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &n.DisplayName) + delete(rawMsg, key) + case "entityMappings": + err = unpopulate(val, "EntityMappings", &n.EntityMappings) + delete(rawMsg, key) + case "eventGroupingSettings": + err = unpopulate(val, "EventGroupingSettings", &n.EventGroupingSettings) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &n.LastUpdatedDateUTC) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &n.Query) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &n.RequiredDataConnectors) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &n.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &n.Status) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &n.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &n.Techniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &n.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectCheckRequirements. +func (o Office365ProjectCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindOffice365Project + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectCheckRequirements. +func (o *Office365ProjectCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectCheckRequirementsProperties. +func (o Office365ProjectCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectCheckRequirementsProperties. +func (o *Office365ProjectCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectConnectorDataTypes. +func (o Office365ProjectConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logs", o.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectConnectorDataTypes. +func (o *Office365ProjectConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &o.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectConnectorDataTypesLogs. +func (o Office365ProjectConnectorDataTypesLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectConnectorDataTypesLogs. +func (o *Office365ProjectConnectorDataTypesLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectDataConnector. +func (o Office365ProjectDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOffice365Project + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectDataConnector. +func (o *Office365ProjectDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Office365ProjectDataConnectorProperties. +func (o Office365ProjectDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectDataConnectorProperties. +func (o *Office365ProjectDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeATPCheckRequirements. +func (o OfficeATPCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindOfficeATP + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPCheckRequirements. +func (o *OfficeATPCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeATPCheckRequirementsProperties. +func (o OfficeATPCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPCheckRequirementsProperties. +func (o *OfficeATPCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeATPDataConnector. +func (o OfficeATPDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOfficeATP + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPDataConnector. +func (o *OfficeATPDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeATPDataConnectorProperties. +func (o OfficeATPDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPDataConnectorProperties. +func (o *OfficeATPDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeConsent. +func (o OfficeConsent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeConsent. +func (o *OfficeConsent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeConsentList. +func (o OfficeConsentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeConsentList. +func (o *OfficeConsentList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeConsentProperties. +func (o OfficeConsentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consentId", o.ConsentID) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeConsentProperties. +func (o *OfficeConsentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "consentId": + err = unpopulate(val, "ConsentID", &o.ConsentID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnector. +func (o OfficeDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOffice365 + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnector. +func (o *OfficeDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypes. +func (o OfficeDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exchange", o.Exchange) + populate(objectMap, "sharePoint", o.SharePoint) + populate(objectMap, "teams", o.Teams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypes. +func (o *OfficeDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exchange": + err = unpopulate(val, "Exchange", &o.Exchange) + delete(rawMsg, key) + case "sharePoint": + err = unpopulate(val, "SharePoint", &o.SharePoint) + delete(rawMsg, key) + case "teams": + err = unpopulate(val, "Teams", &o.Teams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesExchange. +func (o OfficeDataConnectorDataTypesExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesExchange. +func (o *OfficeDataConnectorDataTypesExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesSharePoint. +func (o OfficeDataConnectorDataTypesSharePoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesSharePoint. +func (o *OfficeDataConnectorDataTypesSharePoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesTeams. +func (o OfficeDataConnectorDataTypesTeams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesTeams. +func (o *OfficeDataConnectorDataTypesTeams) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorProperties. +func (o OfficeDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorProperties. +func (o *OfficeDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeIRMCheckRequirements. +func (o OfficeIRMCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindOfficeIRM + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMCheckRequirements. +func (o *OfficeIRMCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeIRMCheckRequirementsProperties. +func (o OfficeIRMCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMCheckRequirementsProperties. +func (o *OfficeIRMCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeIRMDataConnector. +func (o OfficeIRMDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOfficeIRM + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMDataConnector. +func (o *OfficeIRMDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeIRMDataConnectorProperties. +func (o OfficeIRMDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMDataConnectorProperties. +func (o *OfficeIRMDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBICheckRequirements. +func (o OfficePowerBICheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindOfficePowerBI + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBICheckRequirements. +func (o *OfficePowerBICheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBICheckRequirementsProperties. +func (o OfficePowerBICheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBICheckRequirementsProperties. +func (o *OfficePowerBICheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBIConnectorDataTypes. +func (o OfficePowerBIConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logs", o.Logs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBIConnectorDataTypes. +func (o *OfficePowerBIConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logs": + err = unpopulate(val, "Logs", &o.Logs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBIConnectorDataTypesLogs. +func (o OfficePowerBIConnectorDataTypesLogs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBIConnectorDataTypesLogs. +func (o *OfficePowerBIConnectorDataTypesLogs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBIDataConnector. +func (o OfficePowerBIDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOfficePowerBI + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBIDataConnector. +func (o *OfficePowerBIDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficePowerBIDataConnectorProperties. +func (o OfficePowerBIDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBIDataConnectorProperties. +func (o *OfficePowerBIDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsList. +func (o OperationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList. +func (o *OperationsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Permissions. +func (p Permissions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customs", p.Customs) + populate(objectMap, "resourceProvider", p.ResourceProvider) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Permissions. +func (p *Permissions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customs": + err = unpopulate(val, "Customs", &p.Customs) + delete(rawMsg, key) + case "resourceProvider": + err = unpopulate(val, "ResourceProvider", &p.ResourceProvider) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PermissionsCustomsItem. +func (p PermissionsCustomsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionsCustomsItem. +func (p *PermissionsCustomsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PermissionsResourceProviderItem. +func (p PermissionsResourceProviderItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "permissionsDisplayText", p.PermissionsDisplayText) + populate(objectMap, "provider", p.Provider) + populate(objectMap, "providerDisplayName", p.ProviderDisplayName) + populate(objectMap, "requiredPermissions", p.RequiredPermissions) + populate(objectMap, "scope", p.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionsResourceProviderItem. +func (p *PermissionsResourceProviderItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "permissionsDisplayText": + err = unpopulate(val, "PermissionsDisplayText", &p.PermissionsDisplayText) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &p.Provider) + delete(rawMsg, key) + case "providerDisplayName": + err = unpopulate(val, "ProviderDisplayName", &p.ProviderDisplayName) + delete(rawMsg, key) + case "requiredPermissions": + err = unpopulate(val, "RequiredPermissions", &p.RequiredPermissions) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &p.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlaybookActionProperties. +func (p PlaybookActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logicAppResourceId", p.LogicAppResourceID) + populate(objectMap, "tenantId", p.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlaybookActionProperties. +func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &p.LogicAppResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &p.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessEntity. +func (p ProcessEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + objectMap["kind"] = EntityKindProcess + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntity. +func (p *ProcessEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &p.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessEntityProperties. +func (p ProcessEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountEntityId", p.AccountEntityID) + populate(objectMap, "additionalData", p.AdditionalData) + populate(objectMap, "commandLine", p.CommandLine) + populateTimeRFC3339(objectMap, "creationTimeUtc", p.CreationTimeUTC) + populate(objectMap, "elevationToken", p.ElevationToken) + populate(objectMap, "friendlyName", p.FriendlyName) + populate(objectMap, "hostEntityId", p.HostEntityID) + populate(objectMap, "hostLogonSessionEntityId", p.HostLogonSessionEntityID) + populate(objectMap, "imageFileEntityId", p.ImageFileEntityID) + populate(objectMap, "parentProcessEntityId", p.ParentProcessEntityID) + populate(objectMap, "processId", p.ProcessID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntityProperties. +func (p *ProcessEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountEntityId": + err = unpopulate(val, "AccountEntityID", &p.AccountEntityID) + delete(rawMsg, key) + case "additionalData": + err = unpopulate(val, "AdditionalData", &p.AdditionalData) + delete(rawMsg, key) + case "commandLine": + err = unpopulate(val, "CommandLine", &p.CommandLine) + delete(rawMsg, key) + case "creationTimeUtc": + err = unpopulateTimeRFC3339(val, "CreationTimeUTC", &p.CreationTimeUTC) + delete(rawMsg, key) + case "elevationToken": + err = unpopulate(val, "ElevationToken", &p.ElevationToken) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &p.FriendlyName) + delete(rawMsg, key) + case "hostEntityId": + err = unpopulate(val, "HostEntityID", &p.HostEntityID) + delete(rawMsg, key) + case "hostLogonSessionEntityId": + err = unpopulate(val, "HostLogonSessionEntityID", &p.HostLogonSessionEntityID) + delete(rawMsg, key) + case "imageFileEntityId": + err = unpopulate(val, "ImageFileEntityID", &p.ImageFileEntityID) + delete(rawMsg, key) + case "parentProcessEntityId": + err = unpopulate(val, "ParentProcessEntityID", &p.ParentProcessEntityID) + delete(rawMsg, key) + case "processId": + err = unpopulate(val, "ProcessID", &p.ProcessID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyArrayChangedConditionProperties. +func (p PropertyArrayChangedConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypePropertyArrayChanged + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyArrayChangedConditionProperties. +func (p *PropertyArrayChangedConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyArrayConditionProperties. +func (p PropertyArrayConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypePropertyArray + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyArrayConditionProperties. +func (p *PropertyArrayConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyChangedConditionProperties. +func (p PropertyChangedConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypePropertyChanged + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyChangedConditionProperties. +func (p *PropertyChangedConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyConditionProperties. +func (p PropertyConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypeProperty + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyConditionProperties. +func (p *PropertyConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryKeyEntity. +func (r RegistryKeyEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + objectMap["kind"] = EntityKindRegistryKey + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryKeyEntity. +func (r *RegistryKeyEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryKeyEntityProperties. +func (r RegistryKeyEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", r.AdditionalData) + populate(objectMap, "friendlyName", r.FriendlyName) + populate(objectMap, "hive", r.Hive) + populate(objectMap, "key", r.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryKeyEntityProperties. +func (r *RegistryKeyEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &r.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &r.FriendlyName) + delete(rawMsg, key) + case "hive": + err = unpopulate(val, "Hive", &r.Hive) + delete(rawMsg, key) + case "key": + err = unpopulate(val, "Key", &r.Key) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryValueEntity. +func (r RegistryValueEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + objectMap["kind"] = EntityKindRegistryValue + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryValueEntity. +func (r *RegistryValueEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegistryValueEntityProperties. +func (r RegistryValueEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", r.AdditionalData) + populate(objectMap, "friendlyName", r.FriendlyName) + populate(objectMap, "keyEntityId", r.KeyEntityID) + populate(objectMap, "valueData", r.ValueData) + populate(objectMap, "valueName", r.ValueName) + populate(objectMap, "valueType", r.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryValueEntityProperties. +func (r *RegistryValueEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &r.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &r.FriendlyName) + delete(rawMsg, key) + case "keyEntityId": + err = unpopulate(val, "KeyEntityID", &r.KeyEntityID) + delete(rawMsg, key) + case "valueData": + err = unpopulate(val, "ValueData", &r.ValueData) + delete(rawMsg, key) + case "valueName": + err = unpopulate(val, "ValueName", &r.ValueName) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &r.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Relation. +func (r Relation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Relation. +func (r *Relation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RelationList. +func (r RelationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelationList. +func (r *RelationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RelationProperties. +func (r RelationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "relatedResourceId", r.RelatedResourceID) + populate(objectMap, "relatedResourceKind", r.RelatedResourceKind) + populate(objectMap, "relatedResourceName", r.RelatedResourceName) + populate(objectMap, "relatedResourceType", r.RelatedResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelationProperties. +func (r *RelationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "relatedResourceId": + err = unpopulate(val, "RelatedResourceID", &r.RelatedResourceID) + delete(rawMsg, key) + case "relatedResourceKind": + err = unpopulate(val, "RelatedResourceKind", &r.RelatedResourceKind) + delete(rawMsg, key) + case "relatedResourceName": + err = unpopulate(val, "RelatedResourceName", &r.RelatedResourceName) + delete(rawMsg, key) + case "relatedResourceType": + err = unpopulate(val, "RelatedResourceType", &r.RelatedResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Repo. +func (r Repo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branches", r.Branches) + populate(objectMap, "fullName", r.FullName) + populate(objectMap, "url", r.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Repo. +func (r *Repo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branches": + err = unpopulate(val, "Branches", &r.Branches) + delete(rawMsg, key) + case "fullName": + err = unpopulate(val, "FullName", &r.FullName) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &r.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepoList. +func (r RepoList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RepoList. +func (r *RepoList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Repository. +func (r Repository) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "branch", r.Branch) + populate(objectMap, "deploymentLogsUrl", r.DeploymentLogsURL) + populate(objectMap, "displayUrl", r.DisplayURL) + populate(objectMap, "pathMapping", r.PathMapping) + populate(objectMap, "url", r.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Repository. +func (r *Repository) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branch": + err = unpopulate(val, "Branch", &r.Branch) + delete(rawMsg, key) + case "deploymentLogsUrl": + err = unpopulate(val, "DeploymentLogsURL", &r.DeploymentLogsURL) + delete(rawMsg, key) + case "displayUrl": + err = unpopulate(val, "DisplayURL", &r.DisplayURL) + delete(rawMsg, key) + case "pathMapping": + err = unpopulate(val, "PathMapping", &r.PathMapping) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &r.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepositoryResourceInfo. +func (r RepositoryResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureDevOpsResourceInfo", r.AzureDevOpsResourceInfo) + populate(objectMap, "gitHubResourceInfo", r.GitHubResourceInfo) + populate(objectMap, "webhook", r.Webhook) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryResourceInfo. +func (r *RepositoryResourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureDevOpsResourceInfo": + err = unpopulate(val, "AzureDevOpsResourceInfo", &r.AzureDevOpsResourceInfo) + delete(rawMsg, key) + case "gitHubResourceInfo": + err = unpopulate(val, "GitHubResourceInfo", &r.GitHubResourceInfo) + delete(rawMsg, key) + case "webhook": + err = unpopulate(val, "Webhook", &r.Webhook) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequiredPermissions. +func (r RequiredPermissions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", r.Action) + populate(objectMap, "delete", r.Delete) + populate(objectMap, "read", r.Read) + populate(objectMap, "write", r.Write) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequiredPermissions. +func (r *RequiredPermissions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &r.Action) + delete(rawMsg, key) + case "delete": + err = unpopulate(val, "Delete", &r.Delete) + delete(rawMsg, key) + case "read": + err = unpopulate(val, "Read", &r.Read) + delete(rawMsg, key) + case "write": + err = unpopulate(val, "Write", &r.Write) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRule. +func (s ScheduledAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + objectMap["kind"] = AlertRuleKindScheduled + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRule. +func (s *ScheduledAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleProperties. +func (s ScheduledAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDetailsOverride", s.AlertDetailsOverride) + populate(objectMap, "alertRuleTemplateName", s.AlertRuleTemplateName) + populate(objectMap, "customDetails", s.CustomDetails) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "entityMappings", s.EntityMappings) + populate(objectMap, "eventGroupingSettings", s.EventGroupingSettings) + populate(objectMap, "incidentConfiguration", s.IncidentConfiguration) + populateTimeRFC3339(objectMap, "lastModifiedUtc", s.LastModifiedUTC) + populate(objectMap, "query", s.Query) + populate(objectMap, "queryFrequency", s.QueryFrequency) + populate(objectMap, "queryPeriod", s.QueryPeriod) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "suppressionDuration", s.SuppressionDuration) + populate(objectMap, "suppressionEnabled", s.SuppressionEnabled) + populate(objectMap, "tactics", s.Tactics) + populate(objectMap, "techniques", s.Techniques) + populate(objectMap, "templateVersion", s.TemplateVersion) + populate(objectMap, "triggerOperator", s.TriggerOperator) + populate(objectMap, "triggerThreshold", s.TriggerThreshold) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleProperties. +func (s *ScheduledAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertDetailsOverride": + err = unpopulate(val, "AlertDetailsOverride", &s.AlertDetailsOverride) + delete(rawMsg, key) + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &s.AlertRuleTemplateName) + delete(rawMsg, key) + case "customDetails": + err = unpopulate(val, "CustomDetails", &s.CustomDetails) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + case "entityMappings": + err = unpopulate(val, "EntityMappings", &s.EntityMappings) + delete(rawMsg, key) + case "eventGroupingSettings": + err = unpopulate(val, "EventGroupingSettings", &s.EventGroupingSettings) + delete(rawMsg, key) + case "incidentConfiguration": + err = unpopulate(val, "IncidentConfiguration", &s.IncidentConfiguration) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &s.LastModifiedUTC) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &s.Query) + delete(rawMsg, key) + case "queryFrequency": + err = unpopulate(val, "QueryFrequency", &s.QueryFrequency) + delete(rawMsg, key) + case "queryPeriod": + err = unpopulate(val, "QueryPeriod", &s.QueryPeriod) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "suppressionDuration": + err = unpopulate(val, "SuppressionDuration", &s.SuppressionDuration) + delete(rawMsg, key) + case "suppressionEnabled": + err = unpopulate(val, "SuppressionEnabled", &s.SuppressionEnabled) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &s.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &s.Techniques) + delete(rawMsg, key) + case "templateVersion": + err = unpopulate(val, "TemplateVersion", &s.TemplateVersion) + delete(rawMsg, key) + case "triggerOperator": + err = unpopulate(val, "TriggerOperator", &s.TriggerOperator) + delete(rawMsg, key) + case "triggerThreshold": + err = unpopulate(val, "TriggerThreshold", &s.TriggerThreshold) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleTemplate. +func (s ScheduledAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + objectMap["kind"] = AlertRuleKindScheduled + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleTemplate. +func (s *ScheduledAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleTemplateProperties. +func (s ScheduledAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDetailsOverride", s.AlertDetailsOverride) + populate(objectMap, "alertRulesCreatedByTemplateCount", s.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", s.CreatedDateUTC) + populate(objectMap, "customDetails", s.CustomDetails) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "entityMappings", s.EntityMappings) + populate(objectMap, "eventGroupingSettings", s.EventGroupingSettings) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", s.LastUpdatedDateUTC) + populate(objectMap, "query", s.Query) + populate(objectMap, "queryFrequency", s.QueryFrequency) + populate(objectMap, "queryPeriod", s.QueryPeriod) + populate(objectMap, "requiredDataConnectors", s.RequiredDataConnectors) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "status", s.Status) + populate(objectMap, "tactics", s.Tactics) + populate(objectMap, "techniques", s.Techniques) + populate(objectMap, "triggerOperator", s.TriggerOperator) + populate(objectMap, "triggerThreshold", s.TriggerThreshold) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleTemplateProperties. +func (s *ScheduledAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertDetailsOverride": + err = unpopulate(val, "AlertDetailsOverride", &s.AlertDetailsOverride) + delete(rawMsg, key) + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &s.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &s.CreatedDateUTC) + delete(rawMsg, key) + case "customDetails": + err = unpopulate(val, "CustomDetails", &s.CustomDetails) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "entityMappings": + err = unpopulate(val, "EntityMappings", &s.EntityMappings) + delete(rawMsg, key) + case "eventGroupingSettings": + err = unpopulate(val, "EventGroupingSettings", &s.EventGroupingSettings) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &s.LastUpdatedDateUTC) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &s.Query) + delete(rawMsg, key) + case "queryFrequency": + err = unpopulate(val, "QueryFrequency", &s.QueryFrequency) + delete(rawMsg, key) + case "queryPeriod": + err = unpopulate(val, "QueryPeriod", &s.QueryPeriod) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &s.RequiredDataConnectors) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &s.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &s.Techniques) + delete(rawMsg, key) + case "triggerOperator": + err = unpopulate(val, "TriggerOperator", &s.TriggerOperator) + delete(rawMsg, key) + case "triggerThreshold": + err = unpopulate(val, "TriggerThreshold", &s.TriggerThreshold) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAlert. +func (s SecurityAlert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + objectMap["kind"] = EntityKindSecurityAlert + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlert. +func (s *SecurityAlert) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertProperties. +func (s SecurityAlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", s.AdditionalData) + populate(objectMap, "alertDisplayName", s.AlertDisplayName) + populate(objectMap, "alertLink", s.AlertLink) + populate(objectMap, "alertType", s.AlertType) + populate(objectMap, "compromisedEntity", s.CompromisedEntity) + populate(objectMap, "confidenceLevel", s.ConfidenceLevel) + populate(objectMap, "confidenceReasons", s.ConfidenceReasons) + populate(objectMap, "confidenceScore", s.ConfidenceScore) + populate(objectMap, "confidenceScoreStatus", s.ConfidenceScoreStatus) + populate(objectMap, "description", s.Description) + populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "friendlyName", s.FriendlyName) + populate(objectMap, "intent", s.Intent) + populateTimeRFC3339(objectMap, "processingEndTime", s.ProcessingEndTime) + populate(objectMap, "productComponentName", s.ProductComponentName) + populate(objectMap, "productName", s.ProductName) + populate(objectMap, "productVersion", s.ProductVersion) + populate(objectMap, "providerAlertId", s.ProviderAlertID) + populate(objectMap, "remediationSteps", s.RemediationSteps) + populate(objectMap, "resourceIdentifiers", s.ResourceIdentifiers) + populate(objectMap, "severity", s.Severity) + populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "status", s.Status) + populate(objectMap, "systemAlertId", s.SystemAlertID) + populate(objectMap, "tactics", s.Tactics) + populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) + populate(objectMap, "vendorName", s.VendorName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertProperties. +func (s *SecurityAlertProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &s.AdditionalData) + delete(rawMsg, key) + case "alertDisplayName": + err = unpopulate(val, "AlertDisplayName", &s.AlertDisplayName) + delete(rawMsg, key) + case "alertLink": + err = unpopulate(val, "AlertLink", &s.AlertLink) + delete(rawMsg, key) + case "alertType": + err = unpopulate(val, "AlertType", &s.AlertType) + delete(rawMsg, key) + case "compromisedEntity": + err = unpopulate(val, "CompromisedEntity", &s.CompromisedEntity) + delete(rawMsg, key) + case "confidenceLevel": + err = unpopulate(val, "ConfidenceLevel", &s.ConfidenceLevel) + delete(rawMsg, key) + case "confidenceReasons": + err = unpopulate(val, "ConfidenceReasons", &s.ConfidenceReasons) + delete(rawMsg, key) + case "confidenceScore": + err = unpopulate(val, "ConfidenceScore", &s.ConfidenceScore) + delete(rawMsg, key) + case "confidenceScoreStatus": + err = unpopulate(val, "ConfidenceScoreStatus", &s.ConfidenceScoreStatus) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &s.FriendlyName) + delete(rawMsg, key) + case "intent": + err = unpopulate(val, "Intent", &s.Intent) + delete(rawMsg, key) + case "processingEndTime": + err = unpopulateTimeRFC3339(val, "ProcessingEndTime", &s.ProcessingEndTime) + delete(rawMsg, key) + case "productComponentName": + err = unpopulate(val, "ProductComponentName", &s.ProductComponentName) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &s.ProductName) + delete(rawMsg, key) + case "productVersion": + err = unpopulate(val, "ProductVersion", &s.ProductVersion) + delete(rawMsg, key) + case "providerAlertId": + err = unpopulate(val, "ProviderAlertID", &s.ProviderAlertID) + delete(rawMsg, key) + case "remediationSteps": + err = unpopulate(val, "RemediationSteps", &s.RemediationSteps) + delete(rawMsg, key) + case "resourceIdentifiers": + err = unpopulate(val, "ResourceIdentifiers", &s.ResourceIdentifiers) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "systemAlertId": + err = unpopulate(val, "SystemAlertID", &s.SystemAlertID) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &s.Tactics) + delete(rawMsg, key) + case "timeGenerated": + err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) + delete(rawMsg, key) + case "vendorName": + err = unpopulate(val, "VendorName", &s.VendorName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertPropertiesConfidenceReasonsItem. +func (s SecurityAlertPropertiesConfidenceReasonsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "reason", s.Reason) + populate(objectMap, "reasonType", s.ReasonType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertPropertiesConfidenceReasonsItem. +func (s *SecurityAlertPropertiesConfidenceReasonsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "reason": + err = unpopulate(val, "Reason", &s.Reason) + delete(rawMsg, key) + case "reasonType": + err = unpopulate(val, "ReasonType", &s.ReasonType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityAlertTimelineItem. +func (s SecurityAlertTimelineItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertType", s.AlertType) + populate(objectMap, "azureResourceId", s.AzureResourceID) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + objectMap["kind"] = EntityTimelineKindSecurityAlert + populate(objectMap, "productName", s.ProductName) + populate(objectMap, "severity", s.Severity) + populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertTimelineItem. +func (s *SecurityAlertTimelineItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, "AlertType", &s.AlertType) + delete(rawMsg, key) + case "azureResourceId": + err = unpopulate(val, "AzureResourceID", &s.AzureResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &s.ProductName) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "timeGenerated": + err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupEntity. +func (s SecurityGroupEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + objectMap["kind"] = EntityKindSecurityGroup + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupEntity. +func (s *SecurityGroupEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityGroupEntityProperties. +func (s SecurityGroupEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", s.AdditionalData) + populate(objectMap, "distinguishedName", s.DistinguishedName) + populate(objectMap, "friendlyName", s.FriendlyName) + populate(objectMap, "objectGuid", s.ObjectGUID) + populate(objectMap, "sid", s.Sid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupEntityProperties. +func (s *SecurityGroupEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &s.AdditionalData) + delete(rawMsg, key) + case "distinguishedName": + err = unpopulate(val, "DistinguishedName", &s.DistinguishedName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &s.FriendlyName) + delete(rawMsg, key) + case "objectGuid": + err = unpopulate(val, "ObjectGUID", &s.ObjectGUID) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &s.Sid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSetting. +func (s SecurityMLAnalyticsSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + objectMap["kind"] = s.Kind + populate(objectMap, "name", s.Name) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSetting. +func (s *SecurityMLAnalyticsSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSettingsDataSource. +func (s SecurityMLAnalyticsSettingsDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectorId", s.ConnectorID) + populate(objectMap, "dataTypes", s.DataTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsDataSource. +func (s *SecurityMLAnalyticsSettingsDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectorId": + err = unpopulate(val, "ConnectorID", &s.ConnectorID) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &s.DataTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSettingsList. +func (s SecurityMLAnalyticsSettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsList. +func (s *SecurityMLAnalyticsSettingsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + s.Value, err = unmarshalSecurityMLAnalyticsSettingClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingState. +func (s SentinelOnboardingState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingState. +func (s *SentinelOnboardingState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStateProperties. +func (s SentinelOnboardingStateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customerManagedKey", s.CustomerManagedKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStateProperties. +func (s *SentinelOnboardingStateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerManagedKey": + err = unpopulate(val, "CustomerManagedKey", &s.CustomerManagedKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStatesList. +func (s SentinelOnboardingStatesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStatesList. +func (s *SentinelOnboardingStatesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SettingList. +func (s SettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingList. +func (s *SettingList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + s.Value, err = unmarshalSettingsClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Settings. +func (s Settings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + objectMap["kind"] = s.Kind + populate(objectMap, "name", s.Name) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Settings. +func (s *Settings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControl. +func (s SourceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControl. +func (s *SourceControl) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControlList. +func (s SourceControlList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlList. +func (s *SourceControlList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceControlProperties. +func (s SourceControlProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentTypes", s.ContentTypes) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "id", s.ID) + populate(objectMap, "lastDeploymentInfo", s.LastDeploymentInfo) + populate(objectMap, "repoType", s.RepoType) + populate(objectMap, "repository", s.Repository) + populate(objectMap, "repositoryResourceInfo", s.RepositoryResourceInfo) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlProperties. +func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentTypes": + err = unpopulate(val, "ContentTypes", &s.ContentTypes) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "lastDeploymentInfo": + err = unpopulate(val, "LastDeploymentInfo", &s.LastDeploymentInfo) + delete(rawMsg, key) + case "repoType": + err = unpopulate(val, "RepoType", &s.RepoType) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &s.Repository) + delete(rawMsg, key) + case "repositoryResourceInfo": + err = unpopulate(val, "RepositoryResourceInfo", &s.RepositoryResourceInfo) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubmissionMailEntity. +func (s SubmissionMailEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + objectMap["kind"] = EntityKindSubmissionMail + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmissionMailEntity. +func (s *SubmissionMailEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubmissionMailEntityProperties. +func (s SubmissionMailEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", s.AdditionalData) + populate(objectMap, "friendlyName", s.FriendlyName) + populate(objectMap, "networkMessageId", s.NetworkMessageID) + populate(objectMap, "recipient", s.Recipient) + populate(objectMap, "reportType", s.ReportType) + populate(objectMap, "sender", s.Sender) + populate(objectMap, "senderIp", s.SenderIP) + populate(objectMap, "subject", s.Subject) + populateTimeRFC3339(objectMap, "submissionDate", s.SubmissionDate) + populate(objectMap, "submissionId", s.SubmissionID) + populate(objectMap, "submitter", s.Submitter) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmissionMailEntityProperties. +func (s *SubmissionMailEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &s.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &s.FriendlyName) + delete(rawMsg, key) + case "networkMessageId": + err = unpopulate(val, "NetworkMessageID", &s.NetworkMessageID) + delete(rawMsg, key) + case "recipient": + err = unpopulate(val, "Recipient", &s.Recipient) + delete(rawMsg, key) + case "reportType": + err = unpopulate(val, "ReportType", &s.ReportType) + delete(rawMsg, key) + case "sender": + err = unpopulate(val, "Sender", &s.Sender) + delete(rawMsg, key) + case "senderIp": + err = unpopulate(val, "SenderIP", &s.SenderIP) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &s.Subject) + delete(rawMsg, key) + case "submissionDate": + err = unpopulateTimeRFC3339(val, "SubmissionDate", &s.SubmissionDate) + delete(rawMsg, key) + case "submissionId": + err = unpopulate(val, "SubmissionID", &s.SubmissionID) + delete(rawMsg, key) + case "submitter": + err = unpopulate(val, "Submitter", &s.Submitter) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TICheckRequirements. +func (t TICheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindThreatIntelligence + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TICheckRequirements. +func (t *TICheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TICheckRequirementsProperties. +func (t TICheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", t.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TICheckRequirementsProperties. +func (t *TICheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TIDataConnector. +func (t TIDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + objectMap["kind"] = DataConnectorKindThreatIntelligence + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnector. +func (t *TIDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TIDataConnectorDataTypes. +func (t TIDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "indicators", t.Indicators) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnectorDataTypes. +func (t *TIDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "indicators": + err = unpopulate(val, "Indicators", &t.Indicators) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TIDataConnectorDataTypesIndicators. +func (t TIDataConnectorDataTypesIndicators) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", t.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnectorDataTypesIndicators. +func (t *TIDataConnectorDataTypesIndicators) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TIDataConnectorProperties. +func (t TIDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", t.DataTypes) + populate(objectMap, "tenantId", t.TenantID) + populateTimeRFC3339(objectMap, "tipLookbackPeriod", t.TipLookbackPeriod) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnectorProperties. +func (t *TIDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &t.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + case "tipLookbackPeriod": + err = unpopulateTimeRFC3339(val, "TipLookbackPeriod", &t.TipLookbackPeriod) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TeamInformation. +func (t TeamInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "name", t.Name) + populate(objectMap, "primaryChannelUrl", t.PrimaryChannelURL) + populateTimeRFC3339(objectMap, "teamCreationTimeUtc", t.TeamCreationTimeUTC) + populate(objectMap, "teamId", t.TeamID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TeamInformation. +func (t *TeamInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "primaryChannelUrl": + err = unpopulate(val, "PrimaryChannelURL", &t.PrimaryChannelURL) + delete(rawMsg, key) + case "teamCreationTimeUtc": + err = unpopulateTimeRFC3339(val, "TeamCreationTimeUTC", &t.TeamCreationTimeUTC) + delete(rawMsg, key) + case "teamId": + err = unpopulate(val, "TeamID", &t.TeamID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TeamProperties. +func (t TeamProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", t.GroupIDs) + populate(objectMap, "memberIds", t.MemberIDs) + populate(objectMap, "teamDescription", t.TeamDescription) + populate(objectMap, "teamName", t.TeamName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TeamProperties. +func (t *TeamProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &t.GroupIDs) + delete(rawMsg, key) + case "memberIds": + err = unpopulate(val, "MemberIDs", &t.MemberIDs) + delete(rawMsg, key) + case "teamDescription": + err = unpopulate(val, "TeamDescription", &t.TeamDescription) + delete(rawMsg, key) + case "teamName": + err = unpopulate(val, "TeamName", &t.TeamName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligence. +func (t ThreatIntelligence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "confidence", t.Confidence) + populate(objectMap, "providerName", t.ProviderName) + populate(objectMap, "reportLink", t.ReportLink) + populate(objectMap, "threatDescription", t.ThreatDescription) + populate(objectMap, "threatName", t.ThreatName) + populate(objectMap, "threatType", t.ThreatType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligence. +func (t *ThreatIntelligence) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "confidence": + err = unpopulate(val, "Confidence", &t.Confidence) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &t.ProviderName) + delete(rawMsg, key) + case "reportLink": + err = unpopulate(val, "ReportLink", &t.ReportLink) + delete(rawMsg, key) + case "threatDescription": + err = unpopulate(val, "ThreatDescription", &t.ThreatDescription) + delete(rawMsg, key) + case "threatName": + err = unpopulate(val, "ThreatName", &t.ThreatName) + delete(rawMsg, key) + case "threatType": + err = unpopulate(val, "ThreatType", &t.ThreatType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRule. +func (t ThreatIntelligenceAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + objectMap["kind"] = AlertRuleKindThreatIntelligence + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRule. +func (t *ThreatIntelligenceAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleProperties. +func (t ThreatIntelligenceAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRuleTemplateName", t.AlertRuleTemplateName) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "enabled", t.Enabled) + populateTimeRFC3339(objectMap, "lastModifiedUtc", t.LastModifiedUTC) + populate(objectMap, "severity", t.Severity) + populate(objectMap, "tactics", t.Tactics) + populate(objectMap, "techniques", t.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleProperties. +func (t *ThreatIntelligenceAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &t.AlertRuleTemplateName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &t.Enabled) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &t.LastModifiedUTC) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &t.Severity) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &t.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &t.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleTemplate. +func (t ThreatIntelligenceAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + objectMap["kind"] = AlertRuleKindThreatIntelligence + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleTemplate. +func (t *ThreatIntelligenceAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleTemplateProperties. +func (t ThreatIntelligenceAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertRulesCreatedByTemplateCount", t.AlertRulesCreatedByTemplateCount) + populateTimeRFC3339(objectMap, "createdDateUTC", t.CreatedDateUTC) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", t.LastUpdatedDateUTC) + populate(objectMap, "requiredDataConnectors", t.RequiredDataConnectors) + populate(objectMap, "severity", t.Severity) + populate(objectMap, "status", t.Status) + populate(objectMap, "tactics", t.Tactics) + populate(objectMap, "techniques", t.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleTemplateProperties. +func (t *ThreatIntelligenceAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &t.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &t.CreatedDateUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &t.LastUpdatedDateUTC) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &t.RequiredDataConnectors) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &t.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &t.Status) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &t.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &t.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAppendTags. +func (t ThreatIntelligenceAppendTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "threatIntelligenceTags", t.ThreatIntelligenceTags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAppendTags. +func (t *ThreatIntelligenceAppendTags) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "threatIntelligenceTags": + err = unpopulate(val, "ThreatIntelligenceTags", &t.ThreatIntelligenceTags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceExternalReference. +func (t ThreatIntelligenceExternalReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "externalId", t.ExternalID) + populate(objectMap, "hashes", t.Hashes) + populate(objectMap, "sourceName", t.SourceName) + populate(objectMap, "url", t.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceExternalReference. +func (t *ThreatIntelligenceExternalReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "externalId": + err = unpopulate(val, "ExternalID", &t.ExternalID) + delete(rawMsg, key) + case "hashes": + err = unpopulate(val, "Hashes", &t.Hashes) + delete(rawMsg, key) + case "sourceName": + err = unpopulate(val, "SourceName", &t.SourceName) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &t.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceFilteringCriteria. +func (t ThreatIntelligenceFilteringCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ids", t.IDs) + populate(objectMap, "includeDisabled", t.IncludeDisabled) + populate(objectMap, "keywords", t.Keywords) + populate(objectMap, "maxConfidence", t.MaxConfidence) + populate(objectMap, "maxValidUntil", t.MaxValidUntil) + populate(objectMap, "minConfidence", t.MinConfidence) + populate(objectMap, "minValidUntil", t.MinValidUntil) + populate(objectMap, "pageSize", t.PageSize) + populate(objectMap, "patternTypes", t.PatternTypes) + populate(objectMap, "skipToken", t.SkipToken) + populate(objectMap, "sortBy", t.SortBy) + populate(objectMap, "sources", t.Sources) + populate(objectMap, "threatTypes", t.ThreatTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceFilteringCriteria. +func (t *ThreatIntelligenceFilteringCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ids": + err = unpopulate(val, "IDs", &t.IDs) + delete(rawMsg, key) + case "includeDisabled": + err = unpopulate(val, "IncludeDisabled", &t.IncludeDisabled) + delete(rawMsg, key) + case "keywords": + err = unpopulate(val, "Keywords", &t.Keywords) + delete(rawMsg, key) + case "maxConfidence": + err = unpopulate(val, "MaxConfidence", &t.MaxConfidence) + delete(rawMsg, key) + case "maxValidUntil": + err = unpopulate(val, "MaxValidUntil", &t.MaxValidUntil) + delete(rawMsg, key) + case "minConfidence": + err = unpopulate(val, "MinConfidence", &t.MinConfidence) + delete(rawMsg, key) + case "minValidUntil": + err = unpopulate(val, "MinValidUntil", &t.MinValidUntil) + delete(rawMsg, key) + case "pageSize": + err = unpopulate(val, "PageSize", &t.PageSize) + delete(rawMsg, key) + case "patternTypes": + err = unpopulate(val, "PatternTypes", &t.PatternTypes) + delete(rawMsg, key) + case "skipToken": + err = unpopulate(val, "SkipToken", &t.SkipToken) + delete(rawMsg, key) + case "sortBy": + err = unpopulate(val, "SortBy", &t.SortBy) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &t.Sources) + delete(rawMsg, key) + case "threatTypes": + err = unpopulate(val, "ThreatTypes", &t.ThreatTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceGranularMarkingModel. +func (t ThreatIntelligenceGranularMarkingModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "language", t.Language) + populate(objectMap, "markingRef", t.MarkingRef) + populate(objectMap, "selectors", t.Selectors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceGranularMarkingModel. +func (t *ThreatIntelligenceGranularMarkingModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "language": + err = unpopulate(val, "Language", &t.Language) + delete(rawMsg, key) + case "markingRef": + err = unpopulate(val, "MarkingRef", &t.MarkingRef) + delete(rawMsg, key) + case "selectors": + err = unpopulate(val, "Selectors", &t.Selectors) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceIndicatorModel. +func (t ThreatIntelligenceIndicatorModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + objectMap["kind"] = ThreatIntelligenceResourceKindEnumIndicator + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceIndicatorModel. +func (t *ThreatIntelligenceIndicatorModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceIndicatorProperties. +func (t ThreatIntelligenceIndicatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", t.AdditionalData) + populate(objectMap, "confidence", t.Confidence) + populate(objectMap, "created", t.Created) + populate(objectMap, "createdByRef", t.CreatedByRef) + populate(objectMap, "defanged", t.Defanged) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "extensions", t.Extensions) + populate(objectMap, "externalId", t.ExternalID) + populate(objectMap, "externalLastUpdatedTimeUtc", t.ExternalLastUpdatedTimeUTC) + populate(objectMap, "externalReferences", t.ExternalReferences) + populate(objectMap, "friendlyName", t.FriendlyName) + populate(objectMap, "granularMarkings", t.GranularMarkings) + populate(objectMap, "indicatorTypes", t.IndicatorTypes) + populate(objectMap, "killChainPhases", t.KillChainPhases) + populate(objectMap, "labels", t.Labels) + populate(objectMap, "language", t.Language) + populate(objectMap, "lastUpdatedTimeUtc", t.LastUpdatedTimeUTC) + populate(objectMap, "modified", t.Modified) + populate(objectMap, "objectMarkingRefs", t.ObjectMarkingRefs) + populate(objectMap, "parsedPattern", t.ParsedPattern) + populate(objectMap, "pattern", t.Pattern) + populate(objectMap, "patternType", t.PatternType) + populate(objectMap, "patternVersion", t.PatternVersion) + populate(objectMap, "revoked", t.Revoked) + populate(objectMap, "source", t.Source) + populate(objectMap, "threatIntelligenceTags", t.ThreatIntelligenceTags) + populate(objectMap, "threatTypes", t.ThreatTypes) + populate(objectMap, "validFrom", t.ValidFrom) + populate(objectMap, "validUntil", t.ValidUntil) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceIndicatorProperties. +func (t *ThreatIntelligenceIndicatorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &t.AdditionalData) + delete(rawMsg, key) + case "confidence": + err = unpopulate(val, "Confidence", &t.Confidence) + delete(rawMsg, key) + case "created": + err = unpopulate(val, "Created", &t.Created) + delete(rawMsg, key) + case "createdByRef": + err = unpopulate(val, "CreatedByRef", &t.CreatedByRef) + delete(rawMsg, key) + case "defanged": + err = unpopulate(val, "Defanged", &t.Defanged) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &t.Extensions) + delete(rawMsg, key) + case "externalId": + err = unpopulate(val, "ExternalID", &t.ExternalID) + delete(rawMsg, key) + case "externalLastUpdatedTimeUtc": + err = unpopulate(val, "ExternalLastUpdatedTimeUTC", &t.ExternalLastUpdatedTimeUTC) + delete(rawMsg, key) + case "externalReferences": + err = unpopulate(val, "ExternalReferences", &t.ExternalReferences) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &t.FriendlyName) + delete(rawMsg, key) + case "granularMarkings": + err = unpopulate(val, "GranularMarkings", &t.GranularMarkings) + delete(rawMsg, key) + case "indicatorTypes": + err = unpopulate(val, "IndicatorTypes", &t.IndicatorTypes) + delete(rawMsg, key) + case "killChainPhases": + err = unpopulate(val, "KillChainPhases", &t.KillChainPhases) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &t.Labels) + delete(rawMsg, key) + case "language": + err = unpopulate(val, "Language", &t.Language) + delete(rawMsg, key) + case "lastUpdatedTimeUtc": + err = unpopulate(val, "LastUpdatedTimeUTC", &t.LastUpdatedTimeUTC) + delete(rawMsg, key) + case "modified": + err = unpopulate(val, "Modified", &t.Modified) + delete(rawMsg, key) + case "objectMarkingRefs": + err = unpopulate(val, "ObjectMarkingRefs", &t.ObjectMarkingRefs) + delete(rawMsg, key) + case "parsedPattern": + err = unpopulate(val, "ParsedPattern", &t.ParsedPattern) + delete(rawMsg, key) + case "pattern": + err = unpopulate(val, "Pattern", &t.Pattern) + delete(rawMsg, key) + case "patternType": + err = unpopulate(val, "PatternType", &t.PatternType) + delete(rawMsg, key) + case "patternVersion": + err = unpopulate(val, "PatternVersion", &t.PatternVersion) + delete(rawMsg, key) + case "revoked": + err = unpopulate(val, "Revoked", &t.Revoked) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &t.Source) + delete(rawMsg, key) + case "threatIntelligenceTags": + err = unpopulate(val, "ThreatIntelligenceTags", &t.ThreatIntelligenceTags) + delete(rawMsg, key) + case "threatTypes": + err = unpopulate(val, "ThreatTypes", &t.ThreatTypes) + delete(rawMsg, key) + case "validFrom": + err = unpopulate(val, "ValidFrom", &t.ValidFrom) + delete(rawMsg, key) + case "validUntil": + err = unpopulate(val, "ValidUntil", &t.ValidUntil) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceInformation. +func (t ThreatIntelligenceInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + objectMap["kind"] = t.Kind + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceInformation. +func (t *ThreatIntelligenceInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceInformationList. +func (t ThreatIntelligenceInformationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceInformationList. +func (t *ThreatIntelligenceInformationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + t.Value, err = unmarshalThreatIntelligenceInformationClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceKillChainPhase. +func (t ThreatIntelligenceKillChainPhase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "killChainName", t.KillChainName) + populate(objectMap, "phaseName", t.PhaseName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceKillChainPhase. +func (t *ThreatIntelligenceKillChainPhase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "killChainName": + err = unpopulate(val, "KillChainName", &t.KillChainName) + delete(rawMsg, key) + case "phaseName": + err = unpopulate(val, "PhaseName", &t.PhaseName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceMetric. +func (t ThreatIntelligenceMetric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "lastUpdatedTimeUtc", t.LastUpdatedTimeUTC) + populate(objectMap, "patternTypeMetrics", t.PatternTypeMetrics) + populate(objectMap, "sourceMetrics", t.SourceMetrics) + populate(objectMap, "threatTypeMetrics", t.ThreatTypeMetrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceMetric. +func (t *ThreatIntelligenceMetric) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastUpdatedTimeUtc": + err = unpopulate(val, "LastUpdatedTimeUTC", &t.LastUpdatedTimeUTC) + delete(rawMsg, key) + case "patternTypeMetrics": + err = unpopulate(val, "PatternTypeMetrics", &t.PatternTypeMetrics) + delete(rawMsg, key) + case "sourceMetrics": + err = unpopulate(val, "SourceMetrics", &t.SourceMetrics) + delete(rawMsg, key) + case "threatTypeMetrics": + err = unpopulate(val, "ThreatTypeMetrics", &t.ThreatTypeMetrics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceMetricEntity. +func (t ThreatIntelligenceMetricEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricName", t.MetricName) + populate(objectMap, "metricValue", t.MetricValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceMetricEntity. +func (t *ThreatIntelligenceMetricEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metricName": + err = unpopulate(val, "MetricName", &t.MetricName) + delete(rawMsg, key) + case "metricValue": + err = unpopulate(val, "MetricValue", &t.MetricValue) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceMetrics. +func (t ThreatIntelligenceMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceMetrics. +func (t *ThreatIntelligenceMetrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceMetricsList. +func (t ThreatIntelligenceMetricsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceMetricsList. +func (t *ThreatIntelligenceMetricsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceParsedPattern. +func (t ThreatIntelligenceParsedPattern) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "patternTypeKey", t.PatternTypeKey) + populate(objectMap, "patternTypeValues", t.PatternTypeValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceParsedPattern. +func (t *ThreatIntelligenceParsedPattern) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "patternTypeKey": + err = unpopulate(val, "PatternTypeKey", &t.PatternTypeKey) + delete(rawMsg, key) + case "patternTypeValues": + err = unpopulate(val, "PatternTypeValues", &t.PatternTypeValues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceParsedPatternTypeValue. +func (t ThreatIntelligenceParsedPatternTypeValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", t.Value) + populate(objectMap, "valueType", t.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceParsedPatternTypeValue. +func (t *ThreatIntelligenceParsedPatternTypeValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &t.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceSortingCriteria. +func (t ThreatIntelligenceSortingCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "itemKey", t.ItemKey) + populate(objectMap, "sortOrder", t.SortOrder) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceSortingCriteria. +func (t *ThreatIntelligenceSortingCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "itemKey": + err = unpopulate(val, "ItemKey", &t.ItemKey) + delete(rawMsg, key) + case "sortOrder": + err = unpopulate(val, "SortOrder", &t.SortOrder) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiCheckRequirements. +func (t TiTaxiiCheckRequirements) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = DataConnectorKindThreatIntelligenceTaxii + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiCheckRequirements. +func (t *TiTaxiiCheckRequirements) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiCheckRequirementsProperties. +func (t TiTaxiiCheckRequirementsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tenantId", t.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiCheckRequirementsProperties. +func (t *TiTaxiiCheckRequirementsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnector. +func (t TiTaxiiDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + objectMap["kind"] = DataConnectorKindThreatIntelligenceTaxii + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnector. +func (t *TiTaxiiDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnectorDataTypes. +func (t TiTaxiiDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "taxiiClient", t.TaxiiClient) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnectorDataTypes. +func (t *TiTaxiiDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "taxiiClient": + err = unpopulate(val, "TaxiiClient", &t.TaxiiClient) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnectorDataTypesTaxiiClient. +func (t TiTaxiiDataConnectorDataTypesTaxiiClient) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", t.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnectorDataTypesTaxiiClient. +func (t *TiTaxiiDataConnectorDataTypesTaxiiClient) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnectorProperties. +func (t TiTaxiiDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "collectionId", t.CollectionID) + populate(objectMap, "dataTypes", t.DataTypes) + populate(objectMap, "friendlyName", t.FriendlyName) + populate(objectMap, "password", t.Password) + populate(objectMap, "pollingFrequency", t.PollingFrequency) + populateTimeRFC3339(objectMap, "taxiiLookbackPeriod", t.TaxiiLookbackPeriod) + populate(objectMap, "taxiiServer", t.TaxiiServer) + populate(objectMap, "tenantId", t.TenantID) + populate(objectMap, "userName", t.UserName) + populate(objectMap, "workspaceId", t.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnectorProperties. +func (t *TiTaxiiDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collectionId": + err = unpopulate(val, "CollectionID", &t.CollectionID) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &t.DataTypes) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &t.FriendlyName) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &t.Password) + delete(rawMsg, key) + case "pollingFrequency": + err = unpopulate(val, "PollingFrequency", &t.PollingFrequency) + delete(rawMsg, key) + case "taxiiLookbackPeriod": + err = unpopulateTimeRFC3339(val, "TaxiiLookbackPeriod", &t.TaxiiLookbackPeriod) + delete(rawMsg, key) + case "taxiiServer": + err = unpopulate(val, "TaxiiServer", &t.TaxiiServer) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &t.TenantID) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &t.UserName) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &t.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimelineAggregation. +func (t TimelineAggregation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "count", t.Count) + populate(objectMap, "kind", t.Kind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimelineAggregation. +func (t *TimelineAggregation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "count": + err = unpopulate(val, "Count", &t.Count) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimelineError. +func (t TimelineError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessage", t.ErrorMessage) + populate(objectMap, "kind", t.Kind) + populate(objectMap, "queryId", t.QueryID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimelineError. +func (t *TimelineError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &t.ErrorMessage) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "queryId": + err = unpopulate(val, "QueryID", &t.QueryID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimelineResultsMetadata. +func (t TimelineResultsMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregations", t.Aggregations) + populate(objectMap, "errors", t.Errors) + populate(objectMap, "totalCount", t.TotalCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimelineResultsMetadata. +func (t *TimelineResultsMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregations": + err = unpopulate(val, "Aggregations", &t.Aggregations) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &t.Errors) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &t.TotalCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type URLEntity. +func (u URLEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", u.ID) + objectMap["kind"] = EntityKindURL + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type URLEntity. +func (u *URLEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &u.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type URLEntityProperties. +func (u URLEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", u.AdditionalData) + populate(objectMap, "friendlyName", u.FriendlyName) + populate(objectMap, "url", u.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type URLEntityProperties. +func (u *URLEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &u.AdditionalData) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &u.FriendlyName) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &u.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Ueba. +func (u Ueba) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", u.Etag) + populate(objectMap, "id", u.ID) + objectMap["kind"] = SettingKindUeba + populate(objectMap, "name", u.Name) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "systemData", u.SystemData) + populate(objectMap, "type", u.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Ueba. +func (u *Ueba) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &u.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &u.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &u.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &u.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UebaProperties. +func (u UebaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataSources", u.DataSources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UebaProperties. +func (u *UebaProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSources": + err = unpopulate(val, "DataSources", &u.DataSources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserInfo. +func (u UserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", u.Email) + populate(objectMap, "name", u.Name) + populate(objectMap, "objectId", u.ObjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserInfo. +func (u *UserInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &u.Email) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &u.Name) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &u.ObjectID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidationError. +func (v ValidationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessages", v.ErrorMessages) + populate(objectMap, "recordIndex", v.RecordIndex) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationError. +func (v *ValidationError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessages": + err = unpopulate(val, "ErrorMessages", &v.ErrorMessages) + delete(rawMsg, key) + case "recordIndex": + err = unpopulate(val, "RecordIndex", &v.RecordIndex) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Watchlist. +func (w Watchlist) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Watchlist. +func (w *Watchlist) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatchlistItem. +func (w WatchlistItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistItem. +func (w *WatchlistItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatchlistItemList. +func (w WatchlistItemList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistItemList. +func (w *WatchlistItemList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatchlistItemProperties. +func (w WatchlistItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "created", w.Created) + populate(objectMap, "createdBy", w.CreatedBy) + populate(objectMap, "entityMapping", w.EntityMapping) + populate(objectMap, "isDeleted", w.IsDeleted) + populate(objectMap, "itemsKeyValue", w.ItemsKeyValue) + populate(objectMap, "tenantId", w.TenantID) + populateTimeRFC3339(objectMap, "updated", w.Updated) + populate(objectMap, "updatedBy", w.UpdatedBy) + populate(objectMap, "watchlistItemId", w.WatchlistItemID) + populate(objectMap, "watchlistItemType", w.WatchlistItemType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistItemProperties. +func (w *WatchlistItemProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + err = unpopulateTimeRFC3339(val, "Created", &w.Created) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &w.CreatedBy) + delete(rawMsg, key) + case "entityMapping": + err = unpopulate(val, "EntityMapping", &w.EntityMapping) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &w.IsDeleted) + delete(rawMsg, key) + case "itemsKeyValue": + err = unpopulate(val, "ItemsKeyValue", &w.ItemsKeyValue) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &w.Updated) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &w.UpdatedBy) + delete(rawMsg, key) + case "watchlistItemId": + err = unpopulate(val, "WatchlistItemID", &w.WatchlistItemID) + delete(rawMsg, key) + case "watchlistItemType": + err = unpopulate(val, "WatchlistItemType", &w.WatchlistItemType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatchlistList. +func (w WatchlistList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistList. +func (w *WatchlistList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatchlistProperties. +func (w WatchlistProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentType", w.ContentType) + populateTimeRFC3339(objectMap, "created", w.Created) + populate(objectMap, "createdBy", w.CreatedBy) + populate(objectMap, "defaultDuration", w.DefaultDuration) + populate(objectMap, "description", w.Description) + populate(objectMap, "displayName", w.DisplayName) + populate(objectMap, "isDeleted", w.IsDeleted) + populate(objectMap, "itemsSearchKey", w.ItemsSearchKey) + populate(objectMap, "labels", w.Labels) + populate(objectMap, "numberOfLinesToSkip", w.NumberOfLinesToSkip) + populate(objectMap, "provider", w.Provider) + populate(objectMap, "rawContent", w.RawContent) + populate(objectMap, "source", w.Source) + populate(objectMap, "sourceType", w.SourceType) + populate(objectMap, "tenantId", w.TenantID) + populateTimeRFC3339(objectMap, "updated", w.Updated) + populate(objectMap, "updatedBy", w.UpdatedBy) + populate(objectMap, "uploadStatus", w.UploadStatus) + populate(objectMap, "watchlistAlias", w.WatchlistAlias) + populate(objectMap, "watchlistId", w.WatchlistID) + populate(objectMap, "watchlistType", w.WatchlistType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistProperties. +func (w *WatchlistProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contentType": + err = unpopulate(val, "ContentType", &w.ContentType) + delete(rawMsg, key) + case "created": + err = unpopulateTimeRFC3339(val, "Created", &w.Created) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &w.CreatedBy) + delete(rawMsg, key) + case "defaultDuration": + err = unpopulate(val, "DefaultDuration", &w.DefaultDuration) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &w.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &w.DisplayName) + delete(rawMsg, key) + case "isDeleted": + err = unpopulate(val, "IsDeleted", &w.IsDeleted) + delete(rawMsg, key) + case "itemsSearchKey": + err = unpopulate(val, "ItemsSearchKey", &w.ItemsSearchKey) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &w.Labels) + delete(rawMsg, key) + case "numberOfLinesToSkip": + err = unpopulate(val, "NumberOfLinesToSkip", &w.NumberOfLinesToSkip) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &w.Provider) + delete(rawMsg, key) + case "rawContent": + err = unpopulate(val, "RawContent", &w.RawContent) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &w.Source) + delete(rawMsg, key) + case "sourceType": + err = unpopulate(val, "SourceType", &w.SourceType) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "updated": + err = unpopulateTimeRFC3339(val, "Updated", &w.Updated) + delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &w.UpdatedBy) + delete(rawMsg, key) + case "uploadStatus": + err = unpopulate(val, "UploadStatus", &w.UploadStatus) + delete(rawMsg, key) + case "watchlistAlias": + err = unpopulate(val, "WatchlistAlias", &w.WatchlistAlias) + delete(rawMsg, key) + case "watchlistId": + err = unpopulate(val, "WatchlistID", &w.WatchlistID) + delete(rawMsg, key) + case "watchlistType": + err = unpopulate(val, "WatchlistType", &w.WatchlistType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Webhook. +func (w Webhook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rotateWebhookSecret", w.RotateWebhookSecret) + populate(objectMap, "webhookId", w.WebhookID) + populate(objectMap, "webhookSecretUpdateTime", w.WebhookSecretUpdateTime) + populate(objectMap, "webhookUrl", w.WebhookURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Webhook. +func (w *Webhook) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rotateWebhookSecret": + err = unpopulate(val, "RotateWebhookSecret", &w.RotateWebhookSecret) + delete(rawMsg, key) + case "webhookId": + err = unpopulate(val, "WebhookID", &w.WebhookID) + delete(rawMsg, key) + case "webhookSecretUpdateTime": + err = unpopulate(val, "WebhookSecretUpdateTime", &w.WebhookSecretUpdateTime) + delete(rawMsg, key) + case "webhookUrl": + err = unpopulate(val, "WebhookURL", &w.WebhookURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_officeconsents_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_officeconsents_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client.go index 1d5b25e9fb2e..ca569523dfe5 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_officeconsents_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewOfficeConsentsClient(subscriptionID string, credential azcore.TokenCrede // Delete - Delete the office365 consent. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // consentID - consent ID @@ -100,7 +101,7 @@ func (client *OfficeConsentsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +109,7 @@ func (client *OfficeConsentsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets an office365 consent. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // consentID - consent ID @@ -152,7 +153,7 @@ func (client *OfficeConsentsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,8 +169,7 @@ func (client *OfficeConsentsClient) getHandleResponse(resp *http.Response) (Offi } // NewListPager - Gets all office365 consents. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - OfficeConsentsClientListOptions contains the optional parameters for the OfficeConsentsClient.List method. @@ -221,7 +221,7 @@ func (client *OfficeConsentsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_officeconsents_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client_example_test.go similarity index 85% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_officeconsents_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client_example_test.go index bab894f1861a..d1d8a9ec955e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_officeconsents_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/officeconsents_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/officeConsents/GetOfficeConsents.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/officeConsents/GetOfficeConsents.json func ExampleOfficeConsentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,9 +27,7 @@ func ExampleOfficeConsentsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -42,7 +40,7 @@ func ExampleOfficeConsentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/officeConsents/GetOfficeConsentsById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/officeConsents/GetOfficeConsentsById.json func ExampleOfficeConsentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,11 +51,7 @@ func ExampleOfficeConsentsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -65,7 +59,7 @@ func ExampleOfficeConsentsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/officeConsents/DeleteOfficeConsents.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/officeConsents/DeleteOfficeConsents.json func ExampleOfficeConsentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,11 +70,7 @@ func ExampleOfficeConsentsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "04e5fd05-ff86-4b97-b8d2-1c20933cb46c", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_operations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go similarity index 95% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_operations_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go index dd47a1d25fa3..7a7fb02607f2 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_operations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all operations available Azure Security Insights Resource Provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go similarity index 95% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_operations_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go index ab1e242a4e87..19435114df44 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/operations/ListOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/operations/ListOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go similarity index 98% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go index 39781f1084de..9002cbcd1fa6 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -153,8 +154,12 @@ func unmarshalAutomationRuleConditionClassification(rawMsg json.RawMessage) (Aut } var b AutomationRuleConditionClassification switch m["conditionType"] { + case string(ConditionTypeBoolean): + b = &BooleanConditionProperties{} case string(ConditionTypeProperty): b = &PropertyConditionProperties{} + case string(ConditionTypePropertyArray): + b = &PropertyArrayConditionProperties{} case string(ConditionTypePropertyArrayChanged): b = &PropertyArrayChangedConditionProperties{} case string(ConditionTypePropertyChanged): @@ -297,6 +302,8 @@ func unmarshalEntityClassification(rawMsg json.RawMessage) (EntityClassification b = &MailboxEntity{} case string(EntityKindMalware): b = &MalwareEntity{} + case string(EntityKindNic): + b = &NicEntity{} case string(EntityKindProcess): b = &ProcessEntity{} case string(EntityKindRegistryKey): diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_productsettings_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_productsettings_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client.go index c84f02a16951..2297f0beda44 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_productsettings_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewProductSettingsClient(subscriptionID string, credential azcore.TokenCred // Delete - Delete setting of the product. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsName - The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba @@ -100,7 +101,7 @@ func (client *ProductSettingsClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +109,7 @@ func (client *ProductSettingsClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsName - The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba @@ -152,7 +153,7 @@ func (client *ProductSettingsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +170,7 @@ func (client *ProductSettingsClient) getHandleResponse(resp *http.Response) (Pro // List - List of all the settings // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - ProductSettingsClientListOptions contains the optional parameters for the ProductSettingsClient.List method. @@ -208,7 +209,7 @@ func (client *ProductSettingsClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +226,7 @@ func (client *ProductSettingsClient) listHandleResponse(resp *http.Response) (Pr // Update - Updates setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsName - The setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba @@ -270,7 +271,7 @@ func (client *ProductSettingsClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, settings) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_productsettings_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client_example_test.go similarity index 80% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_productsettings_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client_example_test.go index ffb276d1759c..77a0a1a574bb 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_productsettings_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/productsettings_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/settings/GetAllSettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/settings/GetAllSettings.json func ExampleProductSettingsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleProductSettingsClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.List(ctx, - "myRg", - "myWorkspace", - nil) + res, err := client.List(ctx, "myRg", "myWorkspace", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -39,7 +36,7 @@ func ExampleProductSettingsClient_List() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/settings/GetEyesOnSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/settings/GetEyesOnSetting.json func ExampleProductSettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -50,11 +47,7 @@ func ExampleProductSettingsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "EyesOn", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "EyesOn", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -62,7 +55,7 @@ func ExampleProductSettingsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/settings/DeleteEyesOnSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/settings/DeleteEyesOnSetting.json func ExampleProductSettingsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,17 +66,13 @@ func ExampleProductSettingsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "EyesOn", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "EyesOn", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/settings/UpdateEyesOnSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/settings/UpdateEyesOnSetting.json func ExampleProductSettingsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,16 +83,11 @@ func ExampleProductSettingsClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Update(ctx, - "myRg", - "myWorkspace", - "EyesOn", - &armsecurityinsights.EyesOn{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Kind: to.Ptr(armsecurityinsights.SettingKindEyesOn), - Properties: &armsecurityinsights.EyesOnSettingsProperties{}, - }, - nil) + res, err := client.Update(ctx, "myRg", "myWorkspace", "EyesOn", &armsecurityinsights.EyesOn{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Kind: to.Ptr(armsecurityinsights.SettingKindEyesOn), + Properties: &armsecurityinsights.EyesOnSettingsProperties{}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_response_types.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_response_types.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go index 879da0f7f931..84f0156bfa8d 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_response_types.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -324,6 +325,26 @@ type EntityRelationsClientGetRelationResponse struct { Relation } +// FileImportsClientCreateResponse contains the response from method FileImportsClient.Create. +type FileImportsClientCreateResponse struct { + FileImport +} + +// FileImportsClientDeleteResponse contains the response from method FileImportsClient.Delete. +type FileImportsClientDeleteResponse struct { + FileImport +} + +// FileImportsClientGetResponse contains the response from method FileImportsClient.Get. +type FileImportsClientGetResponse struct { + FileImport +} + +// FileImportsClientListResponse contains the response from method FileImportsClient.List. +type FileImportsClientListResponse struct { + FileImportList +} + // IPGeodataClientGetResponse contains the response from method IPGeodataClient.Get. type IPGeodataClientGetResponse struct { EnrichmentIPGeodata diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_securitymlanalyticssettings_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_securitymlanalyticssettings_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go index 406c9e68fe67..f29ad30a62f0 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_securitymlanalyticssettings_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewSecurityMLAnalyticsSettingsClient(subscriptionID string, credential azco // CreateOrUpdate - Creates or updates the Security ML Analytics Settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsResourceName - Security ML Analytics Settings resource name @@ -102,7 +103,7 @@ func (client *SecurityMLAnalyticsSettingsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, securityMLAnalyticsSetting) @@ -119,7 +120,7 @@ func (client *SecurityMLAnalyticsSettingsClient) createOrUpdateHandleResponse(re // Delete - Delete the Security ML Analytics Settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsResourceName - Security ML Analytics Settings resource name @@ -164,7 +165,7 @@ func (client *SecurityMLAnalyticsSettingsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -172,7 +173,7 @@ func (client *SecurityMLAnalyticsSettingsClient) deleteCreateRequest(ctx context // Get - Gets the Security ML Analytics Settings. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // settingsResourceName - Security ML Analytics Settings resource name @@ -217,7 +218,7 @@ func (client *SecurityMLAnalyticsSettingsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,8 +234,7 @@ func (client *SecurityMLAnalyticsSettingsClient) getHandleResponse(resp *http.Re } // NewListPager - Gets all Security ML Analytics Settings. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - SecurityMLAnalyticsSettingsClientListOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.List @@ -287,7 +287,7 @@ func (client *SecurityMLAnalyticsSettingsClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_securitymlanalyticssettings_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client_example_test.go similarity index 51% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_securitymlanalyticssettings_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client_example_test.go index 2d4d7ea316d9..309bbc3ad452 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_securitymlanalyticssettings_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/securityMLAnalyticsSettings/GetAllSecurityMLAnalyticsSettings.json func ExampleSecurityMLAnalyticsSettingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/securityMLAnalyticsSettings/GetAnomalySecurityMLAnalyticsSetting.json func ExampleSecurityMLAnalyticsSettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "myFirstAnomalySettings", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "myFirstAnomalySettings", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/securityMLAnalyticsSettings/CreateAnomalySecurityMLAnalyticsSetting.json func ExampleSecurityMLAnalyticsSettingsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,81 +71,76 @@ func ExampleSecurityMLAnalyticsSettingsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "f209187f-1d17-4431-94af-c141bf5f23db", - &armsecurityinsights.AnomalySecurityMLAnalyticsSettings{ - Etag: to.Ptr("\"260090e2-0000-0d00-0000-5d6fb8670000\""), - Kind: to.Ptr(armsecurityinsights.SecurityMLAnalyticsSettingsKindAnomaly), - Properties: &armsecurityinsights.AnomalySecurityMLAnalyticsSettingsProperties{ - Description: to.Ptr("When account logs from a source region that has rarely been logged in from during the last 14 days, an anomaly is triggered."), - AnomalySettingsVersion: to.Ptr[int32](0), - AnomalyVersion: to.Ptr("1.0.5"), - CustomizableObservations: map[string]interface{}{ - "multiSelectObservations": nil, - "prioritizeExcludeObservations": nil, - "singleSelectObservations": []interface{}{ - map[string]interface{}{ - "name": "Device vendor", - "description": "Select device vendor of network connection logs from CommonSecurityLog", - "rerun": "RerunAlways", - "sequenceNumber": float64(1), - "supportedValues": []interface{}{ - "Palo Alto Networks", - "Fortinet", - "Check Point", - }, - "supportedValuesKql": nil, - "value": []interface{}{ - "Palo Alto Networks", - }, - "valuesKql": nil, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", &armsecurityinsights.AnomalySecurityMLAnalyticsSettings{ + Etag: to.Ptr("\"260090e2-0000-0d00-0000-5d6fb8670000\""), + Kind: to.Ptr(armsecurityinsights.SecurityMLAnalyticsSettingsKindAnomaly), + Properties: &armsecurityinsights.AnomalySecurityMLAnalyticsSettingsProperties{ + Description: to.Ptr("When account logs from a source region that has rarely been logged in from during the last 14 days, an anomaly is triggered."), + AnomalySettingsVersion: to.Ptr[int32](0), + AnomalyVersion: to.Ptr("1.0.5"), + CustomizableObservations: map[string]interface{}{ + "multiSelectObservations": nil, + "prioritizeExcludeObservations": nil, + "singleSelectObservations": []interface{}{ + map[string]interface{}{ + "name": "Device vendor", + "description": "Select device vendor of network connection logs from CommonSecurityLog", + "rerun": "RerunAlways", + "sequenceNumber": float64(1), + "supportedValues": []interface{}{ + "Palo Alto Networks", + "Fortinet", + "Check Point", }, - }, - "singleValueObservations": nil, - "thresholdObservations": []interface{}{ - map[string]interface{}{ - "name": "Daily data transfer threshold in MB", - "description": "Suppress anomalies when daily data transfered (in MB) per hour is less than the chosen value", - "maximum": "100", - "minimum": "1", - "rerun": "RerunAlways", - "sequenceNumber": float64(1), - "value": "25", - }, - map[string]interface{}{ - "name": "Number of standard deviations", - "description": "Triggers anomalies when number of standard deviations is greater than the chosen value", - "maximum": "10", - "minimum": "2", - "rerun": "RerunAlways", - "sequenceNumber": float64(2), - "value": "3", + "supportedValuesKql": nil, + "value": []interface{}{ + "Palo Alto Networks", }, + "valuesKql": nil, + }, + }, + "singleValueObservations": nil, + "thresholdObservations": []interface{}{ + map[string]interface{}{ + "name": "Daily data transfer threshold in MB", + "description": "Suppress anomalies when daily data transfered (in MB) per hour is less than the chosen value", + "maximum": "100", + "minimum": "1", + "rerun": "RerunAlways", + "sequenceNumber": float64(1), + "value": "25", + }, + map[string]interface{}{ + "name": "Number of standard deviations", + "description": "Triggers anomalies when number of standard deviations is greater than the chosen value", + "maximum": "10", + "minimum": "2", + "rerun": "RerunAlways", + "sequenceNumber": float64(2), + "value": "3", }, }, - DisplayName: to.Ptr("Login from unusual region"), - Enabled: to.Ptr(true), - Frequency: to.Ptr("PT1H"), - IsDefaultSettings: to.Ptr(true), - RequiredDataConnectors: []*armsecurityinsights.SecurityMLAnalyticsSettingsDataSource{ - { - ConnectorID: to.Ptr("AWS"), - DataTypes: []*string{ - to.Ptr("AWSCloudTrail")}, - }}, - SettingsDefinitionID: to.Ptr("f209187f-1d17-4431-94af-c141bf5f23db"), - SettingsStatus: to.Ptr(armsecurityinsights.SettingsStatusProduction), - Tactics: []*armsecurityinsights.AttackTactic{ - to.Ptr(armsecurityinsights.AttackTacticExfiltration), - to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, - Techniques: []*string{ - to.Ptr("T1037"), - to.Ptr("T1021")}, }, + DisplayName: to.Ptr("Login from unusual region"), + Enabled: to.Ptr(true), + Frequency: to.Ptr("PT1H"), + IsDefaultSettings: to.Ptr(true), + RequiredDataConnectors: []*armsecurityinsights.SecurityMLAnalyticsSettingsDataSource{ + { + ConnectorID: to.Ptr("AWS"), + DataTypes: []*string{ + to.Ptr("AWSCloudTrail")}, + }}, + SettingsDefinitionID: to.Ptr("f209187f-1d17-4431-94af-c141bf5f23db"), + SettingsStatus: to.Ptr(armsecurityinsights.SettingsStatusProduction), + Tactics: []*armsecurityinsights.AttackTactic{ + to.Ptr(armsecurityinsights.AttackTacticExfiltration), + to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, + Techniques: []*string{ + to.Ptr("T1037"), + to.Ptr("T1021")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -159,7 +148,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_CreateOrUpdate() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/securityMLAnalyticsSettings/DeleteSecurityMLAnalyticsSetting.json func ExampleSecurityMLAnalyticsSettingsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,11 +159,7 @@ func ExampleSecurityMLAnalyticsSettingsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "f209187f-1d17-4431-94af-c141bf5f23db", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "f209187f-1d17-4431-94af-c141bf5f23db", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sentinelonboardingstates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sentinelonboardingstates_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go index a9fb104e4e16..16f44cb78c9d 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sentinelonboardingstates_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewSentinelOnboardingStatesClient(subscriptionID string, credential azcore. // Create - Create Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -101,7 +102,7 @@ func (client *SentinelOnboardingStatesClient) createCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.SentinelOnboardingStateParameter != nil { @@ -121,7 +122,7 @@ func (client *SentinelOnboardingStatesClient) createHandleResponse(resp *http.Re // Delete - Delete Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -166,7 +167,7 @@ func (client *SentinelOnboardingStatesClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +175,7 @@ func (client *SentinelOnboardingStatesClient) deleteCreateRequest(ctx context.Co // Get - Get Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -219,7 +220,7 @@ func (client *SentinelOnboardingStatesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +237,7 @@ func (client *SentinelOnboardingStatesClient) getHandleResponse(resp *http.Respo // List - Gets all Sentinel onboarding states // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - SentinelOnboardingStatesClientListOptions contains the optional parameters for the SentinelOnboardingStatesClient.List @@ -276,7 +277,7 @@ func (client *SentinelOnboardingStatesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sentinelonboardingstates_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go similarity index 82% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sentinelonboardingstates_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go index 5968a2c62dd4..88b425b35cd2 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sentinelonboardingstates_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/onboardingStates/GetSentinelOnboardingState.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/onboardingStates/GetSentinelOnboardingState.json func ExampleSentinelOnboardingStatesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,11 +28,7 @@ func ExampleSentinelOnboardingStatesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "default", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -40,7 +36,7 @@ func ExampleSentinelOnboardingStatesClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/onboardingStates/CreateSentinelOnboardingState.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/onboardingStates/CreateSentinelOnboardingState.json func ExampleSentinelOnboardingStatesClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -51,16 +47,12 @@ func ExampleSentinelOnboardingStatesClient_Create() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, - "myRg", - "myWorkspace", - "default", - &armsecurityinsights.SentinelOnboardingStatesClientCreateOptions{SentinelOnboardingStateParameter: &armsecurityinsights.SentinelOnboardingState{ - Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ - CustomerManagedKey: to.Ptr(false), - }, + res, err := client.Create(ctx, "myRg", "myWorkspace", "default", &armsecurityinsights.SentinelOnboardingStatesClientCreateOptions{SentinelOnboardingStateParameter: &armsecurityinsights.SentinelOnboardingState{ + Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ + CustomerManagedKey: to.Ptr(false), }, - }) + }, + }) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +60,7 @@ func ExampleSentinelOnboardingStatesClient_Create() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/onboardingStates/DeleteSentinelOnboardingState.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/onboardingStates/DeleteSentinelOnboardingState.json func ExampleSentinelOnboardingStatesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,17 +71,13 @@ func ExampleSentinelOnboardingStatesClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "default", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/onboardingStates/GetAllSentinelOnboardingStates.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/onboardingStates/GetAllSentinelOnboardingStates.json func ExampleSentinelOnboardingStatesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -100,10 +88,7 @@ func ExampleSentinelOnboardingStatesClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.List(ctx, - "myRg", - "myWorkspace", - nil) + res, err := client.List(ctx, "myRg", "myWorkspace", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrol_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrol_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go index 44ab451b7c57..c8b79c0245c4 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrol_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -55,8 +56,7 @@ func NewSourceControlClient(subscriptionID string, credential azcore.TokenCreden } // NewListRepositoriesPager - Gets a list of repositories metadata. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // repoType - The repo type. @@ -110,7 +110,7 @@ func (client *SourceControlClient) listRepositoriesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, repoType) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrol_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client_example_test.go similarity index 88% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrol_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client_example_test.go index a8b480010653..68f872bb1abb 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrol_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/repositories/GetRepositories.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/repositories/GetRepositories.json func ExampleSourceControlClient_NewListRepositoriesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleSourceControlClient_NewListRepositoriesPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListRepositoriesPager("myRg", - "myWorkspace", - armsecurityinsights.RepoTypeGithub, - nil) + pager := client.NewListRepositoriesPager("myRg", "myWorkspace", armsecurityinsights.RepoTypeGithub, nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrols_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go similarity index 96% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrols_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go index 0fb473103c49..0310ed76454a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_sourcecontrols_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewSourceControlsClient(subscriptionID string, credential azcore.TokenCrede // Create - Creates a source control. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sourceControlID - Source control Id @@ -101,7 +102,7 @@ func (client *SourceControlsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, sourceControl) @@ -118,7 +119,7 @@ func (client *SourceControlsClient) createHandleResponse(resp *http.Response) (S // Delete - Delete a source control. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sourceControlID - Source control Id @@ -162,7 +163,7 @@ func (client *SourceControlsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +171,7 @@ func (client *SourceControlsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a source control byt its identifier. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // sourceControlID - Source control Id @@ -214,7 +215,7 @@ func (client *SourceControlsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,8 +231,7 @@ func (client *SourceControlsClient) getHandleResponse(resp *http.Response) (Sour } // NewListPager - Gets all source controls, without source control items. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - SourceControlsClientListOptions contains the optional parameters for the SourceControlsClient.List method. @@ -283,7 +283,7 @@ func (client *SourceControlsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrols_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client_example_test.go similarity index 67% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrols_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client_example_test.go index 68a431066ba6..91a098b2ed94 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_sourcecontrols_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/sourcecontrols/GetSourceControls.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/sourcecontrols/GetSourceControls.json func ExampleSourceControlsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleSourceControlsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) + pager := client.NewListPager("myRg", "myWorkspace", nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleSourceControlsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/sourcecontrols/GetSourceControlById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/sourcecontrols/GetSourceControlById.json func ExampleSourceControlsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleSourceControlsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "789e0c1f-4a3d-43ad-809c-e713b677b04a", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleSourceControlsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/sourcecontrols/DeleteSourceControl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/sourcecontrols/DeleteSourceControl.json func ExampleSourceControlsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,17 +71,13 @@ func ExampleSourceControlsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "789e0c1f-4a3d-43ad-809c-e713b677b04a", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/sourcecontrols/CreateSourceControl.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/sourcecontrols/CreateSourceControl.json func ExampleSourceControlsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,36 +88,31 @@ func ExampleSourceControlsClient_Create() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, - "myRg", - "myWorkspace", - "789e0c1f-4a3d-43ad-809c-e713b677b04a", - armsecurityinsights.SourceControl{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.SourceControlProperties{ - Description: to.Ptr("This is a source control"), - ContentTypes: []*armsecurityinsights.ContentType{ - to.Ptr(armsecurityinsights.ContentType("AnalyticRules")), - to.Ptr(armsecurityinsights.ContentTypeWorkbook)}, - DisplayName: to.Ptr("My Source Control"), - RepoType: to.Ptr(armsecurityinsights.RepoTypeGithub), - Repository: &armsecurityinsights.Repository{ - Branch: to.Ptr("master"), - DisplayURL: to.Ptr("https://github.com/user/repo"), - PathMapping: []*armsecurityinsights.ContentPathMap{ - { - Path: to.Ptr("path/to/rules"), - ContentType: to.Ptr(armsecurityinsights.ContentType("AnalyticRules")), - }, - { - Path: to.Ptr("path/to/workbooks"), - ContentType: to.Ptr(armsecurityinsights.ContentTypeWorkbook), - }}, - URL: to.Ptr("https://github.com/user/repo"), - }, + res, err := client.Create(ctx, "myRg", "myWorkspace", "789e0c1f-4a3d-43ad-809c-e713b677b04a", armsecurityinsights.SourceControl{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.SourceControlProperties{ + Description: to.Ptr("This is a source control"), + ContentTypes: []*armsecurityinsights.ContentType{ + to.Ptr(armsecurityinsights.ContentType("AnalyticRules")), + to.Ptr(armsecurityinsights.ContentTypeWorkbook)}, + DisplayName: to.Ptr("My Source Control"), + RepoType: to.Ptr(armsecurityinsights.RepoTypeGithub), + Repository: &armsecurityinsights.Repository{ + Branch: to.Ptr("master"), + DisplayURL: to.Ptr("https://github.com/user/repo"), + PathMapping: []*armsecurityinsights.ContentPathMap{ + { + Path: to.Ptr("path/to/rules"), + ContentType: to.Ptr(armsecurityinsights.ContentType("AnalyticRules")), + }, + { + Path: to.Ptr("path/to/workbooks"), + ContentType: to.Ptr(armsecurityinsights.ContentTypeWorkbook), + }}, + URL: to.Ptr("https://github.com/user/repo"), }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicator_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicator_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go index 7e7f314c3fd5..82a4481bc7a3 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicator_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewThreatIntelligenceIndicatorClient(subscriptionID string, credential azco // AppendTags - Append tags to a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // name - Threat intelligence indicator name field. @@ -102,7 +103,7 @@ func (client *ThreatIntelligenceIndicatorClient) appendTagsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, threatIntelligenceAppendTags) @@ -110,7 +111,7 @@ func (client *ThreatIntelligenceIndicatorClient) appendTagsCreateRequest(ctx con // Create - Update a threat Intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // name - Threat intelligence indicator name field. @@ -156,7 +157,7 @@ func (client *ThreatIntelligenceIndicatorClient) createCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, threatIntelligenceProperties) @@ -173,7 +174,7 @@ func (client *ThreatIntelligenceIndicatorClient) createHandleResponse(resp *http // CreateIndicator - Create a new threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // threatIntelligenceProperties - Properties of threat intelligence indicators to create and update. @@ -214,7 +215,7 @@ func (client *ThreatIntelligenceIndicatorClient) createIndicatorCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, threatIntelligenceProperties) @@ -231,7 +232,7 @@ func (client *ThreatIntelligenceIndicatorClient) createIndicatorHandleResponse(r // Delete - Delete a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // name - Threat intelligence indicator name field. @@ -276,7 +277,7 @@ func (client *ThreatIntelligenceIndicatorClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +285,7 @@ func (client *ThreatIntelligenceIndicatorClient) deleteCreateRequest(ctx context // Get - View a threat intelligence indicator by name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // name - Threat intelligence indicator name field. @@ -329,7 +330,7 @@ func (client *ThreatIntelligenceIndicatorClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,8 +346,7 @@ func (client *ThreatIntelligenceIndicatorClient) getHandleResponse(resp *http.Re } // NewQueryIndicatorsPager - Query threat intelligence indicators as per filtering criteria. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // threatIntelligenceFilteringCriteria - Filtering criteria for querying threat intelligence indicators. @@ -400,7 +400,7 @@ func (client *ThreatIntelligenceIndicatorClient) queryIndicatorsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, threatIntelligenceFilteringCriteria) @@ -417,7 +417,7 @@ func (client *ThreatIntelligenceIndicatorClient) queryIndicatorsHandleResponse(r // ReplaceTags - Replace tags added to a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // name - Threat intelligence indicator name field. @@ -463,7 +463,7 @@ func (client *ThreatIntelligenceIndicatorClient) replaceTagsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, threatIntelligenceReplaceTags) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicator_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go similarity index 56% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicator_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go index b872e9634bb4..bca8188d0e3e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicator_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/CreateThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/CreateThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_CreateIndicator() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,34 +28,30 @@ func ExampleThreatIntelligenceIndicatorClient_CreateIndicator() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateIndicator(ctx, - "myRg", - "myWorkspace", - armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - Description: to.Ptr("debugging indicators"), - Confidence: to.Ptr[int32](78), - CreatedByRef: to.Ptr("contoso@contoso.com"), - DisplayName: to.Ptr("new schema"), - ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, - GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, - KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, - Labels: []*string{}, - Modified: to.Ptr(""), - Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - PatternType: to.Ptr("url"), - Revoked: to.Ptr(false), - Source: to.Ptr("Azure Sentinel"), - ThreatIntelligenceTags: []*string{ - to.Ptr("new schema")}, - ThreatTypes: []*string{ - to.Ptr("compromised")}, - ValidFrom: to.Ptr("2021-09-15T17:44:00.114052Z"), - ValidUntil: to.Ptr(""), - }, + res, err := client.CreateIndicator(ctx, "myRg", "myWorkspace", armsecurityinsights.ThreatIntelligenceIndicatorModel{ + Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), + Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ + Description: to.Ptr("debugging indicators"), + Confidence: to.Ptr[int32](78), + CreatedByRef: to.Ptr("contoso@contoso.com"), + DisplayName: to.Ptr("new schema"), + ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, + GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, + KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, + Labels: []*string{}, + Modified: to.Ptr(""), + Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), + PatternType: to.Ptr("url"), + Revoked: to.Ptr(false), + Source: to.Ptr("Azure Sentinel"), + ThreatIntelligenceTags: []*string{ + to.Ptr("new schema")}, + ThreatTypes: []*string{ + to.Ptr("compromised")}, + ValidFrom: to.Ptr("2021-09-15T17:44:00.114052Z"), + ValidUntil: to.Ptr(""), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -63,7 +59,7 @@ func ExampleThreatIntelligenceIndicatorClient_CreateIndicator() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/GetThreatIntelligenceById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/GetThreatIntelligenceById.json func ExampleThreatIntelligenceIndicatorClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,11 +70,7 @@ func ExampleThreatIntelligenceIndicatorClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "e16ef847-962e-d7b6-9c8b-a33e4bd30e47", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "e16ef847-962e-d7b6-9c8b-a33e4bd30e47", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -86,7 +78,7 @@ func ExampleThreatIntelligenceIndicatorClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/UpdateThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/UpdateThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -97,35 +89,30 @@ func ExampleThreatIntelligenceIndicatorClient_Create() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Create(ctx, - "myRg", - "myWorkspace", - "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - Description: to.Ptr("debugging indicators"), - Confidence: to.Ptr[int32](78), - CreatedByRef: to.Ptr("contoso@contoso.com"), - DisplayName: to.Ptr("new schema"), - ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, - GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, - KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, - Labels: []*string{}, - Modified: to.Ptr(""), - Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - PatternType: to.Ptr("url"), - Revoked: to.Ptr(false), - Source: to.Ptr("Azure Sentinel"), - ThreatIntelligenceTags: []*string{ - to.Ptr("new schema")}, - ThreatTypes: []*string{ - to.Ptr("compromised")}, - ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - ValidUntil: to.Ptr(""), - }, + res, err := client.Create(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceIndicatorModel{ + Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), + Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ + Description: to.Ptr("debugging indicators"), + Confidence: to.Ptr[int32](78), + CreatedByRef: to.Ptr("contoso@contoso.com"), + DisplayName: to.Ptr("new schema"), + ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, + GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, + KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, + Labels: []*string{}, + Modified: to.Ptr(""), + Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), + PatternType: to.Ptr("url"), + Revoked: to.Ptr(false), + Source: to.Ptr("Azure Sentinel"), + ThreatIntelligenceTags: []*string{ + to.Ptr("new schema")}, + ThreatTypes: []*string{ + to.Ptr("compromised")}, + ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), + ValidUntil: to.Ptr(""), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -133,7 +120,7 @@ func ExampleThreatIntelligenceIndicatorClient_Create() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/DeleteThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/DeleteThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,17 +131,13 @@ func ExampleThreatIntelligenceIndicatorClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/QueryThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/QueryThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_NewQueryIndicatorsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -165,23 +148,20 @@ func ExampleThreatIntelligenceIndicatorClient_NewQueryIndicatorsPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewQueryIndicatorsPager("myRg", - "myWorkspace", - armsecurityinsights.ThreatIntelligenceFilteringCriteria{ - MaxConfidence: to.Ptr[int32](80), - MaxValidUntil: to.Ptr("2021-04-25T17:44:00.114052Z"), - MinConfidence: to.Ptr[int32](25), - MinValidUntil: to.Ptr("2021-04-05T17:44:00.114052Z"), - PageSize: to.Ptr[int32](100), - SortBy: []*armsecurityinsights.ThreatIntelligenceSortingCriteria{ - { - ItemKey: to.Ptr("lastUpdatedTimeUtc"), - SortOrder: to.Ptr(armsecurityinsights.ThreatIntelligenceSortingCriteriaEnumDescending), - }}, - Sources: []*string{ - to.Ptr("Azure Sentinel")}, - }, - nil) + pager := client.NewQueryIndicatorsPager("myRg", "myWorkspace", armsecurityinsights.ThreatIntelligenceFilteringCriteria{ + MaxConfidence: to.Ptr[int32](80), + MaxValidUntil: to.Ptr("2021-04-25T17:44:00.114052Z"), + MinConfidence: to.Ptr[int32](25), + MinValidUntil: to.Ptr("2021-04-05T17:44:00.114052Z"), + PageSize: to.Ptr[int32](100), + SortBy: []*armsecurityinsights.ThreatIntelligenceSortingCriteria{ + { + ItemKey: to.Ptr("lastUpdatedTimeUtc"), + SortOrder: to.Ptr(armsecurityinsights.ThreatIntelligenceSortingCriteriaEnumDescending), + }}, + Sources: []*string{ + to.Ptr("Azure Sentinel")}, + }, nil) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -194,7 +174,7 @@ func ExampleThreatIntelligenceIndicatorClient_NewQueryIndicatorsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/AppendTagsThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/AppendTagsThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_AppendTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -205,22 +185,17 @@ func ExampleThreatIntelligenceIndicatorClient_AppendTags() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.AppendTags(ctx, - "myRg", - "myWorkspace", - "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - armsecurityinsights.ThreatIntelligenceAppendTags{ - ThreatIntelligenceTags: []*string{ - to.Ptr("tag1"), - to.Ptr("tag2")}, - }, - nil) + _, err = client.AppendTags(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceAppendTags{ + ThreatIntelligenceTags: []*string{ + to.Ptr("tag1"), + to.Ptr("tag2")}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/ReplaceTagsThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/ReplaceTagsThreatIntelligence.json func ExampleThreatIntelligenceIndicatorClient_ReplaceTags() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -231,19 +206,14 @@ func ExampleThreatIntelligenceIndicatorClient_ReplaceTags() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.ReplaceTags(ctx, - "myRg", - "myWorkspace", - "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", - armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Etag: to.Ptr("\"0000262c-0000-0800-0000-5e9767060000\""), - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - ThreatIntelligenceTags: []*string{ - to.Ptr("patching tags")}, - }, + res, err := client.ReplaceTags(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceIndicatorModel{ + Etag: to.Ptr("\"0000262c-0000-0800-0000-5e9767060000\""), + Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceKindEnumIndicator), + Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ + ThreatIntelligenceTags: []*string{ + to.Ptr("patching tags")}, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicatormetrics_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicatormetrics_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go index 6eae22aa50dc..a5b2af91f42a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicatormetrics_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewThreatIntelligenceIndicatorMetricsClient(subscriptionID string, credenti // List - Get threat intelligence indicators metrics (Indicators counts by Type, Threat Type, Source). // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - ThreatIntelligenceIndicatorMetricsClientListOptions contains the optional parameters for the ThreatIntelligenceIndicatorMetricsClient.List @@ -96,7 +97,7 @@ func (client *ThreatIntelligenceIndicatorMetricsClient) listCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicatormetrics_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go similarity index 90% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicatormetrics_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go index 184e6ab508c5..080f6bfd87ad 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicatormetrics_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/CollectThreatIntelligenceMetrics.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/CollectThreatIntelligenceMetrics.json func ExampleThreatIntelligenceIndicatorMetricsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,10 +27,7 @@ func ExampleThreatIntelligenceIndicatorMetricsClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.List(ctx, - "myRg", - "myWorkspace", - nil) + res, err := client.List(ctx, "myRg", "myWorkspace", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicators_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicators_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go index df93e12c970e..af67b9c716f8 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_threatintelligenceindicators_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,8 +57,7 @@ func NewThreatIntelligenceIndicatorsClient(subscriptionID string, credential azc } // NewListPager - Get all threat intelligence indicators. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - ThreatIntelligenceIndicatorsClientListOptions contains the optional parameters for the ThreatIntelligenceIndicatorsClient.List @@ -110,7 +110,7 @@ func (client *ThreatIntelligenceIndicatorsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicators_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go similarity index 83% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicators_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go index 6db79fef9034..f00e40fb33d1 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_threatintelligenceindicators_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/threatintelligence/GetThreatIntelligence.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/threatintelligence/GetThreatIntelligence.json func ExampleThreatIntelligenceIndicatorsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,13 +27,11 @@ func ExampleThreatIntelligenceIndicatorsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.ThreatIntelligenceIndicatorsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.ThreatIntelligenceIndicatorsClientListOptions{Filter: nil, + Orderby: nil, + Top: nil, + SkipToken: nil, + }) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_time_rfc3339.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/time_rfc3339.go index c5f7901aeae3..4f3a7bee0180 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/time_rfc3339.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlistitems_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlistitems_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go index bea60fa242e9..48e4760279cb 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlistitems_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -56,7 +57,7 @@ func NewWatchlistItemsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates a watchlist item. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -107,7 +108,7 @@ func (client *WatchlistItemsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, watchlistItem) @@ -124,7 +125,7 @@ func (client *WatchlistItemsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Delete a watchlist item. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -173,7 +174,7 @@ func (client *WatchlistItemsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +182,7 @@ func (client *WatchlistItemsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a watchlist, without its watchlist items. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -230,7 +231,7 @@ func (client *WatchlistItemsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,8 +247,7 @@ func (client *WatchlistItemsClient) getHandleResponse(resp *http.Response) (Watc } // NewListPager - Gets all watchlist Items. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -304,7 +304,7 @@ func (client *WatchlistItemsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlistitems_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go similarity index 73% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlistitems_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go index 72521705556e..eb47aad3863a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlistitems_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/GetWatchlistItems.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/GetWatchlistItems.json func ExampleWatchlistItemsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,10 +28,7 @@ func ExampleWatchlistItemsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - "highValueAsset", - &armsecurityinsights.WatchlistItemsClientListOptions{SkipToken: nil}) + pager := client.NewListPager("myRg", "myWorkspace", "highValueAsset", &armsecurityinsights.WatchlistItemsClientListOptions{SkipToken: nil}) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -44,7 +41,7 @@ func ExampleWatchlistItemsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/GetWatchlistItemById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/GetWatchlistItemById.json func ExampleWatchlistItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,12 +52,7 @@ func ExampleWatchlistItemsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - "3f8901fe-63d9-4875-9ad5-9fb3b8105797", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "highValueAsset", "3f8901fe-63d9-4875-9ad5-9fb3b8105797", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -68,7 +60,7 @@ func ExampleWatchlistItemsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/DeleteWatchlistItem.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/DeleteWatchlistItem.json func ExampleWatchlistItemsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -79,18 +71,13 @@ func ExampleWatchlistItemsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - "4008512e-1d30-48b2-9ee2-d3612ed9d3ea", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "highValueAsset", "4008512e-1d30-48b2-9ee2-d3612ed9d3ea", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/CreateWatchlistItem.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/CreateWatchlistItem.json func ExampleWatchlistItemsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,25 +88,19 @@ func ExampleWatchlistItemsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - "82ba292c-dc97-4dfc-969d-d4dd9e666842", - armsecurityinsights.WatchlistItem{ - Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - Properties: &armsecurityinsights.WatchlistItemProperties{ - ItemsKeyValue: map[string]interface{}{ - "Business tier": "10.0.2.0/24", - "Data tier": "10.0.2.0/24", - "Gateway subnet": "10.0.255.224/27", - "Private DMZ in": "10.0.0.0/27", - "Public DMZ out": "10.0.0.96/27", - "Web Tier": "10.0.1.0/24", - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", "82ba292c-dc97-4dfc-969d-d4dd9e666842", armsecurityinsights.WatchlistItem{ + Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), + Properties: &armsecurityinsights.WatchlistItemProperties{ + ItemsKeyValue: map[string]interface{}{ + "Business tier": "10.0.2.0/24", + "Data tier": "10.0.2.0/24", + "Gateway subnet": "10.0.255.224/27", + "Private DMZ in": "10.0.0.0/27", + "Public DMZ out": "10.0.0.96/27", + "Web Tier": "10.0.1.0/24", }, }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlists_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go similarity index 97% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlists_client.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go index 6770819081d5..af73bb2b3032 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_watchlists_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go @@ -5,6 +5,7 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. package armsecurityinsights @@ -61,7 +62,7 @@ func NewWatchlistsClient(subscriptionID string, credential azcore.TokenCredentia // go up to 500 MB. The status of processing such large file can be polled through the URL returned in Azure-AsyncOperation // header. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -107,7 +108,7 @@ func (client *WatchlistsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, watchlist) @@ -127,7 +128,7 @@ func (client *WatchlistsClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Delete a watchlist. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -171,7 +172,7 @@ func (client *WatchlistsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +189,7 @@ func (client *WatchlistsClient) deleteHandleResponse(resp *http.Response) (Watch // Get - Gets a watchlist, without its watchlist items. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // watchlistAlias - Watchlist Alias @@ -232,7 +233,7 @@ func (client *WatchlistsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,8 +249,7 @@ func (client *WatchlistsClient) getHandleResponse(resp *http.Response) (Watchlis } // NewListPager - Gets all watchlists, without watchlist items. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2022-09-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. // workspaceName - The name of the workspace. // options - WatchlistsClientListOptions contains the optional parameters for the WatchlistsClient.List method. @@ -301,7 +301,7 @@ func (client *WatchlistsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2022-09-01-preview") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlists_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go similarity index 55% rename from sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlists_client_test.go rename to sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go index 75e6db30d398..67cacfb84578 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_watchlists_client_test.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/GetWatchlists.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/GetWatchlists.json func ExampleWatchlistsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -28,9 +28,7 @@ func ExampleWatchlistsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.WatchlistsClientListOptions{SkipToken: nil}) + pager := client.NewListPager("myRg", "myWorkspace", &armsecurityinsights.WatchlistsClientListOptions{SkipToken: nil}) for pager.More() { nextResult, err := pager.NextPage(ctx) if err != nil { @@ -43,7 +41,7 @@ func ExampleWatchlistsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/GetWatchlistByAlias.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/GetWatchlistByAlias.json func ExampleWatchlistsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,11 +52,7 @@ func ExampleWatchlistsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - nil) + res, err := client.Get(ctx, "myRg", "myWorkspace", "highValueAsset", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -66,7 +60,7 @@ func ExampleWatchlistsClient_Get() { _ = res } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/DeleteWatchlist.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/DeleteWatchlist.json func ExampleWatchlistsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,18 +71,14 @@ func ExampleWatchlistsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - nil) + _, err = client.Delete(ctx, "myRg", "myWorkspace", "highValueAsset", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/watchlists/CreateWatchlistAndWatchlistItems.json -func ExampleWatchlistsClient_CreateOrUpdate() { +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/CreateWatchlistAndWatchlistItems.json +func ExampleWatchlistsClient_CreateOrUpdate_createsOrUpdatesAWatchlistAndBulkCreatesWatchlistItems() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -98,25 +88,49 @@ func ExampleWatchlistsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "highValueAsset", - armsecurityinsights.Watchlist{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.WatchlistProperties{ - Description: to.Ptr("Watchlist from CSV content"), - ContentType: to.Ptr("text/csv"), - DisplayName: to.Ptr("High Value Assets Watchlist"), - ItemsSearchKey: to.Ptr("header1"), - NumberOfLinesToSkip: to.Ptr[int32](1), - Provider: to.Ptr("Microsoft"), - RawContent: to.Ptr("This line will be skipped\nheader1,header2\nvalue1,value2"), - Source: to.Ptr("watchlist.csv"), - SourceType: to.Ptr(armsecurityinsights.SourceTypeLocalFile), - }, + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", armsecurityinsights.Watchlist{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.WatchlistProperties{ + Description: to.Ptr("Watchlist from CSV content"), + ContentType: to.Ptr("text/csv"), + DisplayName: to.Ptr("High Value Assets Watchlist"), + ItemsSearchKey: to.Ptr("header1"), + NumberOfLinesToSkip: to.Ptr[int32](1), + Provider: to.Ptr("Microsoft"), + RawContent: to.Ptr("This line will be skipped\nheader1,header2\nvalue1,value2"), + Source: to.Ptr("watchlist.csv"), + SourceType: to.Ptr(armsecurityinsights.SourceTypeLocalFile), }, - nil) + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/watchlists/CreateWatchlist.json +func ExampleWatchlistsClient_CreateOrUpdate_createsOrUpdatesAWatchlist() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armsecurityinsights.NewWatchlistsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", armsecurityinsights.Watchlist{ + Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), + Properties: &armsecurityinsights.WatchlistProperties{ + Description: to.Ptr("Watchlist from CSV content"), + DisplayName: to.Ptr("High Value Assets Watchlist"), + ItemsSearchKey: to.Ptr("header1"), + Provider: to.Ptr("Microsoft"), + Source: to.Ptr("watchlist.csv"), + SourceType: to.Ptr(armsecurityinsights.SourceTypeLocalFile), + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertrules_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertrules_client_test.go deleted file mode 100644 index 82d6e34a4474..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_alertrules_client_test.go +++ /dev/null @@ -1,346 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRules/GetAllAlertRules.json -func ExampleAlertRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRules/GetFusionAlertRule.json -func ExampleAlertRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "myFirstFusionRule", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRules/CreateFusionAlertRuleWithFusionScenarioExclusion.json -func ExampleAlertRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "myFirstFusionRule", - &armsecurityinsights.FusionAlertRule{ - Etag: to.Ptr("3d00c3ca-0000-0100-0000-5d42d5010000"), - Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - Properties: &armsecurityinsights.FusionAlertRuleProperties{ - AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - Enabled: to.Ptr(true), - SourceSettings: []*armsecurityinsights.FusionSourceSettings{ - { - Enabled: to.Ptr(true), - SourceName: to.Ptr("Anomalies"), - }, - { - Enabled: to.Ptr(true), - SourceName: to.Ptr("Alert providers"), - SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Azure Active Directory Identity Protection"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Azure Defender"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Azure Defender for IoT"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Microsoft 365 Defender"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Microsoft Cloud App Security"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Microsoft Defender for Endpoint"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Microsoft Defender for Identity"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Microsoft Defender for Office 365"), - }, - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{ - Filters: []*armsecurityinsights.FusionSubTypeSeverityFiltersItem{ - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityMedium), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - }, - { - Enabled: to.Ptr(true), - Severity: to.Ptr(armsecurityinsights.AlertSeverityInformational), - }}, - }, - SourceSubTypeName: to.Ptr("Azure Sentinel scheduled analytics rules"), - }}, - }, - { - Enabled: to.Ptr(true), - SourceName: to.Ptr("Raw logs from other sources"), - SourceSubTypes: []*armsecurityinsights.FusionSourceSubTypeSetting{ - { - Enabled: to.Ptr(true), - SeverityFilters: &armsecurityinsights.FusionSubTypeSeverityFilter{}, - SourceSubTypeName: to.Ptr("Palo Alto Networks"), - }}, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/alertRules/DeleteAlertRule.json -func ExampleAlertRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewAlertRulesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "73e01a99-5cd7-4139-a149-9f2736ff2ab5", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectors_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectors_client_test.go deleted file mode 100644 index a847b5c2a268..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectors_client_test.go +++ /dev/null @@ -1,270 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/GetDataConnectors.json -func ExampleDataConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/GetAPIPolling.json -func ExampleDataConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "316ec55e-7138-4d63-ab18-90c8a60fd1c8", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/CreateAPIPolling.json -func ExampleDataConnectorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "316ec55e-7138-4d63-ab18-90c8a60fd1c8", - &armsecurityinsights.CodelessAPIPollingDataConnector{ - Kind: to.Ptr(armsecurityinsights.DataConnectorKindAPIPolling), - Properties: &armsecurityinsights.APIPollingParameters{ - ConnectorUIConfig: &armsecurityinsights.CodelessUIConnectorConfigProperties{ - Availability: &armsecurityinsights.Availability{ - IsPreview: to.Ptr(true), - Status: to.Ptr[int32](1), - }, - ConnectivityCriteria: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem{ - { - Type: to.Ptr(armsecurityinsights.ConnectivityType("SentinelKindsV2")), - Value: []*string{}, - }}, - DataTypes: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesDataTypesItem{ - { - Name: to.Ptr("{{graphQueriesTableName}}"), - LastDataReceivedQuery: to.Ptr("{{graphQueriesTableName}}\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"), - }}, - DescriptionMarkdown: to.Ptr("The GitHub audit log connector provides the capability to ingest GitHub logs into Azure Sentinel. By connecting GitHub audit logs into Azure Sentinel, you can view this data in workbooks, use it to create custom alerts, and improve your investigation process."), - GraphQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesGraphQueriesItem{ - { - BaseQuery: to.Ptr("{{graphQueriesTableName}}"), - Legend: to.Ptr("GitHub audit log events"), - MetricName: to.Ptr("Total events received"), - }}, - GraphQueriesTableName: to.Ptr("GitHubAuditLogPolling_CL"), - InstructionSteps: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesInstructionStepsItem{ - { - Description: to.Ptr("Enable GitHub audit Logs. \n Follow [this](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to create or find your personal key"), - Instructions: []*armsecurityinsights.InstructionStepsInstructionsItem{ - { - Type: to.Ptr(armsecurityinsights.SettingType("APIKey")), - Parameters: map[string]interface{}{ - "enable": "true", - "userRequestPlaceHoldersInput": []interface{}{ - map[string]interface{}{ - "displayText": "Organization Name", - "placeHolderName": "{{placeHolder1}}", - "placeHolderValue": "", - "requestObjectKey": "apiEndpoint", - }, - }, - }, - }}, - Title: to.Ptr("Connect GitHub Enterprise Audit Log to Azure Sentinel"), - }}, - Permissions: &armsecurityinsights.Permissions{ - Customs: []*armsecurityinsights.PermissionsCustomsItem{ - { - Name: to.Ptr("GitHub API personal token Key"), - Description: to.Ptr("You need access to GitHub personal token, the key should have 'admin:org' scope"), - }}, - ResourceProvider: []*armsecurityinsights.PermissionsResourceProviderItem{ - { - PermissionsDisplayText: to.Ptr("read and write permissions are required."), - Provider: to.Ptr(armsecurityinsights.ProviderNameMicrosoftOperationalInsightsWorkspaces), - ProviderDisplayName: to.Ptr("Workspace"), - RequiredPermissions: &armsecurityinsights.RequiredPermissions{ - Delete: to.Ptr(true), - Read: to.Ptr(true), - Write: to.Ptr(true), - }, - Scope: to.Ptr(armsecurityinsights.PermissionProviderScopeWorkspace), - }}, - }, - Publisher: to.Ptr("GitHub"), - SampleQueries: []*armsecurityinsights.CodelessUIConnectorConfigPropertiesSampleQueriesItem{ - { - Description: to.Ptr("All logs"), - Query: to.Ptr("{{graphQueriesTableName}}\n | take 10 "), - }}, - Title: to.Ptr("GitHub Enterprise Audit Log"), - }, - PollingConfig: &armsecurityinsights.CodelessConnectorPollingConfigProperties{ - Auth: &armsecurityinsights.CodelessConnectorPollingAuthProperties{ - APIKeyIdentifier: to.Ptr("token"), - APIKeyName: to.Ptr("Authorization"), - AuthType: to.Ptr("APIKey"), - }, - Paging: &armsecurityinsights.CodelessConnectorPollingPagingProperties{ - PageSizeParaName: to.Ptr("per_page"), - PagingType: to.Ptr("LinkHeader"), - }, - Response: &armsecurityinsights.CodelessConnectorPollingResponseProperties{ - EventsJSONPaths: []*string{ - to.Ptr("$")}, - }, - Request: &armsecurityinsights.CodelessConnectorPollingRequestProperties{ - APIEndpoint: to.Ptr("https://api.github.com/organizations/{{placeHolder1}}/audit-log"), - Headers: map[string]interface{}{ - "Accept": "application/json", - "User-Agent": "Scuba", - }, - HTTPMethod: to.Ptr("Get"), - QueryParameters: map[string]interface{}{ - "phrase": "created:{_QueryWindowStartTime}..{_QueryWindowEndTime}", - }, - QueryTimeFormat: to.Ptr("yyyy-MM-ddTHH:mm:ssZ"), - QueryWindowInMin: to.Ptr[int32](15), - RateLimitQPS: to.Ptr[int32](50), - RetryCount: to.Ptr[int32](2), - TimeoutInSeconds: to.Ptr[int32](60), - }, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/DeleteAPIPolling.json -func ExampleDataConnectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "316ec55e-7138-4d63-ab18-90c8a60fd1c8", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/ConnectAPIPolling.json -func ExampleDataConnectorsClient_Connect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Connect(ctx, - "myRg", - "myWorkspace", - "316ec55e-7138-4d63-ab18-90c8a60fd1c8", - armsecurityinsights.DataConnectorConnectBody{ - APIKey: to.Ptr("123456789"), - Kind: to.Ptr(armsecurityinsights.ConnectAuthKindAPIKey), - RequestConfigUserInputValues: []interface{}{ - map[string]interface{}{ - "displayText": "Organization Name", - "placeHolderName": "{{placeHolder1}}", - "placeHolderValue": "somePlaceHolderValue", - "requestObjectKey": "apiEndpoint", - }}, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/DisconnectAPIPolling.json -func ExampleDataConnectorsClient_Disconnect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Disconnect(ctx, - "myRg", - "myWorkspace", - "316ec55e-7138-4d63-ab18-90c8a60fd1c8", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectorscheckrequirements_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectorscheckrequirements_client_test.go deleted file mode 100644 index d9bd9bb6b934..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_dataconnectorscheckrequirements_client_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/dataConnectors/CheckRequirementsAzureActiveDirectoryNoAuthorization.json -func ExampleDataConnectorsCheckRequirementsClient_Post() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewDataConnectorsCheckRequirementsClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Post(ctx, - "myRg", - "myWorkspace", - &armsecurityinsights.AADCheckRequirements{ - Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), - Properties: &armsecurityinsights.AADCheckRequirementsProperties{ - TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entities_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entities_client_test.go deleted file mode 100644 index 3cd96e9bcb65..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entities_client_test.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/GetEntities.json -func ExampleEntitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRg", - "myWorkspace", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/GetCloudApplicationEntityById.json -func ExampleEntitiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "e1d3d618-e11f-478b-98e3-bb381539a8e1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/expand/PostExpandEntity.json -func ExampleEntitiesClient_Expand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Expand(ctx, - "myRg", - "myWorkspace", - "e1d3d618-e11f-478b-98e3-bb381539a8e1", - armsecurityinsights.EntityExpandParameters{ - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-26T00:00:00.000Z"); return t }()), - ExpansionID: to.Ptr("a77992f3-25e9-4d01-99a4-5ff606cc410a"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-25T00:00:00.000Z"); return t }()), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/GetQueries.json -func ExampleEntitiesClient_Queries() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Queries(ctx, - "myRg", - "myWorkspace", - "e1d3d618-e11f-478b-98e3-bb381539a8e1", - armsecurityinsights.EntityItemQueryKindInsight, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entities/insights/PostGetInsights.json -func ExampleEntitiesClient_GetInsights() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntitiesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInsights(ctx, - "myRg", - "myWorkspace", - "e1d3d618-e11f-478b-98e3-bb381539a8e1", - armsecurityinsights.EntityGetInsightsParameters{ - AddDefaultExtendedTimeRange: to.Ptr(false), - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00.000Z"); return t }()), - InsightQueryIDs: []*string{ - to.Ptr("cae8d0aa-aa45-4d53-8d88-17dd64ffd4e4")}, - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-01T00:00:00.000Z"); return t }()), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityqueries_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityqueries_client_test.go deleted file mode 100644 index d89d267cf986..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_entityqueries_client_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueries/GetEntityQueries.json -func ExampleEntityQueriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.EntityQueriesClientListOptions{Kind: to.Ptr(armsecurityinsights.Enum13Expansion)}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueries/GetActivityEntityQueryById.json -func ExampleEntityQueriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "07da3cc8-c8ad-4710-a44e-334cdcb7882b", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueries/CreateEntityQueryActivity.json -func ExampleEntityQueriesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myRg", - "myWorkspace", - "07da3cc8-c8ad-4710-a44e-334cdcb7882b", - &armsecurityinsights.ActivityCustomEntityQuery{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Kind: to.Ptr(armsecurityinsights.CustomEntityQueryKindActivity), - Properties: &armsecurityinsights.ActivityEntityQueriesProperties{ - Description: to.Ptr("Account deleted on host"), - Content: to.Ptr("On '{{Computer}}' the account '{{TargetAccount}}' was deleted by '{{AddedBy}}'"), - Enabled: to.Ptr(true), - EntitiesFilter: map[string][]*string{ - "Host_OsFamily": { - to.Ptr("Windows")}, - }, - InputEntityType: to.Ptr(armsecurityinsights.EntityTypeHost), - QueryDefinitions: &armsecurityinsights.ActivityEntityQueriesPropertiesQueryDefinitions{ - Query: to.Ptr("let GetAccountActions = (v_Host_Name:string, v_Host_NTDomain:string, v_Host_DnsDomain:string, v_Host_AzureID:string, v_Host_OMSAgentID:string){\nSecurityEvent\n| where EventID in (4725, 4726, 4767, 4720, 4722, 4723, 4724)\n// parsing for Host to handle variety of conventions coming from data\n| extend Host_HostName = case(\nComputer has '@', tostring(split(Computer, '@')[0]),\nComputer has '\\\\', tostring(split(Computer, '\\\\')[1]),\nComputer has '.', tostring(split(Computer, '.')[0]),\nComputer\n)\n| extend Host_NTDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', tostring(split(Computer, '.')[-2]), \nComputer\n)\n| extend Host_DnsDomain = case(\nComputer has '\\\\', tostring(split(Computer, '\\\\')[0]), \nComputer has '.', strcat_array(array_slice(split(Computer,'.'),-2,-1),'.'), \nComputer\n)\n| where (Host_HostName =~ v_Host_Name and Host_NTDomain =~ v_Host_NTDomain) \nor (Host_HostName =~ v_Host_Name and Host_DnsDomain =~ v_Host_DnsDomain) \nor v_Host_AzureID =~ _ResourceId \nor v_Host_OMSAgentID == SourceComputerId\n| project TimeGenerated, EventID, Activity, Computer, TargetAccount, TargetUserName, TargetDomainName, TargetSid, SubjectUserName, SubjectUserSid, _ResourceId, SourceComputerId\n| extend AddedBy = SubjectUserName\n// Future support for Activities\n| extend timestamp = TimeGenerated, HostCustomEntity = Computer, AccountCustomEntity = TargetAccount\n};\nGetAccountActions('{{Host_HostName}}', '{{Host_NTDomain}}', '{{Host_DnsDomain}}', '{{Host_AzureID}}', '{{Host_OMSAgentID}}')\n \n| where EventID == 4726 "), - }, - RequiredInputFieldsSets: [][]*string{ - { - to.Ptr("Host_HostName"), - to.Ptr("Host_NTDomain")}, - { - to.Ptr("Host_HostName"), - to.Ptr("Host_DnsDomain")}, - { - to.Ptr("Host_AzureID")}, - { - to.Ptr("Host_OMSAgentID")}}, - Title: to.Ptr("An account was deleted on this host"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/entityQueries/DeleteEntityQuery.json -func ExampleEntityQueriesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewEntityQueriesClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "07da3cc8-c8ad-4710-a44e-334cdcb7882b", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_metadata_client_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_metadata_client_test.go deleted file mode 100644 index 83dec5c120cd..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/ze_generated_example_metadata_client_test.go +++ /dev/null @@ -1,228 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/metadata/GetAllMetadataOData.json -func ExampleMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myRg", - "myWorkspace", - &armsecurityinsights.MetadataClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - Skip: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/metadata/GetMetadata.json -func ExampleMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewMetadataClient("2e1dc338-d04d-4443-b721-037eff4fdcac", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg", - "myWorkspace", - "metadataName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/metadata/DeleteMetadata.json -func ExampleMetadataClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "myWorkspace", - "metadataName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/metadata/PutMetadata.json -func ExampleMetadataClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "myRg", - "myWorkspace", - "metadataName", - armsecurityinsights.MetadataModel{ - Properties: &armsecurityinsights.MetadataProperties{ - Author: &armsecurityinsights.MetadataAuthor{ - Name: to.Ptr("User Name"), - Email: to.Ptr("email@microsoft.com"), - }, - Categories: &armsecurityinsights.MetadataCategories{ - Domains: []*string{ - to.Ptr("Application"), - to.Ptr("Security – Insider Threat")}, - Verticals: []*string{ - to.Ptr("Healthcare")}, - }, - ContentID: to.Ptr("c00ee137-7475-47c8-9cce-ec6f0f1bedd0"), - ContentSchemaVersion: to.Ptr("2.0"), - CustomVersion: to.Ptr("1.0"), - Dependencies: &armsecurityinsights.MetadataDependencies{ - Criteria: []*armsecurityinsights.MetadataDependencies{ - { - Criteria: []*armsecurityinsights.MetadataDependencies{ - { - Name: to.Ptr("Microsoft Defender for Endpoint"), - ContentID: to.Ptr("045d06d0-ee72-4794-aba4-cf5646e4c756"), - Kind: to.Ptr(armsecurityinsights.KindDataConnector), - }, - { - ContentID: to.Ptr("dbfcb2cc-d782-40ef-8d94-fe7af58a6f2d"), - Kind: to.Ptr(armsecurityinsights.KindDataConnector), - }, - { - ContentID: to.Ptr("de4dca9b-eb37-47d6-a56f-b8b06b261593"), - Kind: to.Ptr(armsecurityinsights.KindDataConnector), - Version: to.Ptr("2.0"), - }}, - Operator: to.Ptr(armsecurityinsights.OperatorOR), - }, - { - ContentID: to.Ptr("31ee11cc-9989-4de8-b176-5e0ef5c4dbab"), - Kind: to.Ptr(armsecurityinsights.KindPlaybook), - Version: to.Ptr("1.0"), - }, - { - ContentID: to.Ptr("21ba424a-9438-4444-953a-7059539a7a1b"), - Kind: to.Ptr(armsecurityinsights.KindParser), - }}, - Operator: to.Ptr(armsecurityinsights.OperatorAND), - }, - FirstPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-05-18"); return t }()), - Kind: to.Ptr(armsecurityinsights.KindAnalyticsRule), - LastPublishDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2021-05-18"); return t }()), - ParentID: to.Ptr("/subscriptions/2e1dc338-d04d-4443-b721-037eff4fdcac/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/ruleName"), - PreviewImages: []*string{ - to.Ptr("firstImage.png"), - to.Ptr("secondImage.jpeg")}, - PreviewImagesDark: []*string{ - to.Ptr("firstImageDark.png"), - to.Ptr("secondImageDark.jpeg")}, - Providers: []*string{ - to.Ptr("Amazon"), - to.Ptr("Microsoft")}, - Source: &armsecurityinsights.MetadataSource{ - Name: to.Ptr("Contoso Solution 1.0"), - Kind: to.Ptr(armsecurityinsights.SourceKindSolution), - SourceID: to.Ptr("b688a130-76f4-4a07-bf57-762222a3cadf"), - }, - Support: &armsecurityinsights.MetadataSupport{ - Name: to.Ptr("Microsoft"), - Email: to.Ptr("support@microsoft.com"), - Link: to.Ptr("https://support.microsoft.com/"), - Tier: to.Ptr(armsecurityinsights.SupportTierPartner), - }, - ThreatAnalysisTactics: []*string{ - to.Ptr("reconnaissance"), - to.Ptr("commandandcontrol")}, - ThreatAnalysisTechniques: []*string{ - to.Ptr("T1548"), - to.Ptr("T1548.001")}, - Version: to.Ptr("1.0.0.0"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-05-01-preview/examples/metadata/PatchMetadata.json -func ExampleMetadataClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurityinsights.NewMetadataClient("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myRg", - "myWorkspace", - "metadataName", - armsecurityinsights.MetadataPatch{ - Properties: &armsecurityinsights.MetadataPropertiesPatch{ - Author: &armsecurityinsights.MetadataAuthor{ - Name: to.Ptr("User Name"), - Email: to.Ptr("email@microsoft.com"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models_serde.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models_serde.go deleted file mode 100644 index 1ff395cfcc16..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/zz_generated_models_serde.go +++ /dev/null @@ -1,7833 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurityinsights - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AADCheckRequirements. -func (a AADCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindAzureActiveDirectory - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADCheckRequirements. -func (a *AADCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AADDataConnector. -func (a AADDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = DataConnectorKindAzureActiveDirectory - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADDataConnector. -func (a *AADDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AATPCheckRequirements. -func (a AATPCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindAzureAdvancedThreatProtection - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AATPCheckRequirements. -func (a *AATPCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AATPDataConnector. -func (a AATPDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = DataConnectorKindAzureAdvancedThreatProtection - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AATPDataConnector. -func (a *AATPDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ASCCheckRequirements. -func (a ASCCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindAzureSecurityCenter - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ASCCheckRequirements. -func (a *ASCCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ASCDataConnector. -func (a ASCDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = DataConnectorKindAzureSecurityCenter - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ASCDataConnector. -func (a *ASCDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AccountEntity. -func (a AccountEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - objectMap["kind"] = EntityKindAccount - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccountEntity. -func (a *AccountEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AccountEntityProperties. -func (a AccountEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aadTenantId", a.AADTenantID) - populate(objectMap, "aadUserId", a.AADUserID) - populate(objectMap, "accountName", a.AccountName) - populate(objectMap, "additionalData", a.AdditionalData) - populate(objectMap, "dnsDomain", a.DNSDomain) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "hostEntityId", a.HostEntityID) - populate(objectMap, "isDomainJoined", a.IsDomainJoined) - populate(objectMap, "ntDomain", a.NtDomain) - populate(objectMap, "objectGuid", a.ObjectGUID) - populate(objectMap, "puid", a.Puid) - populate(objectMap, "sid", a.Sid) - populate(objectMap, "upnSuffix", a.UpnSuffix) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityCustomEntityQuery. -func (a ActivityCustomEntityQuery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = CustomEntityQueryKindActivity - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityCustomEntityQuery. -func (a *ActivityCustomEntityQuery) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueriesProperties. -func (a ActivityEntityQueriesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "content", a.Content) - populateTimeRFC3339(objectMap, "createdTimeUtc", a.CreatedTimeUTC) - populate(objectMap, "description", a.Description) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "entitiesFilter", a.EntitiesFilter) - populate(objectMap, "inputEntityType", a.InputEntityType) - populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", a.LastModifiedTimeUTC) - populate(objectMap, "queryDefinitions", a.QueryDefinitions) - populate(objectMap, "requiredInputFieldsSets", a.RequiredInputFieldsSets) - populate(objectMap, "templateName", a.TemplateName) - populate(objectMap, "title", a.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueriesProperties. -func (a *ActivityEntityQueriesProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "content": - err = unpopulate(val, "Content", &a.Content) - delete(rawMsg, key) - case "createdTimeUtc": - err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &a.CreatedTimeUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - case "entitiesFilter": - err = unpopulate(val, "EntitiesFilter", &a.EntitiesFilter) - delete(rawMsg, key) - case "inputEntityType": - err = unpopulate(val, "InputEntityType", &a.InputEntityType) - delete(rawMsg, key) - case "lastModifiedTimeUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &a.LastModifiedTimeUTC) - delete(rawMsg, key) - case "queryDefinitions": - err = unpopulate(val, "QueryDefinitions", &a.QueryDefinitions) - delete(rawMsg, key) - case "requiredInputFieldsSets": - err = unpopulate(val, "RequiredInputFieldsSets", &a.RequiredInputFieldsSets) - delete(rawMsg, key) - case "templateName": - err = unpopulate(val, "TemplateName", &a.TemplateName) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &a.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQuery. -func (a ActivityEntityQuery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = EntityQueryKindActivity - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQuery. -func (a *ActivityEntityQuery) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueryTemplate. -func (a ActivityEntityQueryTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - objectMap["kind"] = EntityQueryTemplateKindActivity - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityEntityQueryTemplate. -func (a *ActivityEntityQueryTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityEntityQueryTemplateProperties. -func (a ActivityEntityQueryTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "content", a.Content) - populate(objectMap, "dataTypes", a.DataTypes) - populate(objectMap, "description", a.Description) - populate(objectMap, "entitiesFilter", a.EntitiesFilter) - populate(objectMap, "inputEntityType", a.InputEntityType) - populate(objectMap, "queryDefinitions", a.QueryDefinitions) - populate(objectMap, "requiredInputFieldsSets", a.RequiredInputFieldsSets) - populate(objectMap, "title", a.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityTimelineItem. -func (a *ActivityTimelineItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "bucketEndTimeUTC": - err = unpopulateTimeRFC3339(val, "BucketEndTimeUTC", &a.BucketEndTimeUTC) - delete(rawMsg, key) - case "bucketStartTimeUTC": - err = unpopulateTimeRFC3339(val, "BucketStartTimeUTC", &a.BucketStartTimeUTC) - delete(rawMsg, key) - case "content": - err = unpopulate(val, "Content", &a.Content) - delete(rawMsg, key) - case "firstActivityTimeUTC": - err = unpopulateTimeRFC3339(val, "FirstActivityTimeUTC", &a.FirstActivityTimeUTC) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "lastActivityTimeUTC": - err = unpopulateTimeRFC3339(val, "LastActivityTimeUTC", &a.LastActivityTimeUTC) - delete(rawMsg, key) - case "queryId": - err = unpopulate(val, "QueryID", &a.QueryID) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &a.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplateDataSource. -func (a AlertRuleTemplateDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectorId", a.ConnectorID) - populate(objectMap, "dataTypes", a.DataTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplatePropertiesBase. -func (a AlertRuleTemplatePropertiesBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", a.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", a.CreatedDateUTC) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", a.LastUpdatedDateUTC) - populate(objectMap, "requiredDataConnectors", a.RequiredDataConnectors) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplatePropertiesBase. -func (a *AlertRuleTemplatePropertiesBase) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &a.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &a.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &a.LastUpdatedDateUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &a.RequiredDataConnectors) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleTemplateWithMitreProperties. -func (a AlertRuleTemplateWithMitreProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", a.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", a.CreatedDateUTC) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", a.LastUpdatedDateUTC) - populate(objectMap, "requiredDataConnectors", a.RequiredDataConnectors) - populate(objectMap, "status", a.Status) - populate(objectMap, "tactics", a.Tactics) - populate(objectMap, "techniques", a.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplateWithMitreProperties. -func (a *AlertRuleTemplateWithMitreProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &a.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &a.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &a.LastUpdatedDateUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &a.RequiredDataConnectors) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &a.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &a.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleTemplatesList. -func (a *AlertRuleTemplatesList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - a.Value, err = unmarshalAlertRuleTemplateClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulesList. -func (a *AlertRulesList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - a.Value, err = unmarshalAlertRuleClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Anomalies. -func (a Anomalies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = SettingKindAnomalies - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Anomalies. -func (a *Anomalies) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettings. -func (a AnomalySecurityMLAnalyticsSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = SecurityMLAnalyticsSettingsKindAnomaly - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettings. -func (a *AnomalySecurityMLAnalyticsSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. -func (a AnomalySecurityMLAnalyticsSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "anomalySettingsVersion", a.AnomalySettingsVersion) - populate(objectMap, "anomalyVersion", a.AnomalyVersion) - populate(objectMap, "customizableObservations", &a.CustomizableObservations) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "frequency", a.Frequency) - populate(objectMap, "isDefaultSettings", a.IsDefaultSettings) - populateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) - populate(objectMap, "requiredDataConnectors", a.RequiredDataConnectors) - populate(objectMap, "settingsDefinitionId", a.SettingsDefinitionID) - populate(objectMap, "settingsStatus", a.SettingsStatus) - populate(objectMap, "tactics", a.Tactics) - populate(objectMap, "techniques", a.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. -func (a *AnomalySecurityMLAnalyticsSettingsProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "anomalySettingsVersion": - err = unpopulate(val, "AnomalySettingsVersion", &a.AnomalySettingsVersion) - delete(rawMsg, key) - case "anomalyVersion": - err = unpopulate(val, "AnomalyVersion", &a.AnomalyVersion) - delete(rawMsg, key) - case "customizableObservations": - err = unpopulate(val, "CustomizableObservations", &a.CustomizableObservations) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - case "frequency": - err = unpopulate(val, "Frequency", &a.Frequency) - delete(rawMsg, key) - case "isDefaultSettings": - err = unpopulate(val, "IsDefaultSettings", &a.IsDefaultSettings) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &a.RequiredDataConnectors) - delete(rawMsg, key) - case "settingsDefinitionId": - err = unpopulate(val, "SettingsDefinitionID", &a.SettingsDefinitionID) - delete(rawMsg, key) - case "settingsStatus": - err = unpopulate(val, "SettingsStatus", &a.SettingsStatus) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &a.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &a.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalyTimelineItem. -func (a *AnomalyTimelineItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureResourceId": - err = unpopulate(val, "AzureResourceID", &a.AzureResourceID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) - delete(rawMsg, key) - case "intent": - err = unpopulate(val, "Intent", &a.Intent) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &a.ProductName) - delete(rawMsg, key) - case "reasons": - err = unpopulate(val, "Reasons", &a.Reasons) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &a.Techniques) - delete(rawMsg, key) - case "timeGenerated": - err = unpopulateTimeRFC3339(val, "TimeGenerated", &a.TimeGenerated) - delete(rawMsg, key) - case "vendor": - err = unpopulate(val, "Vendor", &a.Vendor) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRuleModifyPropertiesAction. -func (a AutomationRuleModifyPropertiesAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionConfiguration", a.ActionConfiguration) - objectMap["actionType"] = ActionTypeModifyProperties - populate(objectMap, "order", a.Order) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleModifyPropertiesAction. -func (a *AutomationRuleModifyPropertiesAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionConfiguration": - err = unpopulate(val, "ActionConfiguration", &a.ActionConfiguration) - delete(rawMsg, key) - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &a.Order) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRuleProperties. -func (a AutomationRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "createdBy", a.CreatedBy) - populateTimeRFC3339(objectMap, "createdTimeUtc", a.CreatedTimeUTC) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "lastModifiedBy", a.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", a.LastModifiedTimeUTC) - populate(objectMap, "order", a.Order) - populate(objectMap, "triggeringLogic", a.TriggeringLogic) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleProperties. -func (a *AutomationRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - a.Actions, err = unmarshalAutomationRuleActionClassificationArray(val) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &a.CreatedBy) - delete(rawMsg, key) - case "createdTimeUtc": - err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &a.CreatedTimeUTC) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &a.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedTimeUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &a.LastModifiedTimeUTC) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &a.Order) - delete(rawMsg, key) - case "triggeringLogic": - err = unpopulate(val, "TriggeringLogic", &a.TriggeringLogic) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesChangedCondition. -func (a AutomationRulePropertyValuesChangedCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "changeType", a.ChangeType) - populate(objectMap, "operator", a.Operator) - populate(objectMap, "propertyName", a.PropertyName) - populate(objectMap, "propertyValues", a.PropertyValues) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesCondition. -func (a AutomationRulePropertyValuesCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "operator", a.Operator) - populate(objectMap, "propertyName", a.PropertyName) - populate(objectMap, "propertyValues", a.PropertyValues) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRuleRunPlaybookAction. -func (a AutomationRuleRunPlaybookAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionConfiguration", a.ActionConfiguration) - objectMap["actionType"] = ActionTypeRunPlaybook - populate(objectMap, "order", a.Order) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleRunPlaybookAction. -func (a *AutomationRuleRunPlaybookAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionConfiguration": - err = unpopulate(val, "ActionConfiguration", &a.ActionConfiguration) - delete(rawMsg, key) - case "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "order": - err = unpopulate(val, "Order", &a.Order) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationRuleTriggeringLogic. -func (a AutomationRuleTriggeringLogic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "conditions", a.Conditions) - populateTimeRFC3339(objectMap, "expirationTimeUtc", a.ExpirationTimeUTC) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "triggersOn", a.TriggersOn) - populate(objectMap, "triggersWhen", a.TriggersWhen) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleTriggeringLogic. -func (a *AutomationRuleTriggeringLogic) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditions": - a.Conditions, err = unmarshalAutomationRuleConditionClassificationArray(val) - delete(rawMsg, key) - case "expirationTimeUtc": - err = unpopulateTimeRFC3339(val, "ExpirationTimeUTC", &a.ExpirationTimeUTC) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "triggersOn": - err = unpopulate(val, "TriggersOn", &a.TriggersOn) - delete(rawMsg, key) - case "triggersWhen": - err = unpopulate(val, "TriggersWhen", &a.TriggersWhen) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailCheckRequirements. -func (a AwsCloudTrailCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindAmazonWebServicesCloudTrail - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailCheckRequirements. -func (a *AwsCloudTrailCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsCloudTrailDataConnector. -func (a AwsCloudTrailDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = DataConnectorKindAmazonWebServicesCloudTrail - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudTrailDataConnector. -func (a *AwsCloudTrailDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsS3CheckRequirements. -func (a AwsS3CheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindAmazonWebServicesS3 - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3CheckRequirements. -func (a *AwsS3CheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnector. -func (a AwsS3DataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - objectMap["kind"] = DataConnectorKindAmazonWebServicesS3 - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsS3DataConnector. -func (a *AwsS3DataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AwsS3DataConnectorProperties. -func (a AwsS3DataConnectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataTypes", a.DataTypes) - populate(objectMap, "destinationTable", a.DestinationTable) - populate(objectMap, "roleArn", a.RoleArn) - populate(objectMap, "sqsUrls", a.SqsUrls) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceEntity. -func (a AzureResourceEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - objectMap["kind"] = EntityKindAzureResource - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceEntity. -func (a *AzureResourceEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceEntityProperties. -func (a AzureResourceEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", a.AdditionalData) - populate(objectMap, "friendlyName", a.FriendlyName) - populate(objectMap, "resourceId", a.ResourceID) - populate(objectMap, "subscriptionId", a.SubscriptionID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BookmarkEntityMappings. -func (b BookmarkEntityMappings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "entityType", b.EntityType) - populate(objectMap, "fieldMappings", b.FieldMappings) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BookmarkExpandParameters. -func (b BookmarkExpandParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", b.EndTime) - populate(objectMap, "expansionId", b.ExpansionID) - populateTimeRFC3339(objectMap, "startTime", b.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkExpandParameters. -func (b *BookmarkExpandParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &b.EndTime) - delete(rawMsg, key) - case "expansionId": - err = unpopulate(val, "ExpansionID", &b.ExpansionID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &b.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkExpandResponseValue. -func (b *BookmarkExpandResponseValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "edges": - err = unpopulate(val, "Edges", &b.Edges) - delete(rawMsg, key) - case "entities": - b.Entities, err = unmarshalEntityClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BookmarkProperties. -func (b BookmarkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "created", b.Created) - populate(objectMap, "createdBy", b.CreatedBy) - populate(objectMap, "displayName", b.DisplayName) - populate(objectMap, "entityMappings", b.EntityMappings) - populateTimeRFC3339(objectMap, "eventTime", b.EventTime) - populate(objectMap, "incidentInfo", b.IncidentInfo) - populate(objectMap, "labels", b.Labels) - populate(objectMap, "notes", b.Notes) - populate(objectMap, "query", b.Query) - populateTimeRFC3339(objectMap, "queryEndTime", b.QueryEndTime) - populate(objectMap, "queryResult", b.QueryResult) - populateTimeRFC3339(objectMap, "queryStartTime", b.QueryStartTime) - populate(objectMap, "tactics", b.Tactics) - populate(objectMap, "techniques", b.Techniques) - populateTimeRFC3339(objectMap, "updated", b.Updated) - populate(objectMap, "updatedBy", b.UpdatedBy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkProperties. -func (b *BookmarkProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "created": - err = unpopulateTimeRFC3339(val, "Created", &b.Created) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &b.CreatedBy) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &b.DisplayName) - delete(rawMsg, key) - case "entityMappings": - err = unpopulate(val, "EntityMappings", &b.EntityMappings) - delete(rawMsg, key) - case "eventTime": - err = unpopulateTimeRFC3339(val, "EventTime", &b.EventTime) - delete(rawMsg, key) - case "incidentInfo": - err = unpopulate(val, "IncidentInfo", &b.IncidentInfo) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &b.Labels) - delete(rawMsg, key) - case "notes": - err = unpopulate(val, "Notes", &b.Notes) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &b.Query) - delete(rawMsg, key) - case "queryEndTime": - err = unpopulateTimeRFC3339(val, "QueryEndTime", &b.QueryEndTime) - delete(rawMsg, key) - case "queryResult": - err = unpopulate(val, "QueryResult", &b.QueryResult) - delete(rawMsg, key) - case "queryStartTime": - err = unpopulateTimeRFC3339(val, "QueryStartTime", &b.QueryStartTime) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &b.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &b.Techniques) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &b.Updated) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &b.UpdatedBy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BookmarkTimelineItem. -func (b *BookmarkTimelineItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureResourceId": - err = unpopulate(val, "AzureResourceID", &b.AzureResourceID) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &b.CreatedBy) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &b.DisplayName) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &b.EndTimeUTC) - delete(rawMsg, key) - case "eventTime": - err = unpopulateTimeRFC3339(val, "EventTime", &b.EventTime) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &b.Kind) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &b.Labels) - delete(rawMsg, key) - case "notes": - err = unpopulate(val, "Notes", &b.Notes) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &b.StartTimeUTC) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudApplicationEntity. -func (c CloudApplicationEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - objectMap["kind"] = EntityKindCloudApplication - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudApplicationEntity. -func (c *CloudApplicationEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudApplicationEntityProperties. -func (c CloudApplicationEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", c.AdditionalData) - populate(objectMap, "appId", c.AppID) - populate(objectMap, "appName", c.AppName) - populate(objectMap, "friendlyName", c.FriendlyName) - populate(objectMap, "instanceName", c.InstanceName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessAPIPollingDataConnector. -func (c CodelessAPIPollingDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - objectMap["kind"] = DataConnectorKindAPIPolling - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessAPIPollingDataConnector. -func (c *CodelessAPIPollingDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &c.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessConnectorPollingResponseProperties. -func (c CodelessConnectorPollingResponseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eventsJsonPaths", c.EventsJSONPaths) - populate(objectMap, "isGzipCompressed", c.IsGzipCompressed) - populate(objectMap, "successStatusJsonPath", c.SuccessStatusJSONPath) - populate(objectMap, "successStatusValue", c.SuccessStatusValue) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigProperties. -func (c CodelessUIConnectorConfigProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "availability", c.Availability) - populate(objectMap, "connectivityCriteria", c.ConnectivityCriteria) - populate(objectMap, "customImage", c.CustomImage) - populate(objectMap, "dataTypes", c.DataTypes) - populate(objectMap, "descriptionMarkdown", c.DescriptionMarkdown) - populate(objectMap, "graphQueries", c.GraphQueries) - populate(objectMap, "graphQueriesTableName", c.GraphQueriesTableName) - populate(objectMap, "instructionSteps", c.InstructionSteps) - populate(objectMap, "permissions", c.Permissions) - populate(objectMap, "publisher", c.Publisher) - populate(objectMap, "sampleQueries", c.SampleQueries) - populate(objectMap, "title", c.Title) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem. -func (c CodelessUIConnectorConfigPropertiesConnectivityCriteriaItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", c.Type) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessUIConnectorConfigPropertiesInstructionStepsItem. -func (c CodelessUIConnectorConfigPropertiesInstructionStepsItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", c.Description) - populate(objectMap, "instructions", c.Instructions) - populate(objectMap, "title", c.Title) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CodelessUIDataConnector. -func (c CodelessUIDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - objectMap["kind"] = DataConnectorKindGenericUI - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CodelessUIDataConnector. -func (c *CodelessUIDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &c.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectivityCriteria. -func (c ConnectivityCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", c.Type) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DNSEntity. -func (d DNSEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - objectMap["kind"] = EntityKindDNSResolution - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSEntity. -func (d *DNSEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DNSEntityProperties. -func (d DNSEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", d.AdditionalData) - populate(objectMap, "dnsServerIpEntityId", d.DNSServerIPEntityID) - populate(objectMap, "domainName", d.DomainName) - populate(objectMap, "friendlyName", d.FriendlyName) - populate(objectMap, "hostIpAddressEntityId", d.HostIPAddressEntityID) - populate(objectMap, "ipAddressEntityIds", d.IPAddressEntityIDs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataConnectorConnectBody. -func (d DataConnectorConnectBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "apiKey", d.APIKey) - populate(objectMap, "authorizationCode", d.AuthorizationCode) - populate(objectMap, "clientId", d.ClientID) - populate(objectMap, "clientSecret", d.ClientSecret) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "password", d.Password) - populate(objectMap, "requestConfigUserInputValues", d.RequestConfigUserInputValues) - populate(objectMap, "userName", d.UserName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorList. -func (d *DataConnectorList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - d.Value, err = unmarshalDataConnectorClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Deployment. -func (d Deployment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deploymentId", d.DeploymentID) - populate(objectMap, "deploymentLogsUrl", d.DeploymentLogsURL) - populate(objectMap, "deploymentResult", d.DeploymentResult) - populate(objectMap, "deploymentState", d.DeploymentState) - populateTimeRFC3339(objectMap, "deploymentTime", d.DeploymentTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Deployment. -func (d *Deployment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deploymentId": - err = unpopulate(val, "DeploymentID", &d.DeploymentID) - delete(rawMsg, key) - case "deploymentLogsUrl": - err = unpopulate(val, "DeploymentLogsURL", &d.DeploymentLogsURL) - delete(rawMsg, key) - case "deploymentResult": - err = unpopulate(val, "DeploymentResult", &d.DeploymentResult) - delete(rawMsg, key) - case "deploymentState": - err = unpopulate(val, "DeploymentState", &d.DeploymentState) - delete(rawMsg, key) - case "deploymentTime": - err = unpopulateTimeRFC3339(val, "DeploymentTime", &d.DeploymentTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Dynamics365CheckRequirements. -func (d Dynamics365CheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindDynamics365 - populate(objectMap, "properties", d.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365CheckRequirements. -func (d *Dynamics365CheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Dynamics365DataConnector. -func (d Dynamics365DataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - objectMap["kind"] = DataConnectorKindDynamics365 - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Dynamics365DataConnector. -func (d *Dynamics365DataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnrichmentDomainWhois. -func (e *EnrichmentDomainWhois) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "created": - err = unpopulateTimeRFC3339(val, "Created", &e.Created) - delete(rawMsg, key) - case "domain": - err = unpopulate(val, "Domain", &e.Domain) - delete(rawMsg, key) - case "expires": - err = unpopulateTimeRFC3339(val, "Expires", &e.Expires) - delete(rawMsg, key) - case "parsedWhois": - err = unpopulate(val, "ParsedWhois", &e.ParsedWhois) - delete(rawMsg, key) - case "server": - err = unpopulate(val, "Server", &e.Server) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &e.Updated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EntityAnalytics. -func (e EntityAnalytics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", e.Etag) - populate(objectMap, "id", e.ID) - objectMap["kind"] = SettingKindEntityAnalytics - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityAnalytics. -func (e *EntityAnalytics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &e.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EntityAnalyticsProperties. -func (e EntityAnalyticsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "entityProviders", e.EntityProviders) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EntityCommonProperties. -func (e EntityCommonProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", e.AdditionalData) - populate(objectMap, "friendlyName", e.FriendlyName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type EntityExpandParameters. -func (e EntityExpandParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", e.EndTime) - populate(objectMap, "expansionId", e.ExpansionID) - populateTimeRFC3339(objectMap, "startTime", e.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityExpandParameters. -func (e *EntityExpandParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) - delete(rawMsg, key) - case "expansionId": - err = unpopulate(val, "ExpansionID", &e.ExpansionID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityExpandResponseValue. -func (e *EntityExpandResponseValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "edges": - err = unpopulate(val, "Edges", &e.Edges) - delete(rawMsg, key) - case "entities": - e.Entities, err = unmarshalEntityClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EntityGetInsightsParameters. -func (e EntityGetInsightsParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "addDefaultExtendedTimeRange", e.AddDefaultExtendedTimeRange) - populateTimeRFC3339(objectMap, "endTime", e.EndTime) - populate(objectMap, "insightQueryIds", e.InsightQueryIDs) - populateTimeRFC3339(objectMap, "startTime", e.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityGetInsightsParameters. -func (e *EntityGetInsightsParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "addDefaultExtendedTimeRange": - err = unpopulate(val, "AddDefaultExtendedTimeRange", &e.AddDefaultExtendedTimeRange) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) - delete(rawMsg, key) - case "insightQueryIds": - err = unpopulate(val, "InsightQueryIDs", &e.InsightQueryIDs) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityInsightItemQueryTimeInterval. -func (e *EntityInsightItemQueryTimeInterval) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityList. -func (e *EntityList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - e.Value, err = unmarshalEntityClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EntityMapping. -func (e EntityMapping) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "entityType", e.EntityType) - populate(objectMap, "fieldMappings", e.FieldMappings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryList. -func (e *EntityQueryList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - e.Value, err = unmarshalEntityQueryClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityQueryTemplateList. -func (e *EntityQueryTemplateList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - e.Value, err = unmarshalEntityQueryTemplateClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EntityTimelineParameters. -func (e EntityTimelineParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "endTime", e.EndTime) - populate(objectMap, "kinds", e.Kinds) - populate(objectMap, "numberOfBucket", e.NumberOfBucket) - populateTimeRFC3339(objectMap, "startTime", e.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTimelineParameters. -func (e *EntityTimelineParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &e.EndTime) - delete(rawMsg, key) - case "kinds": - err = unpopulate(val, "Kinds", &e.Kinds) - delete(rawMsg, key) - case "numberOfBucket": - err = unpopulate(val, "NumberOfBucket", &e.NumberOfBucket) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &e.StartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EntityTimelineResponse. -func (e *EntityTimelineResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "metaData": - err = unpopulate(val, "MetaData", &e.MetaData) - delete(rawMsg, key) - case "value": - e.Value, err = unmarshalEntityTimelineItemClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExpansionEntityQueriesProperties. -func (e ExpansionEntityQueriesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataSources", e.DataSources) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "inputEntityType", e.InputEntityType) - populate(objectMap, "inputFields", e.InputFields) - populate(objectMap, "outputEntityTypes", e.OutputEntityTypes) - populate(objectMap, "queryTemplate", e.QueryTemplate) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExpansionEntityQuery. -func (e ExpansionEntityQuery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", e.Etag) - populate(objectMap, "id", e.ID) - objectMap["kind"] = EntityQueryKindExpansion - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpansionEntityQuery. -func (e *ExpansionEntityQuery) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &e.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EyesOn. -func (e EyesOn) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", e.Etag) - populate(objectMap, "id", e.ID) - objectMap["kind"] = SettingKindEyesOn - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EyesOn. -func (e *EyesOn) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &e.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &e.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileEntity. -func (f FileEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - objectMap["kind"] = EntityKindFile - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileEntity. -func (f *FileEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &f.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileEntityProperties. -func (f FileEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", f.AdditionalData) - populate(objectMap, "directory", f.Directory) - populate(objectMap, "fileHashEntityIds", f.FileHashEntityIDs) - populate(objectMap, "fileName", f.FileName) - populate(objectMap, "friendlyName", f.FriendlyName) - populate(objectMap, "hostEntityId", f.HostEntityID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FileHashEntity. -func (f FileHashEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - objectMap["kind"] = EntityKindFileHash - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileHashEntity. -func (f *FileHashEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &f.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileHashEntityProperties. -func (f FileHashEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", f.AdditionalData) - populate(objectMap, "algorithm", f.Algorithm) - populate(objectMap, "friendlyName", f.FriendlyName) - populate(objectMap, "hashValue", f.HashValue) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FusionAlertRule. -func (f FusionAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", f.Etag) - populate(objectMap, "id", f.ID) - objectMap["kind"] = AlertRuleKindFusion - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRule. -func (f *FusionAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &f.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &f.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleProperties. -func (f FusionAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRuleTemplateName", f.AlertRuleTemplateName) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populate(objectMap, "enabled", f.Enabled) - populateTimeRFC3339(objectMap, "lastModifiedUtc", f.LastModifiedUTC) - populate(objectMap, "scenarioExclusionPatterns", f.ScenarioExclusionPatterns) - populate(objectMap, "severity", f.Severity) - populate(objectMap, "sourceSettings", f.SourceSettings) - populate(objectMap, "tactics", f.Tactics) - populate(objectMap, "techniques", f.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleProperties. -func (f *FusionAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &f.AlertRuleTemplateName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &f.Enabled) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &f.LastModifiedUTC) - delete(rawMsg, key) - case "scenarioExclusionPatterns": - err = unpopulate(val, "ScenarioExclusionPatterns", &f.ScenarioExclusionPatterns) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &f.Severity) - delete(rawMsg, key) - case "sourceSettings": - err = unpopulate(val, "SourceSettings", &f.SourceSettings) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &f.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &f.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleTemplate. -func (f FusionAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - objectMap["kind"] = AlertRuleKindFusion - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleTemplate. -func (f *FusionAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &f.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FusionAlertRuleTemplateProperties. -func (f FusionAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", f.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", f.CreatedDateUTC) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", f.LastUpdatedDateUTC) - populate(objectMap, "requiredDataConnectors", f.RequiredDataConnectors) - populate(objectMap, "severity", f.Severity) - populate(objectMap, "sourceSettings", f.SourceSettings) - populate(objectMap, "status", f.Status) - populate(objectMap, "tactics", f.Tactics) - populate(objectMap, "techniques", f.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FusionAlertRuleTemplateProperties. -func (f *FusionAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &f.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &f.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &f.LastUpdatedDateUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &f.RequiredDataConnectors) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &f.Severity) - delete(rawMsg, key) - case "sourceSettings": - err = unpopulate(val, "SourceSettings", &f.SourceSettings) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &f.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &f.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &f.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FusionSourceSettings. -func (f FusionSourceSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "enabled", f.Enabled) - populate(objectMap, "sourceName", f.SourceName) - populate(objectMap, "sourceSubTypes", f.SourceSubTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FusionSubTypeSeverityFilter. -func (f FusionSubTypeSeverityFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filters", f.Filters) - populate(objectMap, "isSupported", f.IsSupported) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FusionTemplateSourceSetting. -func (f FusionTemplateSourceSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "sourceName", f.SourceName) - populate(objectMap, "sourceSubTypes", f.SourceSubTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type FusionTemplateSubTypeSeverityFilter. -func (f FusionTemplateSubTypeSeverityFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isSupported", f.IsSupported) - populate(objectMap, "severityFilters", f.SeverityFilters) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GetQueriesResponse. -func (g *GetQueriesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - g.Value, err = unmarshalEntityQueryItemClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GroupingConfiguration. -func (g GroupingConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "enabled", g.Enabled) - populate(objectMap, "groupByAlertDetails", g.GroupByAlertDetails) - populate(objectMap, "groupByCustomDetails", g.GroupByCustomDetails) - populate(objectMap, "groupByEntities", g.GroupByEntities) - populate(objectMap, "lookbackDuration", g.LookbackDuration) - populate(objectMap, "matchingMethod", g.MatchingMethod) - populate(objectMap, "reopenClosedIncident", g.ReopenClosedIncident) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type HostEntity. -func (h HostEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", h.ID) - objectMap["kind"] = EntityKindHost - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "systemData", h.SystemData) - populate(objectMap, "type", h.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HostEntity. -func (h *HostEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &h.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &h.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HostEntityProperties. -func (h HostEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", h.AdditionalData) - populate(objectMap, "azureID", h.AzureID) - populate(objectMap, "dnsDomain", h.DNSDomain) - populate(objectMap, "friendlyName", h.FriendlyName) - populate(objectMap, "hostName", h.HostName) - populate(objectMap, "isDomainJoined", h.IsDomainJoined) - populate(objectMap, "netBiosName", h.NetBiosName) - populate(objectMap, "ntDomain", h.NtDomain) - populate(objectMap, "osFamily", h.OSFamily) - populate(objectMap, "osVersion", h.OSVersion) - populate(objectMap, "omsAgentID", h.OmsAgentID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type HuntingBookmark. -func (h HuntingBookmark) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", h.ID) - objectMap["kind"] = EntityKindBookmark - populate(objectMap, "name", h.Name) - populate(objectMap, "properties", h.Properties) - populate(objectMap, "systemData", h.SystemData) - populate(objectMap, "type", h.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HuntingBookmark. -func (h *HuntingBookmark) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &h.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &h.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &h.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &h.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &h.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HuntingBookmarkProperties. -func (h HuntingBookmarkProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", h.AdditionalData) - populateTimeRFC3339(objectMap, "created", h.Created) - populate(objectMap, "createdBy", h.CreatedBy) - populate(objectMap, "displayName", h.DisplayName) - populateTimeRFC3339(objectMap, "eventTime", h.EventTime) - populate(objectMap, "friendlyName", h.FriendlyName) - populate(objectMap, "incidentInfo", h.IncidentInfo) - populate(objectMap, "labels", h.Labels) - populate(objectMap, "notes", h.Notes) - populate(objectMap, "query", h.Query) - populate(objectMap, "queryResult", h.QueryResult) - populateTimeRFC3339(objectMap, "updated", h.Updated) - populate(objectMap, "updatedBy", h.UpdatedBy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HuntingBookmarkProperties. -func (h *HuntingBookmarkProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &h.AdditionalData) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, "Created", &h.Created) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &h.CreatedBy) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "eventTime": - err = unpopulateTimeRFC3339(val, "EventTime", &h.EventTime) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &h.FriendlyName) - delete(rawMsg, key) - case "incidentInfo": - err = unpopulate(val, "IncidentInfo", &h.IncidentInfo) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &h.Labels) - delete(rawMsg, key) - case "notes": - err = unpopulate(val, "Notes", &h.Notes) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &h.Query) - delete(rawMsg, key) - case "queryResult": - err = unpopulate(val, "QueryResult", &h.QueryResult) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &h.Updated) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &h.UpdatedBy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IPEntity. -func (i IPEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - objectMap["kind"] = EntityKindIP - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IPEntity. -func (i *IPEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IPEntityProperties. -func (i IPEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", i.AdditionalData) - populate(objectMap, "address", i.Address) - populate(objectMap, "friendlyName", i.FriendlyName) - populate(objectMap, "location", i.Location) - populate(objectMap, "threatIntelligence", i.ThreatIntelligence) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentAdditionalData. -func (i IncidentAdditionalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertProductNames", i.AlertProductNames) - populate(objectMap, "alertsCount", i.AlertsCount) - populate(objectMap, "bookmarksCount", i.BookmarksCount) - populate(objectMap, "commentsCount", i.CommentsCount) - populate(objectMap, "providerIncidentUrl", i.ProviderIncidentURL) - populate(objectMap, "tactics", i.Tactics) - populate(objectMap, "techniques", i.Techniques) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentCommentProperties. -func (i IncidentCommentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "author", i.Author) - populateTimeRFC3339(objectMap, "createdTimeUtc", i.CreatedTimeUTC) - populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", i.LastModifiedTimeUTC) - populate(objectMap, "message", i.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentCommentProperties. -func (i *IncidentCommentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "author": - err = unpopulate(val, "Author", &i.Author) - delete(rawMsg, key) - case "createdTimeUtc": - err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &i.CreatedTimeUTC) - delete(rawMsg, key) - case "lastModifiedTimeUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &i.LastModifiedTimeUTC) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &i.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentEntitiesResponse. -func (i *IncidentEntitiesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "entities": - i.Entities, err = unmarshalEntityClassificationArray(val) - delete(rawMsg, key) - case "metaData": - err = unpopulate(val, "MetaData", &i.MetaData) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentProperties. -func (i IncidentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", i.AdditionalData) - populate(objectMap, "classification", i.Classification) - populate(objectMap, "classificationComment", i.ClassificationComment) - populate(objectMap, "classificationReason", i.ClassificationReason) - populateTimeRFC3339(objectMap, "createdTimeUtc", i.CreatedTimeUTC) - populate(objectMap, "description", i.Description) - populateTimeRFC3339(objectMap, "firstActivityTimeUtc", i.FirstActivityTimeUTC) - populate(objectMap, "incidentNumber", i.IncidentNumber) - populate(objectMap, "incidentUrl", i.IncidentURL) - populate(objectMap, "labels", i.Labels) - populateTimeRFC3339(objectMap, "lastActivityTimeUtc", i.LastActivityTimeUTC) - populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", i.LastModifiedTimeUTC) - populate(objectMap, "owner", i.Owner) - populate(objectMap, "providerIncidentId", i.ProviderIncidentID) - populate(objectMap, "providerName", i.ProviderName) - populate(objectMap, "relatedAnalyticRuleIds", i.RelatedAnalyticRuleIDs) - populate(objectMap, "severity", i.Severity) - populate(objectMap, "status", i.Status) - populate(objectMap, "teamInformation", i.TeamInformation) - populate(objectMap, "title", i.Title) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentProperties. -func (i *IncidentProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &i.AdditionalData) - delete(rawMsg, key) - case "classification": - err = unpopulate(val, "Classification", &i.Classification) - delete(rawMsg, key) - case "classificationComment": - err = unpopulate(val, "ClassificationComment", &i.ClassificationComment) - delete(rawMsg, key) - case "classificationReason": - err = unpopulate(val, "ClassificationReason", &i.ClassificationReason) - delete(rawMsg, key) - case "createdTimeUtc": - err = unpopulateTimeRFC3339(val, "CreatedTimeUTC", &i.CreatedTimeUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "firstActivityTimeUtc": - err = unpopulateTimeRFC3339(val, "FirstActivityTimeUTC", &i.FirstActivityTimeUTC) - delete(rawMsg, key) - case "incidentNumber": - err = unpopulate(val, "IncidentNumber", &i.IncidentNumber) - delete(rawMsg, key) - case "incidentUrl": - err = unpopulate(val, "IncidentURL", &i.IncidentURL) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &i.Labels) - delete(rawMsg, key) - case "lastActivityTimeUtc": - err = unpopulateTimeRFC3339(val, "LastActivityTimeUTC", &i.LastActivityTimeUTC) - delete(rawMsg, key) - case "lastModifiedTimeUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedTimeUTC", &i.LastModifiedTimeUTC) - delete(rawMsg, key) - case "owner": - err = unpopulate(val, "Owner", &i.Owner) - delete(rawMsg, key) - case "providerIncidentId": - err = unpopulate(val, "ProviderIncidentID", &i.ProviderIncidentID) - delete(rawMsg, key) - case "providerName": - err = unpopulate(val, "ProviderName", &i.ProviderName) - delete(rawMsg, key) - case "relatedAnalyticRuleIds": - err = unpopulate(val, "RelatedAnalyticRuleIDs", &i.RelatedAnalyticRuleIDs) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &i.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &i.Status) - delete(rawMsg, key) - case "teamInformation": - err = unpopulate(val, "TeamInformation", &i.TeamInformation) - delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &i.Title) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentPropertiesAction. -func (i IncidentPropertiesAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "classification", i.Classification) - populate(objectMap, "classificationComment", i.ClassificationComment) - populate(objectMap, "classificationReason", i.ClassificationReason) - populate(objectMap, "labels", i.Labels) - populate(objectMap, "owner", i.Owner) - populate(objectMap, "severity", i.Severity) - populate(objectMap, "status", i.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InsightQueryItem. -func (i *InsightQueryItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InstructionSteps. -func (i InstructionSteps) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", i.Description) - populate(objectMap, "instructions", i.Instructions) - populate(objectMap, "title", i.Title) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTCheckRequirements. -func (i IoTCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindIOT - populate(objectMap, "properties", i.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTCheckRequirements. -func (i *IoTCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTDataConnector. -func (i IoTDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", i.Etag) - populate(objectMap, "id", i.ID) - objectMap["kind"] = DataConnectorKindIOT - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDataConnector. -func (i *IoTDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &i.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTDeviceEntity. -func (i IoTDeviceEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - objectMap["kind"] = EntityKindIoTDevice - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTDeviceEntity. -func (i *IoTDeviceEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &i.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &i.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &i.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &i.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IoTDeviceEntityProperties. -func (i IoTDeviceEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", i.AdditionalData) - populate(objectMap, "deviceId", i.DeviceID) - populate(objectMap, "deviceName", i.DeviceName) - populate(objectMap, "deviceType", i.DeviceType) - populate(objectMap, "edgeId", i.EdgeID) - populate(objectMap, "firmwareVersion", i.FirmwareVersion) - populate(objectMap, "friendlyName", i.FriendlyName) - populate(objectMap, "hostEntityId", i.HostEntityID) - populate(objectMap, "ipAddressEntityId", i.IPAddressEntityID) - populate(objectMap, "iotHubEntityId", i.IotHubEntityID) - populate(objectMap, "iotSecurityAgentId", i.IotSecurityAgentID) - populate(objectMap, "macAddress", i.MacAddress) - populate(objectMap, "model", i.Model) - populate(objectMap, "operatingSystem", i.OperatingSystem) - populate(objectMap, "protocols", i.Protocols) - populate(objectMap, "serialNumber", i.SerialNumber) - populate(objectMap, "source", i.Source) - populate(objectMap, "threatIntelligence", i.ThreatIntelligence) - populate(objectMap, "vendor", i.Vendor) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MCASCheckRequirements. -func (m MCASCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindMicrosoftCloudAppSecurity - populate(objectMap, "properties", m.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MCASCheckRequirements. -func (m *MCASCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MCASDataConnector. -func (m MCASDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = DataConnectorKindMicrosoftCloudAppSecurity - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MCASDataConnector. -func (m *MCASDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MDATPCheckRequirements. -func (m MDATPCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindMicrosoftDefenderAdvancedThreatProtection - populate(objectMap, "properties", m.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPCheckRequirements. -func (m *MDATPCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MDATPDataConnector. -func (m MDATPDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = DataConnectorKindMicrosoftDefenderAdvancedThreatProtection - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MDATPDataConnector. -func (m *MDATPDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRule. -func (m MLBehaviorAnalyticsAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMLBehaviorAnalytics - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRule. -func (m *MLBehaviorAnalyticsAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleProperties. -func (m MLBehaviorAnalyticsAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "enabled", m.Enabled) - populateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "tactics", m.Tactics) - populate(objectMap, "techniques", m.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleProperties. -func (m *MLBehaviorAnalyticsAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &m.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &m.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleTemplate. -func (m MLBehaviorAnalyticsAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMLBehaviorAnalytics - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleTemplate. -func (m *MLBehaviorAnalyticsAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MLBehaviorAnalyticsAlertRuleTemplateProperties. -func (m MLBehaviorAnalyticsAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) - populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "status", m.Status) - populate(objectMap, "tactics", m.Tactics) - populate(objectMap, "techniques", m.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MLBehaviorAnalyticsAlertRuleTemplateProperties. -func (m *MLBehaviorAnalyticsAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &m.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &m.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MSTICheckRequirements. -func (m MSTICheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindMicrosoftThreatIntelligence - populate(objectMap, "properties", m.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MSTICheckRequirements. -func (m *MSTICheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MSTIDataConnector. -func (m MSTIDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = DataConnectorKindMicrosoftThreatIntelligence - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MSTIDataConnector. -func (m *MSTIDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MTPDataConnector. -func (m MTPDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = DataConnectorKindMicrosoftThreatProtection - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MTPDataConnector. -func (m *MTPDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailClusterEntity. -func (m MailClusterEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = EntityKindMailCluster - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MailClusterEntity. -func (m *MailClusterEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailClusterEntityProperties. -func (m MailClusterEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", m.AdditionalData) - populate(objectMap, "clusterGroup", m.ClusterGroup) - populateTimeRFC3339(objectMap, "clusterQueryEndTime", m.ClusterQueryEndTime) - populateTimeRFC3339(objectMap, "clusterQueryStartTime", m.ClusterQueryStartTime) - populate(objectMap, "clusterSourceIdentifier", m.ClusterSourceIdentifier) - populate(objectMap, "clusterSourceType", m.ClusterSourceType) - populate(objectMap, "countByDeliveryStatus", &m.CountByDeliveryStatus) - populate(objectMap, "countByProtectionStatus", &m.CountByProtectionStatus) - populate(objectMap, "countByThreatType", &m.CountByThreatType) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "isVolumeAnomaly", m.IsVolumeAnomaly) - populate(objectMap, "mailCount", m.MailCount) - populate(objectMap, "networkMessageIds", m.NetworkMessageIDs) - populate(objectMap, "query", m.Query) - populateTimeRFC3339(objectMap, "queryTime", m.QueryTime) - populate(objectMap, "source", m.Source) - populate(objectMap, "threats", m.Threats) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MailClusterEntityProperties. -func (m *MailClusterEntityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &m.AdditionalData) - delete(rawMsg, key) - case "clusterGroup": - err = unpopulate(val, "ClusterGroup", &m.ClusterGroup) - delete(rawMsg, key) - case "clusterQueryEndTime": - err = unpopulateTimeRFC3339(val, "ClusterQueryEndTime", &m.ClusterQueryEndTime) - delete(rawMsg, key) - case "clusterQueryStartTime": - err = unpopulateTimeRFC3339(val, "ClusterQueryStartTime", &m.ClusterQueryStartTime) - delete(rawMsg, key) - case "clusterSourceIdentifier": - err = unpopulate(val, "ClusterSourceIdentifier", &m.ClusterSourceIdentifier) - delete(rawMsg, key) - case "clusterSourceType": - err = unpopulate(val, "ClusterSourceType", &m.ClusterSourceType) - delete(rawMsg, key) - case "countByDeliveryStatus": - err = unpopulate(val, "CountByDeliveryStatus", &m.CountByDeliveryStatus) - delete(rawMsg, key) - case "countByProtectionStatus": - err = unpopulate(val, "CountByProtectionStatus", &m.CountByProtectionStatus) - delete(rawMsg, key) - case "countByThreatType": - err = unpopulate(val, "CountByThreatType", &m.CountByThreatType) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &m.FriendlyName) - delete(rawMsg, key) - case "isVolumeAnomaly": - err = unpopulate(val, "IsVolumeAnomaly", &m.IsVolumeAnomaly) - delete(rawMsg, key) - case "mailCount": - err = unpopulate(val, "MailCount", &m.MailCount) - delete(rawMsg, key) - case "networkMessageIds": - err = unpopulate(val, "NetworkMessageIDs", &m.NetworkMessageIDs) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &m.Query) - delete(rawMsg, key) - case "queryTime": - err = unpopulateTimeRFC3339(val, "QueryTime", &m.QueryTime) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &m.Source) - delete(rawMsg, key) - case "threats": - err = unpopulate(val, "Threats", &m.Threats) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailMessageEntity. -func (m MailMessageEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = EntityKindMailMessage - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MailMessageEntity. -func (m *MailMessageEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailMessageEntityProperties. -func (m MailMessageEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", m.AdditionalData) - populate(objectMap, "antispamDirection", m.AntispamDirection) - populate(objectMap, "bodyFingerprintBin1", m.BodyFingerprintBin1) - populate(objectMap, "bodyFingerprintBin2", m.BodyFingerprintBin2) - populate(objectMap, "bodyFingerprintBin3", m.BodyFingerprintBin3) - populate(objectMap, "bodyFingerprintBin4", m.BodyFingerprintBin4) - populate(objectMap, "bodyFingerprintBin5", m.BodyFingerprintBin5) - populate(objectMap, "deliveryAction", m.DeliveryAction) - populate(objectMap, "deliveryLocation", m.DeliveryLocation) - populate(objectMap, "fileEntityIds", m.FileEntityIDs) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "internetMessageId", m.InternetMessageID) - populate(objectMap, "language", m.Language) - populate(objectMap, "networkMessageId", m.NetworkMessageID) - populate(objectMap, "p1Sender", m.P1Sender) - populate(objectMap, "p1SenderDisplayName", m.P1SenderDisplayName) - populate(objectMap, "p1SenderDomain", m.P1SenderDomain) - populate(objectMap, "p2Sender", m.P2Sender) - populate(objectMap, "p2SenderDisplayName", m.P2SenderDisplayName) - populate(objectMap, "p2SenderDomain", m.P2SenderDomain) - populateTimeRFC3339(objectMap, "receiveDate", m.ReceiveDate) - populate(objectMap, "recipient", m.Recipient) - populate(objectMap, "senderIP", m.SenderIP) - populate(objectMap, "subject", m.Subject) - populate(objectMap, "threatDetectionMethods", m.ThreatDetectionMethods) - populate(objectMap, "threats", m.Threats) - populate(objectMap, "urls", m.Urls) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MailMessageEntityProperties. -func (m *MailMessageEntityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &m.AdditionalData) - delete(rawMsg, key) - case "antispamDirection": - err = unpopulate(val, "AntispamDirection", &m.AntispamDirection) - delete(rawMsg, key) - case "bodyFingerprintBin1": - err = unpopulate(val, "BodyFingerprintBin1", &m.BodyFingerprintBin1) - delete(rawMsg, key) - case "bodyFingerprintBin2": - err = unpopulate(val, "BodyFingerprintBin2", &m.BodyFingerprintBin2) - delete(rawMsg, key) - case "bodyFingerprintBin3": - err = unpopulate(val, "BodyFingerprintBin3", &m.BodyFingerprintBin3) - delete(rawMsg, key) - case "bodyFingerprintBin4": - err = unpopulate(val, "BodyFingerprintBin4", &m.BodyFingerprintBin4) - delete(rawMsg, key) - case "bodyFingerprintBin5": - err = unpopulate(val, "BodyFingerprintBin5", &m.BodyFingerprintBin5) - delete(rawMsg, key) - case "deliveryAction": - err = unpopulate(val, "DeliveryAction", &m.DeliveryAction) - delete(rawMsg, key) - case "deliveryLocation": - err = unpopulate(val, "DeliveryLocation", &m.DeliveryLocation) - delete(rawMsg, key) - case "fileEntityIds": - err = unpopulate(val, "FileEntityIDs", &m.FileEntityIDs) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &m.FriendlyName) - delete(rawMsg, key) - case "internetMessageId": - err = unpopulate(val, "InternetMessageID", &m.InternetMessageID) - delete(rawMsg, key) - case "language": - err = unpopulate(val, "Language", &m.Language) - delete(rawMsg, key) - case "networkMessageId": - err = unpopulate(val, "NetworkMessageID", &m.NetworkMessageID) - delete(rawMsg, key) - case "p1Sender": - err = unpopulate(val, "P1Sender", &m.P1Sender) - delete(rawMsg, key) - case "p1SenderDisplayName": - err = unpopulate(val, "P1SenderDisplayName", &m.P1SenderDisplayName) - delete(rawMsg, key) - case "p1SenderDomain": - err = unpopulate(val, "P1SenderDomain", &m.P1SenderDomain) - delete(rawMsg, key) - case "p2Sender": - err = unpopulate(val, "P2Sender", &m.P2Sender) - delete(rawMsg, key) - case "p2SenderDisplayName": - err = unpopulate(val, "P2SenderDisplayName", &m.P2SenderDisplayName) - delete(rawMsg, key) - case "p2SenderDomain": - err = unpopulate(val, "P2SenderDomain", &m.P2SenderDomain) - delete(rawMsg, key) - case "receiveDate": - err = unpopulateTimeRFC3339(val, "ReceiveDate", &m.ReceiveDate) - delete(rawMsg, key) - case "recipient": - err = unpopulate(val, "Recipient", &m.Recipient) - delete(rawMsg, key) - case "senderIP": - err = unpopulate(val, "SenderIP", &m.SenderIP) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &m.Subject) - delete(rawMsg, key) - case "threatDetectionMethods": - err = unpopulate(val, "ThreatDetectionMethods", &m.ThreatDetectionMethods) - delete(rawMsg, key) - case "threats": - err = unpopulate(val, "Threats", &m.Threats) - delete(rawMsg, key) - case "urls": - err = unpopulate(val, "Urls", &m.Urls) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailboxEntity. -func (m MailboxEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = EntityKindMailbox - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MailboxEntity. -func (m *MailboxEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MailboxEntityProperties. -func (m MailboxEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", m.AdditionalData) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "externalDirectoryObjectId", m.ExternalDirectoryObjectID) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "mailboxPrimaryAddress", m.MailboxPrimaryAddress) - populate(objectMap, "upn", m.Upn) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MalwareEntity. -func (m MalwareEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = EntityKindMalware - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareEntity. -func (m *MalwareEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MalwareEntityProperties. -func (m MalwareEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", m.AdditionalData) - populate(objectMap, "category", m.Category) - populate(objectMap, "fileEntityIds", m.FileEntityIDs) - populate(objectMap, "friendlyName", m.FriendlyName) - populate(objectMap, "malwareName", m.MalwareName) - populate(objectMap, "processEntityIds", m.ProcessEntityIDs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataCategories. -func (m MetadataCategories) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "domains", m.Domains) - populate(objectMap, "verticals", m.Verticals) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataDependencies. -func (m MetadataDependencies) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentId", m.ContentID) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "kind", m.Kind) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "version", m.Version) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataPatch. -func (m MetadataPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataProperties. -func (m MetadataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "author", m.Author) - populate(objectMap, "categories", m.Categories) - populate(objectMap, "contentId", m.ContentID) - populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) - populate(objectMap, "customVersion", m.CustomVersion) - populate(objectMap, "dependencies", m.Dependencies) - populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) - populate(objectMap, "icon", m.Icon) - populate(objectMap, "kind", m.Kind) - populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) - populate(objectMap, "parentId", m.ParentID) - populate(objectMap, "previewImages", m.PreviewImages) - populate(objectMap, "previewImagesDark", m.PreviewImagesDark) - populate(objectMap, "providers", m.Providers) - populate(objectMap, "source", m.Source) - populate(objectMap, "support", m.Support) - populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) - populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) - populate(objectMap, "version", m.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataProperties. -func (m *MetadataProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "author": - err = unpopulate(val, "Author", &m.Author) - delete(rawMsg, key) - case "categories": - err = unpopulate(val, "Categories", &m.Categories) - delete(rawMsg, key) - case "contentId": - err = unpopulate(val, "ContentID", &m.ContentID) - delete(rawMsg, key) - case "contentSchemaVersion": - err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) - delete(rawMsg, key) - case "customVersion": - err = unpopulate(val, "CustomVersion", &m.CustomVersion) - delete(rawMsg, key) - case "dependencies": - err = unpopulate(val, "Dependencies", &m.Dependencies) - delete(rawMsg, key) - case "firstPublishDate": - err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) - delete(rawMsg, key) - case "icon": - err = unpopulate(val, "Icon", &m.Icon) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "lastPublishDate": - err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) - delete(rawMsg, key) - case "parentId": - err = unpopulate(val, "ParentID", &m.ParentID) - delete(rawMsg, key) - case "previewImages": - err = unpopulate(val, "PreviewImages", &m.PreviewImages) - delete(rawMsg, key) - case "previewImagesDark": - err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) - delete(rawMsg, key) - case "providers": - err = unpopulate(val, "Providers", &m.Providers) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &m.Source) - delete(rawMsg, key) - case "support": - err = unpopulate(val, "Support", &m.Support) - delete(rawMsg, key) - case "threatAnalysisTactics": - err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) - delete(rawMsg, key) - case "threatAnalysisTechniques": - err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &m.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataPropertiesPatch. -func (m MetadataPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "author", m.Author) - populate(objectMap, "categories", m.Categories) - populate(objectMap, "contentId", m.ContentID) - populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) - populate(objectMap, "customVersion", m.CustomVersion) - populate(objectMap, "dependencies", m.Dependencies) - populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) - populate(objectMap, "icon", m.Icon) - populate(objectMap, "kind", m.Kind) - populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) - populate(objectMap, "parentId", m.ParentID) - populate(objectMap, "previewImages", m.PreviewImages) - populate(objectMap, "previewImagesDark", m.PreviewImagesDark) - populate(objectMap, "providers", m.Providers) - populate(objectMap, "source", m.Source) - populate(objectMap, "support", m.Support) - populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) - populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) - populate(objectMap, "version", m.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataPropertiesPatch. -func (m *MetadataPropertiesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "author": - err = unpopulate(val, "Author", &m.Author) - delete(rawMsg, key) - case "categories": - err = unpopulate(val, "Categories", &m.Categories) - delete(rawMsg, key) - case "contentId": - err = unpopulate(val, "ContentID", &m.ContentID) - delete(rawMsg, key) - case "contentSchemaVersion": - err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) - delete(rawMsg, key) - case "customVersion": - err = unpopulate(val, "CustomVersion", &m.CustomVersion) - delete(rawMsg, key) - case "dependencies": - err = unpopulate(val, "Dependencies", &m.Dependencies) - delete(rawMsg, key) - case "firstPublishDate": - err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) - delete(rawMsg, key) - case "icon": - err = unpopulate(val, "Icon", &m.Icon) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "lastPublishDate": - err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) - delete(rawMsg, key) - case "parentId": - err = unpopulate(val, "ParentID", &m.ParentID) - delete(rawMsg, key) - case "previewImages": - err = unpopulate(val, "PreviewImages", &m.PreviewImages) - delete(rawMsg, key) - case "previewImagesDark": - err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) - delete(rawMsg, key) - case "providers": - err = unpopulate(val, "Providers", &m.Providers) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &m.Source) - delete(rawMsg, key) - case "support": - err = unpopulate(val, "Support", &m.Support) - delete(rawMsg, key) - case "threatAnalysisTactics": - err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) - delete(rawMsg, key) - case "threatAnalysisTechniques": - err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &m.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. -func (m MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. -func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleCommonProperties. -func (m MicrosoftSecurityIncidentCreationAlertRuleCommonProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) - populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) - populate(objectMap, "productFilter", m.ProductFilter) - populate(objectMap, "severitiesFilter", m.SeveritiesFilter) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. -func (m MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) - populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) - populate(objectMap, "enabled", m.Enabled) - populateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) - populate(objectMap, "productFilter", m.ProductFilter) - populate(objectMap, "severitiesFilter", m.SeveritiesFilter) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. -func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "displayNamesExcludeFilter": - err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) - delete(rawMsg, key) - case "displayNamesFilter": - err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) - delete(rawMsg, key) - case "productFilter": - err = unpopulate(val, "ProductFilter", &m.ProductFilter) - delete(rawMsg, key) - case "severitiesFilter": - err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. -func (m MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. -func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. -func (m MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) - populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) - populate(objectMap, "productFilter", m.ProductFilter) - populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) - populate(objectMap, "severitiesFilter", m.SeveritiesFilter) - populate(objectMap, "status", m.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. -func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "displayNamesExcludeFilter": - err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) - delete(rawMsg, key) - case "displayNamesFilter": - err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) - delete(rawMsg, key) - case "productFilter": - err = unpopulate(val, "ProductFilter", &m.ProductFilter) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) - delete(rawMsg, key) - case "severitiesFilter": - err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MtpCheckRequirements. -func (m MtpCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindMicrosoftThreatProtection - populate(objectMap, "properties", m.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MtpCheckRequirements. -func (m *MtpCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &m.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NrtAlertRule. -func (n NrtAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", n.Etag) - populate(objectMap, "id", n.ID) - objectMap["kind"] = AlertRuleKindNRT - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "type", n.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRule. -func (n *NrtAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &n.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &n.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleProperties. -func (n NrtAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", n.AlertDetailsOverride) - populate(objectMap, "alertRuleTemplateName", n.AlertRuleTemplateName) - populate(objectMap, "customDetails", n.CustomDetails) - populate(objectMap, "description", n.Description) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "enabled", n.Enabled) - populate(objectMap, "entityMappings", n.EntityMappings) - populate(objectMap, "incidentConfiguration", n.IncidentConfiguration) - populateTimeRFC3339(objectMap, "lastModifiedUtc", n.LastModifiedUTC) - populate(objectMap, "query", n.Query) - populate(objectMap, "severity", n.Severity) - populate(objectMap, "suppressionDuration", n.SuppressionDuration) - populate(objectMap, "suppressionEnabled", n.SuppressionEnabled) - populate(objectMap, "tactics", n.Tactics) - populate(objectMap, "techniques", n.Techniques) - populate(objectMap, "templateVersion", n.TemplateVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleProperties. -func (n *NrtAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertDetailsOverride": - err = unpopulate(val, "AlertDetailsOverride", &n.AlertDetailsOverride) - delete(rawMsg, key) - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &n.AlertRuleTemplateName) - delete(rawMsg, key) - case "customDetails": - err = unpopulate(val, "CustomDetails", &n.CustomDetails) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &n.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &n.Enabled) - delete(rawMsg, key) - case "entityMappings": - err = unpopulate(val, "EntityMappings", &n.EntityMappings) - delete(rawMsg, key) - case "incidentConfiguration": - err = unpopulate(val, "IncidentConfiguration", &n.IncidentConfiguration) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &n.LastModifiedUTC) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &n.Query) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &n.Severity) - delete(rawMsg, key) - case "suppressionDuration": - err = unpopulate(val, "SuppressionDuration", &n.SuppressionDuration) - delete(rawMsg, key) - case "suppressionEnabled": - err = unpopulate(val, "SuppressionEnabled", &n.SuppressionEnabled) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &n.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &n.Techniques) - delete(rawMsg, key) - case "templateVersion": - err = unpopulate(val, "TemplateVersion", &n.TemplateVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleTemplate. -func (n NrtAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", n.ID) - objectMap["kind"] = AlertRuleKindNRT - populate(objectMap, "name", n.Name) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) - populate(objectMap, "type", n.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleTemplate. -func (n *NrtAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &n.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &n.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &n.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &n.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &n.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &n.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NrtAlertRuleTemplateProperties. -func (n NrtAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", n.AlertDetailsOverride) - populate(objectMap, "alertRulesCreatedByTemplateCount", n.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", n.CreatedDateUTC) - populate(objectMap, "customDetails", n.CustomDetails) - populate(objectMap, "description", n.Description) - populate(objectMap, "displayName", n.DisplayName) - populate(objectMap, "entityMappings", n.EntityMappings) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", n.LastUpdatedDateUTC) - populate(objectMap, "query", n.Query) - populate(objectMap, "requiredDataConnectors", n.RequiredDataConnectors) - populate(objectMap, "severity", n.Severity) - populate(objectMap, "status", n.Status) - populate(objectMap, "tactics", n.Tactics) - populate(objectMap, "techniques", n.Techniques) - populate(objectMap, "version", n.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NrtAlertRuleTemplateProperties. -func (n *NrtAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertDetailsOverride": - err = unpopulate(val, "AlertDetailsOverride", &n.AlertDetailsOverride) - delete(rawMsg, key) - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &n.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &n.CreatedDateUTC) - delete(rawMsg, key) - case "customDetails": - err = unpopulate(val, "CustomDetails", &n.CustomDetails) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &n.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &n.DisplayName) - delete(rawMsg, key) - case "entityMappings": - err = unpopulate(val, "EntityMappings", &n.EntityMappings) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &n.LastUpdatedDateUTC) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &n.Query) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &n.RequiredDataConnectors) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &n.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &n.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &n.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &n.Techniques) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &n.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Office365ProjectCheckRequirements. -func (o Office365ProjectCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindOffice365Project - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectCheckRequirements. -func (o *Office365ProjectCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Office365ProjectDataConnector. -func (o Office365ProjectDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOffice365Project - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Office365ProjectDataConnector. -func (o *Office365ProjectDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &o.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeATPCheckRequirements. -func (o OfficeATPCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindOfficeATP - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPCheckRequirements. -func (o *OfficeATPCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeATPDataConnector. -func (o OfficeATPDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOfficeATP - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeATPDataConnector. -func (o *OfficeATPDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &o.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnector. -func (o OfficeDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOffice365 - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnector. -func (o *OfficeDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &o.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeIRMCheckRequirements. -func (o OfficeIRMCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindOfficeIRM - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMCheckRequirements. -func (o *OfficeIRMCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeIRMDataConnector. -func (o OfficeIRMDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOfficeIRM - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeIRMDataConnector. -func (o *OfficeIRMDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &o.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficePowerBICheckRequirements. -func (o OfficePowerBICheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindOfficePowerBI - populate(objectMap, "properties", o.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBICheckRequirements. -func (o *OfficePowerBICheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficePowerBIDataConnector. -func (o OfficePowerBIDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOfficePowerBI - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficePowerBIDataConnector. -func (o *OfficePowerBIDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &o.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &o.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Permissions. -func (p Permissions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customs", p.Customs) - populate(objectMap, "resourceProvider", p.ResourceProvider) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProcessEntity. -func (p ProcessEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - objectMap["kind"] = EntityKindProcess - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntity. -func (p *ProcessEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &p.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProcessEntityProperties. -func (p ProcessEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountEntityId", p.AccountEntityID) - populate(objectMap, "additionalData", p.AdditionalData) - populate(objectMap, "commandLine", p.CommandLine) - populateTimeRFC3339(objectMap, "creationTimeUtc", p.CreationTimeUTC) - populate(objectMap, "elevationToken", p.ElevationToken) - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "hostEntityId", p.HostEntityID) - populate(objectMap, "hostLogonSessionEntityId", p.HostLogonSessionEntityID) - populate(objectMap, "imageFileEntityId", p.ImageFileEntityID) - populate(objectMap, "parentProcessEntityId", p.ParentProcessEntityID) - populate(objectMap, "processId", p.ProcessID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntityProperties. -func (p *ProcessEntityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountEntityId": - err = unpopulate(val, "AccountEntityID", &p.AccountEntityID) - delete(rawMsg, key) - case "additionalData": - err = unpopulate(val, "AdditionalData", &p.AdditionalData) - delete(rawMsg, key) - case "commandLine": - err = unpopulate(val, "CommandLine", &p.CommandLine) - delete(rawMsg, key) - case "creationTimeUtc": - err = unpopulateTimeRFC3339(val, "CreationTimeUTC", &p.CreationTimeUTC) - delete(rawMsg, key) - case "elevationToken": - err = unpopulate(val, "ElevationToken", &p.ElevationToken) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &p.FriendlyName) - delete(rawMsg, key) - case "hostEntityId": - err = unpopulate(val, "HostEntityID", &p.HostEntityID) - delete(rawMsg, key) - case "hostLogonSessionEntityId": - err = unpopulate(val, "HostLogonSessionEntityID", &p.HostLogonSessionEntityID) - delete(rawMsg, key) - case "imageFileEntityId": - err = unpopulate(val, "ImageFileEntityID", &p.ImageFileEntityID) - delete(rawMsg, key) - case "parentProcessEntityId": - err = unpopulate(val, "ParentProcessEntityID", &p.ParentProcessEntityID) - delete(rawMsg, key) - case "processId": - err = unpopulate(val, "ProcessID", &p.ProcessID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PropertyArrayChangedConditionProperties. -func (p PropertyArrayChangedConditionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "conditionProperties", p.ConditionProperties) - objectMap["conditionType"] = ConditionTypePropertyArrayChanged - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyArrayChangedConditionProperties. -func (p *PropertyArrayChangedConditionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditionProperties": - err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) - delete(rawMsg, key) - case "conditionType": - err = unpopulate(val, "ConditionType", &p.ConditionType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PropertyChangedConditionProperties. -func (p PropertyChangedConditionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "conditionProperties", p.ConditionProperties) - objectMap["conditionType"] = ConditionTypePropertyChanged - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyChangedConditionProperties. -func (p *PropertyChangedConditionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditionProperties": - err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) - delete(rawMsg, key) - case "conditionType": - err = unpopulate(val, "ConditionType", &p.ConditionType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PropertyConditionProperties. -func (p PropertyConditionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "conditionProperties", p.ConditionProperties) - objectMap["conditionType"] = ConditionTypeProperty - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyConditionProperties. -func (p *PropertyConditionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "conditionProperties": - err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) - delete(rawMsg, key) - case "conditionType": - err = unpopulate(val, "ConditionType", &p.ConditionType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type QueryBasedAlertRuleTemplateProperties. -func (q QueryBasedAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", q.AlertDetailsOverride) - populate(objectMap, "customDetails", q.CustomDetails) - populate(objectMap, "entityMappings", q.EntityMappings) - populate(objectMap, "query", q.Query) - populate(objectMap, "severity", q.Severity) - populate(objectMap, "version", q.Version) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryKeyEntity. -func (r RegistryKeyEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["kind"] = EntityKindRegistryKey - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryKeyEntity. -func (r *RegistryKeyEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &r.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryKeyEntityProperties. -func (r RegistryKeyEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", r.AdditionalData) - populate(objectMap, "friendlyName", r.FriendlyName) - populate(objectMap, "hive", r.Hive) - populate(objectMap, "key", r.Key) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryValueEntity. -func (r RegistryValueEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["kind"] = EntityKindRegistryValue - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RegistryValueEntity. -func (r *RegistryValueEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &r.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RegistryValueEntityProperties. -func (r RegistryValueEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", r.AdditionalData) - populate(objectMap, "friendlyName", r.FriendlyName) - populate(objectMap, "keyEntityId", r.KeyEntityID) - populate(objectMap, "valueData", r.ValueData) - populate(objectMap, "valueName", r.ValueName) - populate(objectMap, "valueType", r.ValueType) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Repository. -func (r Repository) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "branch", r.Branch) - populate(objectMap, "deploymentLogsUrl", r.DeploymentLogsURL) - populate(objectMap, "displayUrl", r.DisplayURL) - populate(objectMap, "pathMapping", r.PathMapping) - populate(objectMap, "url", r.URL) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRule. -func (s ScheduledAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", s.Etag) - populate(objectMap, "id", s.ID) - objectMap["kind"] = AlertRuleKindScheduled - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRule. -func (s *ScheduledAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &s.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleCommonProperties. -func (s ScheduledAlertRuleCommonProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", s.AlertDetailsOverride) - populate(objectMap, "customDetails", s.CustomDetails) - populate(objectMap, "entityMappings", s.EntityMappings) - populate(objectMap, "eventGroupingSettings", s.EventGroupingSettings) - populate(objectMap, "query", s.Query) - populate(objectMap, "queryFrequency", s.QueryFrequency) - populate(objectMap, "queryPeriod", s.QueryPeriod) - populate(objectMap, "severity", s.Severity) - populate(objectMap, "triggerOperator", s.TriggerOperator) - populate(objectMap, "triggerThreshold", s.TriggerThreshold) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleProperties. -func (s ScheduledAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", s.AlertDetailsOverride) - populate(objectMap, "alertRuleTemplateName", s.AlertRuleTemplateName) - populate(objectMap, "customDetails", s.CustomDetails) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "enabled", s.Enabled) - populate(objectMap, "entityMappings", s.EntityMappings) - populate(objectMap, "eventGroupingSettings", s.EventGroupingSettings) - populate(objectMap, "incidentConfiguration", s.IncidentConfiguration) - populateTimeRFC3339(objectMap, "lastModifiedUtc", s.LastModifiedUTC) - populate(objectMap, "query", s.Query) - populate(objectMap, "queryFrequency", s.QueryFrequency) - populate(objectMap, "queryPeriod", s.QueryPeriod) - populate(objectMap, "severity", s.Severity) - populate(objectMap, "suppressionDuration", s.SuppressionDuration) - populate(objectMap, "suppressionEnabled", s.SuppressionEnabled) - populate(objectMap, "tactics", s.Tactics) - populate(objectMap, "techniques", s.Techniques) - populate(objectMap, "templateVersion", s.TemplateVersion) - populate(objectMap, "triggerOperator", s.TriggerOperator) - populate(objectMap, "triggerThreshold", s.TriggerThreshold) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleProperties. -func (s *ScheduledAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertDetailsOverride": - err = unpopulate(val, "AlertDetailsOverride", &s.AlertDetailsOverride) - delete(rawMsg, key) - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &s.AlertRuleTemplateName) - delete(rawMsg, key) - case "customDetails": - err = unpopulate(val, "CustomDetails", &s.CustomDetails) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "entityMappings": - err = unpopulate(val, "EntityMappings", &s.EntityMappings) - delete(rawMsg, key) - case "eventGroupingSettings": - err = unpopulate(val, "EventGroupingSettings", &s.EventGroupingSettings) - delete(rawMsg, key) - case "incidentConfiguration": - err = unpopulate(val, "IncidentConfiguration", &s.IncidentConfiguration) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &s.LastModifiedUTC) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &s.Query) - delete(rawMsg, key) - case "queryFrequency": - err = unpopulate(val, "QueryFrequency", &s.QueryFrequency) - delete(rawMsg, key) - case "queryPeriod": - err = unpopulate(val, "QueryPeriod", &s.QueryPeriod) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "suppressionDuration": - err = unpopulate(val, "SuppressionDuration", &s.SuppressionDuration) - delete(rawMsg, key) - case "suppressionEnabled": - err = unpopulate(val, "SuppressionEnabled", &s.SuppressionEnabled) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &s.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &s.Techniques) - delete(rawMsg, key) - case "templateVersion": - err = unpopulate(val, "TemplateVersion", &s.TemplateVersion) - delete(rawMsg, key) - case "triggerOperator": - err = unpopulate(val, "TriggerOperator", &s.TriggerOperator) - delete(rawMsg, key) - case "triggerThreshold": - err = unpopulate(val, "TriggerThreshold", &s.TriggerThreshold) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleTemplate. -func (s ScheduledAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - objectMap["kind"] = AlertRuleKindScheduled - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleTemplate. -func (s *ScheduledAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledAlertRuleTemplateProperties. -func (s ScheduledAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDetailsOverride", s.AlertDetailsOverride) - populate(objectMap, "alertRulesCreatedByTemplateCount", s.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", s.CreatedDateUTC) - populate(objectMap, "customDetails", s.CustomDetails) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "entityMappings", s.EntityMappings) - populate(objectMap, "eventGroupingSettings", s.EventGroupingSettings) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", s.LastUpdatedDateUTC) - populate(objectMap, "query", s.Query) - populate(objectMap, "queryFrequency", s.QueryFrequency) - populate(objectMap, "queryPeriod", s.QueryPeriod) - populate(objectMap, "requiredDataConnectors", s.RequiredDataConnectors) - populate(objectMap, "severity", s.Severity) - populate(objectMap, "status", s.Status) - populate(objectMap, "tactics", s.Tactics) - populate(objectMap, "techniques", s.Techniques) - populate(objectMap, "triggerOperator", s.TriggerOperator) - populate(objectMap, "triggerThreshold", s.TriggerThreshold) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledAlertRuleTemplateProperties. -func (s *ScheduledAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertDetailsOverride": - err = unpopulate(val, "AlertDetailsOverride", &s.AlertDetailsOverride) - delete(rawMsg, key) - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &s.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &s.CreatedDateUTC) - delete(rawMsg, key) - case "customDetails": - err = unpopulate(val, "CustomDetails", &s.CustomDetails) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "entityMappings": - err = unpopulate(val, "EntityMappings", &s.EntityMappings) - delete(rawMsg, key) - case "eventGroupingSettings": - err = unpopulate(val, "EventGroupingSettings", &s.EventGroupingSettings) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &s.LastUpdatedDateUTC) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &s.Query) - delete(rawMsg, key) - case "queryFrequency": - err = unpopulate(val, "QueryFrequency", &s.QueryFrequency) - delete(rawMsg, key) - case "queryPeriod": - err = unpopulate(val, "QueryPeriod", &s.QueryPeriod) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &s.RequiredDataConnectors) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &s.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &s.Techniques) - delete(rawMsg, key) - case "triggerOperator": - err = unpopulate(val, "TriggerOperator", &s.TriggerOperator) - delete(rawMsg, key) - case "triggerThreshold": - err = unpopulate(val, "TriggerThreshold", &s.TriggerThreshold) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &s.Version) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecurityAlert. -func (s SecurityAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - objectMap["kind"] = EntityKindSecurityAlert - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlert. -func (s *SecurityAlert) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecurityAlertProperties. -func (s SecurityAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", s.AdditionalData) - populate(objectMap, "alertDisplayName", s.AlertDisplayName) - populate(objectMap, "alertLink", s.AlertLink) - populate(objectMap, "alertType", s.AlertType) - populate(objectMap, "compromisedEntity", s.CompromisedEntity) - populate(objectMap, "confidenceLevel", s.ConfidenceLevel) - populate(objectMap, "confidenceReasons", s.ConfidenceReasons) - populate(objectMap, "confidenceScore", s.ConfidenceScore) - populate(objectMap, "confidenceScoreStatus", s.ConfidenceScoreStatus) - populate(objectMap, "description", s.Description) - populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) - populate(objectMap, "friendlyName", s.FriendlyName) - populate(objectMap, "intent", s.Intent) - populateTimeRFC3339(objectMap, "processingEndTime", s.ProcessingEndTime) - populate(objectMap, "productComponentName", s.ProductComponentName) - populate(objectMap, "productName", s.ProductName) - populate(objectMap, "productVersion", s.ProductVersion) - populate(objectMap, "providerAlertId", s.ProviderAlertID) - populate(objectMap, "remediationSteps", s.RemediationSteps) - populate(objectMap, "resourceIdentifiers", s.ResourceIdentifiers) - populate(objectMap, "severity", s.Severity) - populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) - populate(objectMap, "status", s.Status) - populate(objectMap, "systemAlertId", s.SystemAlertID) - populate(objectMap, "tactics", s.Tactics) - populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) - populate(objectMap, "vendorName", s.VendorName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertProperties. -func (s *SecurityAlertProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &s.AdditionalData) - delete(rawMsg, key) - case "alertDisplayName": - err = unpopulate(val, "AlertDisplayName", &s.AlertDisplayName) - delete(rawMsg, key) - case "alertLink": - err = unpopulate(val, "AlertLink", &s.AlertLink) - delete(rawMsg, key) - case "alertType": - err = unpopulate(val, "AlertType", &s.AlertType) - delete(rawMsg, key) - case "compromisedEntity": - err = unpopulate(val, "CompromisedEntity", &s.CompromisedEntity) - delete(rawMsg, key) - case "confidenceLevel": - err = unpopulate(val, "ConfidenceLevel", &s.ConfidenceLevel) - delete(rawMsg, key) - case "confidenceReasons": - err = unpopulate(val, "ConfidenceReasons", &s.ConfidenceReasons) - delete(rawMsg, key) - case "confidenceScore": - err = unpopulate(val, "ConfidenceScore", &s.ConfidenceScore) - delete(rawMsg, key) - case "confidenceScoreStatus": - err = unpopulate(val, "ConfidenceScoreStatus", &s.ConfidenceScoreStatus) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &s.FriendlyName) - delete(rawMsg, key) - case "intent": - err = unpopulate(val, "Intent", &s.Intent) - delete(rawMsg, key) - case "processingEndTime": - err = unpopulateTimeRFC3339(val, "ProcessingEndTime", &s.ProcessingEndTime) - delete(rawMsg, key) - case "productComponentName": - err = unpopulate(val, "ProductComponentName", &s.ProductComponentName) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &s.ProductName) - delete(rawMsg, key) - case "productVersion": - err = unpopulate(val, "ProductVersion", &s.ProductVersion) - delete(rawMsg, key) - case "providerAlertId": - err = unpopulate(val, "ProviderAlertID", &s.ProviderAlertID) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &s.RemediationSteps) - delete(rawMsg, key) - case "resourceIdentifiers": - err = unpopulate(val, "ResourceIdentifiers", &s.ResourceIdentifiers) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "systemAlertId": - err = unpopulate(val, "SystemAlertID", &s.SystemAlertID) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &s.Tactics) - delete(rawMsg, key) - case "timeGenerated": - err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) - delete(rawMsg, key) - case "vendorName": - err = unpopulate(val, "VendorName", &s.VendorName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityAlertTimelineItem. -func (s *SecurityAlertTimelineItem) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertType": - err = unpopulate(val, "AlertType", &s.AlertType) - delete(rawMsg, key) - case "azureResourceId": - err = unpopulate(val, "AzureResourceID", &s.AzureResourceID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &s.ProductName) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) - delete(rawMsg, key) - case "timeGenerated": - err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecurityGroupEntity. -func (s SecurityGroupEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - objectMap["kind"] = EntityKindSecurityGroup - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupEntity. -func (s *SecurityGroupEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecurityGroupEntityProperties. -func (s SecurityGroupEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", s.AdditionalData) - populate(objectMap, "distinguishedName", s.DistinguishedName) - populate(objectMap, "friendlyName", s.FriendlyName) - populate(objectMap, "objectGuid", s.ObjectGUID) - populate(objectMap, "sid", s.Sid) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSettingsDataSource. -func (s SecurityMLAnalyticsSettingsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectorId", s.ConnectorID) - populate(objectMap, "dataTypes", s.DataTypes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsList. -func (s *SecurityMLAnalyticsSettingsList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - s.Value, err = unmarshalSecurityMLAnalyticsSettingClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SettingList. -func (s *SettingList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - s.Value, err = unmarshalSettingsClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SourceControlProperties. -func (s SourceControlProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentTypes", s.ContentTypes) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "id", s.ID) - populate(objectMap, "lastDeploymentInfo", s.LastDeploymentInfo) - populate(objectMap, "repoType", s.RepoType) - populate(objectMap, "repository", s.Repository) - populate(objectMap, "repositoryResourceInfo", s.RepositoryResourceInfo) - populate(objectMap, "version", s.Version) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SubmissionMailEntity. -func (s SubmissionMailEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - objectMap["kind"] = EntityKindSubmissionMail - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubmissionMailEntity. -func (s *SubmissionMailEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubmissionMailEntityProperties. -func (s SubmissionMailEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", s.AdditionalData) - populate(objectMap, "friendlyName", s.FriendlyName) - populate(objectMap, "networkMessageId", s.NetworkMessageID) - populate(objectMap, "recipient", s.Recipient) - populate(objectMap, "reportType", s.ReportType) - populate(objectMap, "sender", s.Sender) - populate(objectMap, "senderIp", s.SenderIP) - populate(objectMap, "subject", s.Subject) - populateTimeRFC3339(objectMap, "submissionDate", s.SubmissionDate) - populate(objectMap, "submissionId", s.SubmissionID) - populate(objectMap, "submitter", s.Submitter) - populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubmissionMailEntityProperties. -func (s *SubmissionMailEntityProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &s.AdditionalData) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &s.FriendlyName) - delete(rawMsg, key) - case "networkMessageId": - err = unpopulate(val, "NetworkMessageID", &s.NetworkMessageID) - delete(rawMsg, key) - case "recipient": - err = unpopulate(val, "Recipient", &s.Recipient) - delete(rawMsg, key) - case "reportType": - err = unpopulate(val, "ReportType", &s.ReportType) - delete(rawMsg, key) - case "sender": - err = unpopulate(val, "Sender", &s.Sender) - delete(rawMsg, key) - case "senderIp": - err = unpopulate(val, "SenderIP", &s.SenderIP) - delete(rawMsg, key) - case "subject": - err = unpopulate(val, "Subject", &s.Subject) - delete(rawMsg, key) - case "submissionDate": - err = unpopulateTimeRFC3339(val, "SubmissionDate", &s.SubmissionDate) - delete(rawMsg, key) - case "submissionId": - err = unpopulate(val, "SubmissionID", &s.SubmissionID) - delete(rawMsg, key) - case "submitter": - err = unpopulate(val, "Submitter", &s.Submitter) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &s.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TICheckRequirements. -func (t TICheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindThreatIntelligence - populate(objectMap, "properties", t.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TICheckRequirements. -func (t *TICheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TIDataConnector. -func (t TIDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - objectMap["kind"] = DataConnectorKindThreatIntelligence - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnector. -func (t *TIDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TIDataConnectorProperties. -func (t TIDataConnectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataTypes", t.DataTypes) - populate(objectMap, "tenantId", t.TenantID) - populateTimeRFC3339(objectMap, "tipLookbackPeriod", t.TipLookbackPeriod) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TIDataConnectorProperties. -func (t *TIDataConnectorProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataTypes": - err = unpopulate(val, "DataTypes", &t.DataTypes) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &t.TenantID) - delete(rawMsg, key) - case "tipLookbackPeriod": - err = unpopulateTimeRFC3339(val, "TipLookbackPeriod", &t.TipLookbackPeriod) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TeamInformation. -func (t TeamInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", t.Description) - populate(objectMap, "name", t.Name) - populate(objectMap, "primaryChannelUrl", t.PrimaryChannelURL) - populateTimeRFC3339(objectMap, "teamCreationTimeUtc", t.TeamCreationTimeUTC) - populate(objectMap, "teamId", t.TeamID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TeamInformation. -func (t *TeamInformation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "primaryChannelUrl": - err = unpopulate(val, "PrimaryChannelURL", &t.PrimaryChannelURL) - delete(rawMsg, key) - case "teamCreationTimeUtc": - err = unpopulateTimeRFC3339(val, "TeamCreationTimeUTC", &t.TeamCreationTimeUTC) - delete(rawMsg, key) - case "teamId": - err = unpopulate(val, "TeamID", &t.TeamID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TeamProperties. -func (t TeamProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupIds", t.GroupIDs) - populate(objectMap, "memberIds", t.MemberIDs) - populate(objectMap, "teamDescription", t.TeamDescription) - populate(objectMap, "teamName", t.TeamName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRule. -func (t ThreatIntelligenceAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - objectMap["kind"] = AlertRuleKindThreatIntelligence - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRule. -func (t *ThreatIntelligenceAlertRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleProperties. -func (t ThreatIntelligenceAlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRuleTemplateName", t.AlertRuleTemplateName) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "enabled", t.Enabled) - populateTimeRFC3339(objectMap, "lastModifiedUtc", t.LastModifiedUTC) - populate(objectMap, "severity", t.Severity) - populate(objectMap, "tactics", t.Tactics) - populate(objectMap, "techniques", t.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleProperties. -func (t *ThreatIntelligenceAlertRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &t.AlertRuleTemplateName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &t.Enabled) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &t.LastModifiedUTC) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &t.Severity) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &t.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &t.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleTemplate. -func (t ThreatIntelligenceAlertRuleTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - objectMap["kind"] = AlertRuleKindThreatIntelligence - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleTemplate. -func (t *ThreatIntelligenceAlertRuleTemplate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAlertRuleTemplateProperties. -func (t ThreatIntelligenceAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertRulesCreatedByTemplateCount", t.AlertRulesCreatedByTemplateCount) - populateTimeRFC3339(objectMap, "createdDateUTC", t.CreatedDateUTC) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populateTimeRFC3339(objectMap, "lastUpdatedDateUTC", t.LastUpdatedDateUTC) - populate(objectMap, "requiredDataConnectors", t.RequiredDataConnectors) - populate(objectMap, "severity", t.Severity) - populate(objectMap, "status", t.Status) - populate(objectMap, "tactics", t.Tactics) - populate(objectMap, "techniques", t.Techniques) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceAlertRuleTemplateProperties. -func (t *ThreatIntelligenceAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &t.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &t.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateTimeRFC3339(val, "LastUpdatedDateUTC", &t.LastUpdatedDateUTC) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &t.RequiredDataConnectors) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &t.Severity) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &t.Status) - delete(rawMsg, key) - case "tactics": - err = unpopulate(val, "Tactics", &t.Tactics) - delete(rawMsg, key) - case "techniques": - err = unpopulate(val, "Techniques", &t.Techniques) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceAppendTags. -func (t ThreatIntelligenceAppendTags) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "threatIntelligenceTags", t.ThreatIntelligenceTags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceExternalReference. -func (t ThreatIntelligenceExternalReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", t.Description) - populate(objectMap, "externalId", t.ExternalID) - populate(objectMap, "hashes", t.Hashes) - populate(objectMap, "sourceName", t.SourceName) - populate(objectMap, "url", t.URL) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceFilteringCriteria. -func (t ThreatIntelligenceFilteringCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ids", t.IDs) - populate(objectMap, "includeDisabled", t.IncludeDisabled) - populate(objectMap, "keywords", t.Keywords) - populate(objectMap, "maxConfidence", t.MaxConfidence) - populate(objectMap, "maxValidUntil", t.MaxValidUntil) - populate(objectMap, "minConfidence", t.MinConfidence) - populate(objectMap, "minValidUntil", t.MinValidUntil) - populate(objectMap, "pageSize", t.PageSize) - populate(objectMap, "patternTypes", t.PatternTypes) - populate(objectMap, "skipToken", t.SkipToken) - populate(objectMap, "sortBy", t.SortBy) - populate(objectMap, "sources", t.Sources) - populate(objectMap, "threatTypes", t.ThreatTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceGranularMarkingModel. -func (t ThreatIntelligenceGranularMarkingModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "language", t.Language) - populate(objectMap, "markingRef", t.MarkingRef) - populate(objectMap, "selectors", t.Selectors) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceIndicatorModel. -func (t ThreatIntelligenceIndicatorModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - objectMap["kind"] = ThreatIntelligenceResourceKindEnumIndicator - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceIndicatorModel. -func (t *ThreatIntelligenceIndicatorModel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceIndicatorProperties. -func (t ThreatIntelligenceIndicatorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", t.AdditionalData) - populate(objectMap, "confidence", t.Confidence) - populate(objectMap, "created", t.Created) - populate(objectMap, "createdByRef", t.CreatedByRef) - populate(objectMap, "defanged", t.Defanged) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "extensions", t.Extensions) - populate(objectMap, "externalId", t.ExternalID) - populate(objectMap, "externalLastUpdatedTimeUtc", t.ExternalLastUpdatedTimeUTC) - populate(objectMap, "externalReferences", t.ExternalReferences) - populate(objectMap, "friendlyName", t.FriendlyName) - populate(objectMap, "granularMarkings", t.GranularMarkings) - populate(objectMap, "indicatorTypes", t.IndicatorTypes) - populate(objectMap, "killChainPhases", t.KillChainPhases) - populate(objectMap, "labels", t.Labels) - populate(objectMap, "language", t.Language) - populate(objectMap, "lastUpdatedTimeUtc", t.LastUpdatedTimeUTC) - populate(objectMap, "modified", t.Modified) - populate(objectMap, "objectMarkingRefs", t.ObjectMarkingRefs) - populate(objectMap, "parsedPattern", t.ParsedPattern) - populate(objectMap, "pattern", t.Pattern) - populate(objectMap, "patternType", t.PatternType) - populate(objectMap, "patternVersion", t.PatternVersion) - populate(objectMap, "revoked", t.Revoked) - populate(objectMap, "source", t.Source) - populate(objectMap, "threatIntelligenceTags", t.ThreatIntelligenceTags) - populate(objectMap, "threatTypes", t.ThreatTypes) - populate(objectMap, "validFrom", t.ValidFrom) - populate(objectMap, "validUntil", t.ValidUntil) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThreatIntelligenceInformationList. -func (t *ThreatIntelligenceInformationList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - t.Value, err = unmarshalThreatIntelligenceInformationClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThreatIntelligenceParsedPattern. -func (t ThreatIntelligenceParsedPattern) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "patternTypeKey", t.PatternTypeKey) - populate(objectMap, "patternTypeValues", t.PatternTypeValues) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TiTaxiiCheckRequirements. -func (t TiTaxiiCheckRequirements) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = DataConnectorKindThreatIntelligenceTaxii - populate(objectMap, "properties", t.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiCheckRequirements. -func (t *TiTaxiiCheckRequirements) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnector. -func (t TiTaxiiDataConnector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - objectMap["kind"] = DataConnectorKindThreatIntelligenceTaxii - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnector. -func (t *TiTaxiiDataConnector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &t.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TiTaxiiDataConnectorProperties. -func (t TiTaxiiDataConnectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "collectionId", t.CollectionID) - populate(objectMap, "dataTypes", t.DataTypes) - populate(objectMap, "friendlyName", t.FriendlyName) - populate(objectMap, "password", t.Password) - populate(objectMap, "pollingFrequency", t.PollingFrequency) - populateTimeRFC3339(objectMap, "taxiiLookbackPeriod", t.TaxiiLookbackPeriod) - populate(objectMap, "taxiiServer", t.TaxiiServer) - populate(objectMap, "tenantId", t.TenantID) - populate(objectMap, "userName", t.UserName) - populate(objectMap, "workspaceId", t.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TiTaxiiDataConnectorProperties. -func (t *TiTaxiiDataConnectorProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "collectionId": - err = unpopulate(val, "CollectionID", &t.CollectionID) - delete(rawMsg, key) - case "dataTypes": - err = unpopulate(val, "DataTypes", &t.DataTypes) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &t.FriendlyName) - delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &t.Password) - delete(rawMsg, key) - case "pollingFrequency": - err = unpopulate(val, "PollingFrequency", &t.PollingFrequency) - delete(rawMsg, key) - case "taxiiLookbackPeriod": - err = unpopulateTimeRFC3339(val, "TaxiiLookbackPeriod", &t.TaxiiLookbackPeriod) - delete(rawMsg, key) - case "taxiiServer": - err = unpopulate(val, "TaxiiServer", &t.TaxiiServer) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &t.TenantID) - delete(rawMsg, key) - case "userName": - err = unpopulate(val, "UserName", &t.UserName) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &t.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type URLEntity. -func (u URLEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", u.ID) - objectMap["kind"] = EntityKindURL - populate(objectMap, "name", u.Name) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "systemData", u.SystemData) - populate(objectMap, "type", u.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type URLEntity. -func (u *URLEntity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &u.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &u.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &u.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &u.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &u.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type URLEntityProperties. -func (u URLEntityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", u.AdditionalData) - populate(objectMap, "friendlyName", u.FriendlyName) - populate(objectMap, "url", u.URL) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Ueba. -func (u Ueba) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", u.Etag) - populate(objectMap, "id", u.ID) - objectMap["kind"] = SettingKindUeba - populate(objectMap, "name", u.Name) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "systemData", u.SystemData) - populate(objectMap, "type", u.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Ueba. -func (u *Ueba) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &u.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &u.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &u.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &u.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &u.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &u.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UebaProperties. -func (u UebaProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataSources", u.DataSources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WatchlistItemProperties. -func (w WatchlistItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "created", w.Created) - populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "entityMapping", w.EntityMapping) - populate(objectMap, "isDeleted", w.IsDeleted) - populate(objectMap, "itemsKeyValue", w.ItemsKeyValue) - populate(objectMap, "tenantId", w.TenantID) - populateTimeRFC3339(objectMap, "updated", w.Updated) - populate(objectMap, "updatedBy", w.UpdatedBy) - populate(objectMap, "watchlistItemId", w.WatchlistItemID) - populate(objectMap, "watchlistItemType", w.WatchlistItemType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistItemProperties. -func (w *WatchlistItemProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "created": - err = unpopulateTimeRFC3339(val, "Created", &w.Created) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &w.CreatedBy) - delete(rawMsg, key) - case "entityMapping": - err = unpopulate(val, "EntityMapping", &w.EntityMapping) - delete(rawMsg, key) - case "isDeleted": - err = unpopulate(val, "IsDeleted", &w.IsDeleted) - delete(rawMsg, key) - case "itemsKeyValue": - err = unpopulate(val, "ItemsKeyValue", &w.ItemsKeyValue) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &w.Updated) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &w.UpdatedBy) - delete(rawMsg, key) - case "watchlistItemId": - err = unpopulate(val, "WatchlistItemID", &w.WatchlistItemID) - delete(rawMsg, key) - case "watchlistItemType": - err = unpopulate(val, "WatchlistItemType", &w.WatchlistItemType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WatchlistProperties. -func (w WatchlistProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contentType", w.ContentType) - populateTimeRFC3339(objectMap, "created", w.Created) - populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "defaultDuration", w.DefaultDuration) - populate(objectMap, "description", w.Description) - populate(objectMap, "displayName", w.DisplayName) - populate(objectMap, "isDeleted", w.IsDeleted) - populate(objectMap, "itemsSearchKey", w.ItemsSearchKey) - populate(objectMap, "labels", w.Labels) - populate(objectMap, "numberOfLinesToSkip", w.NumberOfLinesToSkip) - populate(objectMap, "provider", w.Provider) - populate(objectMap, "rawContent", w.RawContent) - populate(objectMap, "source", w.Source) - populate(objectMap, "sourceType", w.SourceType) - populate(objectMap, "tenantId", w.TenantID) - populateTimeRFC3339(objectMap, "updated", w.Updated) - populate(objectMap, "updatedBy", w.UpdatedBy) - populate(objectMap, "uploadStatus", w.UploadStatus) - populate(objectMap, "watchlistAlias", w.WatchlistAlias) - populate(objectMap, "watchlistId", w.WatchlistID) - populate(objectMap, "watchlistType", w.WatchlistType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WatchlistProperties. -func (w *WatchlistProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contentType": - err = unpopulate(val, "ContentType", &w.ContentType) - delete(rawMsg, key) - case "created": - err = unpopulateTimeRFC3339(val, "Created", &w.Created) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &w.CreatedBy) - delete(rawMsg, key) - case "defaultDuration": - err = unpopulate(val, "DefaultDuration", &w.DefaultDuration) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &w.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "isDeleted": - err = unpopulate(val, "IsDeleted", &w.IsDeleted) - delete(rawMsg, key) - case "itemsSearchKey": - err = unpopulate(val, "ItemsSearchKey", &w.ItemsSearchKey) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &w.Labels) - delete(rawMsg, key) - case "numberOfLinesToSkip": - err = unpopulate(val, "NumberOfLinesToSkip", &w.NumberOfLinesToSkip) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &w.Provider) - delete(rawMsg, key) - case "rawContent": - err = unpopulate(val, "RawContent", &w.RawContent) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &w.Source) - delete(rawMsg, key) - case "sourceType": - err = unpopulate(val, "SourceType", &w.SourceType) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) - delete(rawMsg, key) - case "updated": - err = unpopulateTimeRFC3339(val, "Updated", &w.Updated) - delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &w.UpdatedBy) - delete(rawMsg, key) - case "uploadStatus": - err = unpopulate(val, "UploadStatus", &w.UploadStatus) - delete(rawMsg, key) - case "watchlistAlias": - err = unpopulate(val, "WatchlistAlias", &w.WatchlistAlias) - delete(rawMsg, key) - case "watchlistId": - err = unpopulate(val, "WatchlistID", &w.WatchlistID) - delete(rawMsg, key) - case "watchlistType": - err = unpopulate(val, "WatchlistType", &w.WatchlistType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}