From ef7ffaa1ae68ab17dba86d8e0be5fd1fb615ef64 Mon Sep 17 00:00:00 2001 From: ori-licht <58462609+ori-licht@users.noreply.github.com> Date: Thu, 10 Jun 2021 09:15:09 +0300 Subject: [PATCH] refactoring EntityQueries - extracting common to EntityDefinitions (#14659) * refactoring EntityQueries - extracting common to EntityDefinitions * fix bug with reference * fix reference --- .../2021-03-01-preview/EntityDefinitions.json | 181 ++++++++++++++++++ .../2021-03-01-preview/EntityQueries.json | 149 +------------- 2 files changed, 185 insertions(+), 145 deletions(-) create mode 100644 specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityDefinitions.json diff --git a/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityDefinitions.json b/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityDefinitions.json new file mode 100644 index 000000000000..6eb99cabfc65 --- /dev/null +++ b/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityDefinitions.json @@ -0,0 +1,181 @@ +{ + "swagger": "2.0", + "info": { + "title": "Security Insights", + "description": "API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider", + "version": "2021-03-01-preview" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": {}, + "definitions": { + "EntityInnerType": { + "description": "The type of the entity", + "enum": [ + "Account", + "Host", + "File", + "AzureResource", + "CloudApplication", + "DNS", + "FileHash", + "IP", + "Malware", + "Process", + "RegistryKey", + "RegistryValue", + "SecurityGroup", + "URL", + "IoTDevice", + "SecurityAlert", + "HuntingBookmark", + "MailCluster", + "MailMessage", + "Mailbox", + "SubmissionMail" + ], + "type": "string", + "x-ms-enum": { + "modelAsString": true, + "name": "EntityType", + "values": [ + { + "description": "Entity represents account in the system.", + "value": "Account" + }, + { + "description": "Entity represents host in the system.", + "value": "Host" + }, + { + "description": "Entity represents file in the system.", + "value": "File" + }, + { + "description": "Entity represents azure resource in the system.", + "value": "AzureResource" + }, + { + "description": "Entity represents cloud application in the system.", + "value": "CloudApplication" + }, + { + "description": "Entity represents dns in the system.", + "value": "DNS" + }, + { + "description": "Entity represents file hash in the system.", + "value": "FileHash" + }, + { + "description": "Entity represents ip in the system.", + "value": "IP" + }, + { + "description": "Entity represents malware in the system.", + "value": "Malware" + }, + { + "description": "Entity represents process in the system.", + "value": "Process" + }, + { + "description": "Entity represents registry key in the system.", + "value": "RegistryKey" + }, + { + "description": "Entity represents registry value in the system.", + "value": "RegistryValue" + }, + { + "description": "Entity represents security group in the system.", + "value": "SecurityGroup" + }, + { + "description": "Entity represents url in the system.", + "value": "URL" + }, + { + "description": "Entity represents IoT device in the system.", + "value": "IoTDevice" + }, + { + "description": "Entity represents security alert in the system.", + "value": "SecurityAlert" + }, + { + "description": "Entity represents HuntingBookmark in the system.", + "value": "HuntingBookmark" + }, + { + "description": "Entity represents mail cluster in the system.", + "value": "MailCluster" + }, + { + "description": "Entity represents mail message in the system.", + "value": "MailMessage" + }, + { + "description": "Entity represents mailbox in the system.", + "value": "Mailbox" + }, + { + "description": "Entity represents submission mail in the system.", + "value": "SubmissionMail" + } + ] + } + }, + "EntityQueryKind": { + "description": "The kind of the entity query", + "enum": [ + "Expansion", + "Insight", + "Activity" + ], + "type": "string", + "x-ms-enum": { + "modelAsString": true, + "name": "EntityQueryKind", + "values": [ + { + "value": "Expansion" + }, + { + "value": "Insight" + }, + { + "value": "Activity" + } + ] + } + } + }, + "parameters": {} +} diff --git a/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityQueries.json b/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityQueries.json index bf9c8bd66409..80cd31cc4fc2 100644 --- a/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityQueries.json +++ b/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-03-01-preview/EntityQueries.json @@ -239,147 +239,6 @@ } }, "definitions": { - "EntityInnerType": { - "description": "The type of the entity", - "enum": [ - "Account", - "Host", - "File", - "AzureResource", - "CloudApplication", - "DNS", - "FileHash", - "IP", - "Malware", - "Process", - "RegistryKey", - "RegistryValue", - "SecurityGroup", - "URL", - "IoTDevice", - "SecurityAlert", - "HuntingBookmark", - "MailCluster", - "MailMessage", - "Mailbox", - "SubmissionMail" - ], - "type": "string", - "x-ms-enum": { - "modelAsString": true, - "name": "EntityType", - "values": [ - { - "description": "Entity represents account in the system.", - "value": "Account" - }, - { - "description": "Entity represents host in the system.", - "value": "Host" - }, - { - "description": "Entity represents file in the system.", - "value": "File" - }, - { - "description": "Entity represents azure resource in the system.", - "value": "AzureResource" - }, - { - "description": "Entity represents cloud application in the system.", - "value": "CloudApplication" - }, - { - "description": "Entity represents dns in the system.", - "value": "DNS" - }, - { - "description": "Entity represents file hash in the system.", - "value": "FileHash" - }, - { - "description": "Entity represents ip in the system.", - "value": "IP" - }, - { - "description": "Entity represents malware in the system.", - "value": "Malware" - }, - { - "description": "Entity represents process in the system.", - "value": "Process" - }, - { - "description": "Entity represents registry key in the system.", - "value": "RegistryKey" - }, - { - "description": "Entity represents registry value in the system.", - "value": "RegistryValue" - }, - { - "description": "Entity represents security group in the system.", - "value": "SecurityGroup" - }, - { - "description": "Entity represents url in the system.", - "value": "URL" - }, - { - "description": "Entity represents IoT device in the system.", - "value": "IoTDevice" - }, - { - "description": "Entity represents security alert in the system.", - "value": "SecurityAlert" - }, - { - "description": "Entity represents HuntingBookmark in the system.", - "value": "HuntingBookmark" - }, - { - "description": "Entity represents mail cluster in the system.", - "value": "MailCluster" - }, - { - "description": "Entity represents mail message in the system.", - "value": "MailMessage" - }, - { - "description": "Entity represents mailbox in the system.", - "value": "Mailbox" - }, - { - "description": "Entity represents submission mail in the system.", - "value": "SubmissionMail" - } - ] - } - }, - "EntityQueryKind": { - "description": "The kind of the entity query", - "enum": [ - "Expansion", - "Insight", - "Activity" - ], - "type": "string", - "x-ms-enum": { - "modelAsString": true, - "name": "EntityQueryKind", - "values": [ - { - "value": "Expansion" - }, - { - "value": "Insight" - }, - { - "value": "Activity" - } - ] - } - }, "CustomEntityQueryKind": { "description": "The kind of the entity query that supports put request.", "enum": [ @@ -426,7 +285,7 @@ "discriminator": "kind", "properties": { "kind": { - "$ref": "#/definitions/EntityQueryKind", + "$ref": "EntityDefinitions.json#/definitions/EntityQueryKind", "description": "the entity query kind" } }, @@ -487,7 +346,7 @@ "type": "string" }, "inputEntityType": { - "$ref": "#/definitions/EntityInnerType", + "$ref": "EntityDefinitions.json#/definitions/EntityInnerType", "description": "The type of the query's source entity" }, "inputFields": { @@ -501,7 +360,7 @@ "outputEntityTypes": { "description": "List of the desired output types to be constructed from the result", "items": { - "$ref": "#/definitions/EntityInnerType", + "$ref": "EntityDefinitions.json#/definitions/EntityInnerType", "description": "output entity type" }, "type": "array" @@ -573,7 +432,7 @@ "type": "object" }, "inputEntityType": { - "$ref": "#/definitions/EntityInnerType", + "$ref": "EntityDefinitions.json#/definitions/EntityInnerType", "description": "The type of the query's source entity" }, "requiredInputFieldsSets": {