diff --git a/oas_docs/bundle.json b/oas_docs/bundle.json index 1bf61ba293cb7..fd2a7bbe22de0 100644 --- a/oas_docs/bundle.json +++ b/oas_docs/bundle.json @@ -5626,63 +5626,6 @@ ] } }, - "/api/fleet/agent-status": { - "get": { - "operationId": "get-fleet-agent-status-2", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "in": "query", - "name": "policyId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "policyIds", - "required": false, - "schema": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "string" - } - ] - } - }, - { - "in": "query", - "name": "kuery", - "required": false, - "schema": { - "deprecated": true, - "type": "string" - } - } - ], - "responses": {}, - "summary": "", - "tags": [] - } - }, "/api/fleet/agent_download_sources": { "get": { "description": "List agent binary download sources", @@ -12547,7 +12490,6 @@ "name": "kuery", "required": false, "schema": { - "deprecated": true, "type": "string" } } @@ -12586,10 +12528,6 @@ "other": { "type": "number" }, - "total": { - "deprecated": true, - "type": "number" - }, "unenrolled": { "type": "number" }, @@ -12599,7 +12537,6 @@ }, "required": [ "events", - "total", "online", "error", "offline", @@ -13263,394 +13200,6 @@ }, "type": "array" }, - "list": { - "deprecated": true, - "items": { - "additionalProperties": false, - "properties": { - "access_api_key": { - "type": "string" - }, - "access_api_key_id": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "agent": { - "additionalProperties": true, - "properties": { - "id": { - "type": "string" - }, - "version": { - "type": "string" - } - }, - "required": [ - "id", - "version" - ], - "type": "object" - }, - "components": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "status": { - "enum": [ - "STARTING", - "CONFIGURING", - "HEALTHY", - "DEGRADED", - "FAILED", - "STOPPING", - "STOPPED" - ], - "type": "string" - }, - "type": { - "type": "string" - }, - "units": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "payload": { - "additionalProperties": {}, - "type": "object" - }, - "status": { - "enum": [ - "STARTING", - "CONFIGURING", - "HEALTHY", - "DEGRADED", - "FAILED", - "STOPPING", - "STOPPED" - ], - "type": "string" - }, - "type": { - "enum": [ - "input", - "output" - ], - "type": "string" - } - }, - "required": [ - "id", - "type", - "status", - "message" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "id", - "type", - "status", - "message" - ], - "type": "object" - }, - "type": "array" - }, - "default_api_key": { - "type": "string" - }, - "default_api_key_history": { - "items": { - "additionalProperties": false, - "deprecated": true, - "properties": { - "id": { - "type": "string" - }, - "retired_at": { - "type": "string" - } - }, - "required": [ - "id", - "retired_at" - ], - "type": "object" - }, - "type": "array" - }, - "default_api_key_id": { - "type": "string" - }, - "enrolled_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "last_checkin": { - "type": "string" - }, - "last_checkin_message": { - "type": "string" - }, - "last_checkin_status": { - "enum": [ - "error", - "online", - "degraded", - "updating", - "starting" - ], - "type": "string" - }, - "local_metadata": { - "additionalProperties": {}, - "type": "object" - }, - "metrics": { - "additionalProperties": false, - "properties": { - "cpu_avg": { - "type": "number" - }, - "memory_size_byte_avg": { - "type": "number" - } - }, - "type": "object" - }, - "namespaces": { - "items": { - "type": "string" - }, - "type": "array" - }, - "outputs": { - "additionalProperties": { - "additionalProperties": false, - "properties": { - "api_key_id": { - "type": "string" - }, - "to_retire_api_key_ids": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "retired_at": { - "type": "string" - } - }, - "required": [ - "id", - "retired_at" - ], - "type": "object" - }, - "type": "array" - }, - "type": { - "type": "string" - } - }, - "required": [ - "api_key_id", - "type" - ], - "type": "object" - }, - "type": "object" - }, - "packages": { - "items": { - "type": "string" - }, - "type": "array" - }, - "policy_id": { - "type": "string" - }, - "policy_revision": { - "nullable": true, - "type": "number" - }, - "sort": { - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "enum": [], - "nullable": true - } - ] - }, - "type": "array" - }, - "status": { - "enum": [ - "offline", - "error", - "online", - "inactive", - "enrolling", - "unenrolling", - "unenrolled", - "updating", - "degraded" - ], - "type": "string" - }, - "tags": { - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "PERMANENT", - "EPHEMERAL", - "TEMPORARY" - ], - "type": "string" - }, - "unenrolled_at": { - "type": "string" - }, - "unenrollment_started_at": { - "type": "string" - }, - "unhealthy_reason": { - "items": { - "enum": [ - "input", - "output", - "other" - ], - "type": "string" - }, - "nullable": true, - "type": "array" - }, - "upgrade_details": { - "additionalProperties": false, - "properties": { - "action_id": { - "type": "string" - }, - "metadata": { - "additionalProperties": false, - "properties": { - "download_percent": { - "type": "number" - }, - "download_rate": { - "type": "number" - }, - "error_msg": { - "type": "string" - }, - "failed_state": { - "enum": [ - "UPG_REQUESTED", - "UPG_SCHEDULED", - "UPG_DOWNLOADING", - "UPG_EXTRACTING", - "UPG_REPLACING", - "UPG_RESTARTING", - "UPG_FAILED", - "UPG_WATCHING", - "UPG_ROLLBACK" - ], - "type": "string" - }, - "retry_error_msg": { - "type": "string" - }, - "retry_until": { - "type": "string" - }, - "scheduled_at": { - "type": "string" - } - }, - "type": "object" - }, - "state": { - "enum": [ - "UPG_REQUESTED", - "UPG_SCHEDULED", - "UPG_DOWNLOADING", - "UPG_EXTRACTING", - "UPG_REPLACING", - "UPG_RESTARTING", - "UPG_FAILED", - "UPG_WATCHING", - "UPG_ROLLBACK" - ], - "type": "string" - }, - "target_version": { - "type": "string" - } - }, - "required": [ - "target_version", - "action_id", - "state" - ], - "type": "object" - }, - "upgrade_started_at": { - "nullable": true, - "type": "string" - }, - "upgraded_at": { - "nullable": true, - "type": "string" - }, - "user_provided_metadata": { - "additionalProperties": {}, - "type": "object" - } - }, - "required": [ - "id", - "packages", - "type", - "active", - "enrolled_at", - "local_metadata" - ], - "type": "object" - }, - "type": "array" - }, "page": { "type": "number" }, @@ -16695,62 +16244,6 @@ "tags": [ "Elastic Agent actions" ] - }, - "put": { - "operationId": "put-fleet-agents-agentid-reassign", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "description": "A required header to protect against CSRF attacks", - "in": "header", - "name": "kbn-xsrf", - "required": true, - "schema": { - "example": "true", - "type": "string" - } - }, - { - "in": "path", - "name": "agentId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json; Elastic-Api-Version=2023-10-31": { - "schema": { - "additionalProperties": false, - "properties": { - "policy_id": { - "type": "string" - } - }, - "required": [ - "policy_id" - ], - "type": "object" - } - } - } - }, - "responses": {}, - "summary": "", - "tags": [] } }, "/api/fleet/agents/{agentId}/request_diagnostics": { @@ -39679,39 +39172,6 @@ ] } }, - "/api/fleet/service-tokens": { - "post": { - "description": "Create a service token", - "operationId": "post-fleet-service-tokens-2", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "description": "A required header to protect against CSRF attacks", - "in": "header", - "name": "kbn-xsrf", - "required": true, - "schema": { - "example": "true", - "type": "string" - } - } - ], - "responses": {}, - "summary": "", - "tags": [] - } - }, "/api/fleet/service_tokens": { "post": { "description": "Create a service token", diff --git a/oas_docs/bundle.serverless.json b/oas_docs/bundle.serverless.json index fedad1196676d..f171dadde991a 100644 --- a/oas_docs/bundle.serverless.json +++ b/oas_docs/bundle.serverless.json @@ -5626,63 +5626,6 @@ ] } }, - "/api/fleet/agent-status": { - "get": { - "operationId": "get-fleet-agent-status-2", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "in": "query", - "name": "policyId", - "required": false, - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "policyIds", - "required": false, - "schema": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "string" - } - ] - } - }, - { - "in": "query", - "name": "kuery", - "required": false, - "schema": { - "deprecated": true, - "type": "string" - } - } - ], - "responses": {}, - "summary": "", - "tags": [] - } - }, "/api/fleet/agent_download_sources": { "get": { "description": "List agent binary download sources", @@ -12547,7 +12490,6 @@ "name": "kuery", "required": false, "schema": { - "deprecated": true, "type": "string" } } @@ -12586,10 +12528,6 @@ "other": { "type": "number" }, - "total": { - "deprecated": true, - "type": "number" - }, "unenrolled": { "type": "number" }, @@ -12599,7 +12537,6 @@ }, "required": [ "events", - "total", "online", "error", "offline", @@ -13263,394 +13200,6 @@ }, "type": "array" }, - "list": { - "deprecated": true, - "items": { - "additionalProperties": false, - "properties": { - "access_api_key": { - "type": "string" - }, - "access_api_key_id": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "agent": { - "additionalProperties": true, - "properties": { - "id": { - "type": "string" - }, - "version": { - "type": "string" - } - }, - "required": [ - "id", - "version" - ], - "type": "object" - }, - "components": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "status": { - "enum": [ - "STARTING", - "CONFIGURING", - "HEALTHY", - "DEGRADED", - "FAILED", - "STOPPING", - "STOPPED" - ], - "type": "string" - }, - "type": { - "type": "string" - }, - "units": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "message": { - "type": "string" - }, - "payload": { - "additionalProperties": {}, - "type": "object" - }, - "status": { - "enum": [ - "STARTING", - "CONFIGURING", - "HEALTHY", - "DEGRADED", - "FAILED", - "STOPPING", - "STOPPED" - ], - "type": "string" - }, - "type": { - "enum": [ - "input", - "output" - ], - "type": "string" - } - }, - "required": [ - "id", - "type", - "status", - "message" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "id", - "type", - "status", - "message" - ], - "type": "object" - }, - "type": "array" - }, - "default_api_key": { - "type": "string" - }, - "default_api_key_history": { - "items": { - "additionalProperties": false, - "deprecated": true, - "properties": { - "id": { - "type": "string" - }, - "retired_at": { - "type": "string" - } - }, - "required": [ - "id", - "retired_at" - ], - "type": "object" - }, - "type": "array" - }, - "default_api_key_id": { - "type": "string" - }, - "enrolled_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "last_checkin": { - "type": "string" - }, - "last_checkin_message": { - "type": "string" - }, - "last_checkin_status": { - "enum": [ - "error", - "online", - "degraded", - "updating", - "starting" - ], - "type": "string" - }, - "local_metadata": { - "additionalProperties": {}, - "type": "object" - }, - "metrics": { - "additionalProperties": false, - "properties": { - "cpu_avg": { - "type": "number" - }, - "memory_size_byte_avg": { - "type": "number" - } - }, - "type": "object" - }, - "namespaces": { - "items": { - "type": "string" - }, - "type": "array" - }, - "outputs": { - "additionalProperties": { - "additionalProperties": false, - "properties": { - "api_key_id": { - "type": "string" - }, - "to_retire_api_key_ids": { - "items": { - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "retired_at": { - "type": "string" - } - }, - "required": [ - "id", - "retired_at" - ], - "type": "object" - }, - "type": "array" - }, - "type": { - "type": "string" - } - }, - "required": [ - "api_key_id", - "type" - ], - "type": "object" - }, - "type": "object" - }, - "packages": { - "items": { - "type": "string" - }, - "type": "array" - }, - "policy_id": { - "type": "string" - }, - "policy_revision": { - "nullable": true, - "type": "number" - }, - "sort": { - "items": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "enum": [], - "nullable": true - } - ] - }, - "type": "array" - }, - "status": { - "enum": [ - "offline", - "error", - "online", - "inactive", - "enrolling", - "unenrolling", - "unenrolled", - "updating", - "degraded" - ], - "type": "string" - }, - "tags": { - "items": { - "type": "string" - }, - "type": "array" - }, - "type": { - "enum": [ - "PERMANENT", - "EPHEMERAL", - "TEMPORARY" - ], - "type": "string" - }, - "unenrolled_at": { - "type": "string" - }, - "unenrollment_started_at": { - "type": "string" - }, - "unhealthy_reason": { - "items": { - "enum": [ - "input", - "output", - "other" - ], - "type": "string" - }, - "nullable": true, - "type": "array" - }, - "upgrade_details": { - "additionalProperties": false, - "properties": { - "action_id": { - "type": "string" - }, - "metadata": { - "additionalProperties": false, - "properties": { - "download_percent": { - "type": "number" - }, - "download_rate": { - "type": "number" - }, - "error_msg": { - "type": "string" - }, - "failed_state": { - "enum": [ - "UPG_REQUESTED", - "UPG_SCHEDULED", - "UPG_DOWNLOADING", - "UPG_EXTRACTING", - "UPG_REPLACING", - "UPG_RESTARTING", - "UPG_FAILED", - "UPG_WATCHING", - "UPG_ROLLBACK" - ], - "type": "string" - }, - "retry_error_msg": { - "type": "string" - }, - "retry_until": { - "type": "string" - }, - "scheduled_at": { - "type": "string" - } - }, - "type": "object" - }, - "state": { - "enum": [ - "UPG_REQUESTED", - "UPG_SCHEDULED", - "UPG_DOWNLOADING", - "UPG_EXTRACTING", - "UPG_REPLACING", - "UPG_RESTARTING", - "UPG_FAILED", - "UPG_WATCHING", - "UPG_ROLLBACK" - ], - "type": "string" - }, - "target_version": { - "type": "string" - } - }, - "required": [ - "target_version", - "action_id", - "state" - ], - "type": "object" - }, - "upgrade_started_at": { - "nullable": true, - "type": "string" - }, - "upgraded_at": { - "nullable": true, - "type": "string" - }, - "user_provided_metadata": { - "additionalProperties": {}, - "type": "object" - } - }, - "required": [ - "id", - "packages", - "type", - "active", - "enrolled_at", - "local_metadata" - ], - "type": "object" - }, - "type": "array" - }, "page": { "type": "number" }, @@ -16695,62 +16244,6 @@ "tags": [ "Elastic Agent actions" ] - }, - "put": { - "operationId": "put-fleet-agents-agentid-reassign", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "description": "A required header to protect against CSRF attacks", - "in": "header", - "name": "kbn-xsrf", - "required": true, - "schema": { - "example": "true", - "type": "string" - } - }, - { - "in": "path", - "name": "agentId", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json; Elastic-Api-Version=2023-10-31": { - "schema": { - "additionalProperties": false, - "properties": { - "policy_id": { - "type": "string" - } - }, - "required": [ - "policy_id" - ], - "type": "object" - } - } - } - }, - "responses": {}, - "summary": "", - "tags": [] } }, "/api/fleet/agents/{agentId}/request_diagnostics": { @@ -39679,39 +39172,6 @@ ] } }, - "/api/fleet/service-tokens": { - "post": { - "description": "Create a service token", - "operationId": "post-fleet-service-tokens-2", - "parameters": [ - { - "description": "The version of the API to use", - "in": "header", - "name": "elastic-api-version", - "schema": { - "default": "2023-10-31", - "enum": [ - "2023-10-31" - ], - "type": "string" - } - }, - { - "description": "A required header to protect against CSRF attacks", - "in": "header", - "name": "kbn-xsrf", - "required": true, - "schema": { - "example": "true", - "type": "string" - } - } - ], - "responses": {}, - "summary": "", - "tags": [] - } - }, "/api/fleet/service_tokens": { "post": { "description": "Create a service token", diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index 1e7b41ea2c1af..afb7d8bbd5f4d 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -14811,7 +14811,6 @@ paths: name: kuery required: false schema: - deprecated: true type: string responses: '200': @@ -14841,16 +14840,12 @@ paths: type: number other: type: number - total: - deprecated: true - type: number unenrolled: type: number updating: type: number required: - events - - total - online - error - offline @@ -14954,41 +14949,6 @@ paths: summary: '' tags: - Elastic Agents - /api/fleet/agent-status: - get: - operationId: get-fleet-agent-status-2 - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - in: query - name: policyId - required: false - schema: - type: string - - in: query - name: policyIds - required: false - schema: - anyOf: - - items: - type: string - type: array - - type: string - - in: query - name: kuery - required: false - schema: - deprecated: true - type: string - responses: {} - summary: '' - tags: [] /api/fleet/agents: get: description: List agents @@ -15342,285 +15302,6 @@ paths: - enrolled_at - local_metadata type: array - list: - deprecated: true - items: - additionalProperties: false - type: object - properties: - access_api_key: - type: string - access_api_key_id: - type: string - active: - type: boolean - agent: - additionalProperties: true - type: object - properties: - id: - type: string - version: - type: string - required: - - id - - version - components: - items: - additionalProperties: false - type: object - properties: - id: - type: string - message: - type: string - status: - enum: - - STARTING - - CONFIGURING - - HEALTHY - - DEGRADED - - FAILED - - STOPPING - - STOPPED - type: string - type: - type: string - units: - items: - additionalProperties: false - type: object - properties: - id: - type: string - message: - type: string - payload: - additionalProperties: {} - type: object - status: - enum: - - STARTING - - CONFIGURING - - HEALTHY - - DEGRADED - - FAILED - - STOPPING - - STOPPED - type: string - type: - enum: - - input - - output - type: string - required: - - id - - type - - status - - message - type: array - required: - - id - - type - - status - - message - type: array - default_api_key: - type: string - default_api_key_history: - items: - additionalProperties: false - deprecated: true - type: object - properties: - id: - type: string - retired_at: - type: string - required: - - id - - retired_at - type: array - default_api_key_id: - type: string - enrolled_at: - type: string - id: - type: string - last_checkin: - type: string - last_checkin_message: - type: string - last_checkin_status: - enum: - - error - - online - - degraded - - updating - - starting - type: string - local_metadata: - additionalProperties: {} - type: object - metrics: - additionalProperties: false - type: object - properties: - cpu_avg: - type: number - memory_size_byte_avg: - type: number - namespaces: - items: - type: string - type: array - outputs: - additionalProperties: - additionalProperties: false - type: object - properties: - api_key_id: - type: string - to_retire_api_key_ids: - items: - additionalProperties: false - type: object - properties: - id: - type: string - retired_at: - type: string - required: - - id - - retired_at - type: array - type: - type: string - required: - - api_key_id - - type - type: object - packages: - items: - type: string - type: array - policy_id: - type: string - policy_revision: - nullable: true - type: number - sort: - items: - anyOf: - - type: number - - type: string - - enum: [] - nullable: true - type: array - status: - enum: - - offline - - error - - online - - inactive - - enrolling - - unenrolling - - unenrolled - - updating - - degraded - type: string - tags: - items: - type: string - type: array - type: - enum: - - PERMANENT - - EPHEMERAL - - TEMPORARY - type: string - unenrolled_at: - type: string - unenrollment_started_at: - type: string - unhealthy_reason: - items: - enum: - - input - - output - - other - type: string - nullable: true - type: array - upgrade_details: - additionalProperties: false - type: object - properties: - action_id: - type: string - metadata: - additionalProperties: false - type: object - properties: - download_percent: - type: number - download_rate: - type: number - error_msg: - type: string - failed_state: - enum: - - UPG_REQUESTED - - UPG_SCHEDULED - - UPG_DOWNLOADING - - UPG_EXTRACTING - - UPG_REPLACING - - UPG_RESTARTING - - UPG_FAILED - - UPG_WATCHING - - UPG_ROLLBACK - type: string - retry_error_msg: - type: string - retry_until: - type: string - scheduled_at: - type: string - state: - enum: - - UPG_REQUESTED - - UPG_SCHEDULED - - UPG_DOWNLOADING - - UPG_EXTRACTING - - UPG_REPLACING - - UPG_RESTARTING - - UPG_FAILED - - UPG_WATCHING - - UPG_ROLLBACK - type: string - target_version: - type: string - required: - - target_version - - action_id - - state - upgrade_started_at: - nullable: true - type: string - upgraded_at: - nullable: true - type: string - user_provided_metadata: - additionalProperties: {} - type: object - required: - - id - - packages - - type - - active - - enrolled_at - - local_metadata - type: array page: type: number perPage: @@ -16657,43 +16338,6 @@ paths: summary: '' tags: - Elastic Agent actions - put: - operationId: put-fleet-agents-agentid-reassign - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - description: A required header to protect against CSRF attacks - in: header - name: kbn-xsrf - required: true - schema: - example: 'true' - type: string - - in: path - name: agentId - required: true - schema: - type: string - requestBody: - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - additionalProperties: false - type: object - properties: - policy_id: - type: string - required: - - policy_id - responses: {} - summary: '' - tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: description: Request agent diagnostics @@ -33408,29 +33052,6 @@ paths: summary: '' tags: - Fleet service tokens - /api/fleet/service-tokens: - post: - description: Create a service token - operationId: post-fleet-service-tokens-2 - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - description: A required header to protect against CSRF attacks - in: header - name: kbn-xsrf - required: true - schema: - example: 'true' - type: string - responses: {} - summary: '' - tags: [] /api/fleet/settings: get: description: Get settings diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 237974a87bbb2..5bbc65ad80bc4 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -18244,7 +18244,6 @@ paths: name: kuery required: false schema: - deprecated: true type: string responses: '200': @@ -18274,16 +18273,12 @@ paths: type: number other: type: number - total: - deprecated: true - type: number unenrolled: type: number updating: type: number required: - events - - total - online - error - offline @@ -18387,41 +18382,6 @@ paths: summary: '' tags: - Elastic Agents - /api/fleet/agent-status: - get: - operationId: get-fleet-agent-status-2 - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - in: query - name: policyId - required: false - schema: - type: string - - in: query - name: policyIds - required: false - schema: - anyOf: - - items: - type: string - type: array - - type: string - - in: query - name: kuery - required: false - schema: - deprecated: true - type: string - responses: {} - summary: '' - tags: [] /api/fleet/agents: get: description: List agents @@ -18775,285 +18735,6 @@ paths: - enrolled_at - local_metadata type: array - list: - deprecated: true - items: - additionalProperties: false - type: object - properties: - access_api_key: - type: string - access_api_key_id: - type: string - active: - type: boolean - agent: - additionalProperties: true - type: object - properties: - id: - type: string - version: - type: string - required: - - id - - version - components: - items: - additionalProperties: false - type: object - properties: - id: - type: string - message: - type: string - status: - enum: - - STARTING - - CONFIGURING - - HEALTHY - - DEGRADED - - FAILED - - STOPPING - - STOPPED - type: string - type: - type: string - units: - items: - additionalProperties: false - type: object - properties: - id: - type: string - message: - type: string - payload: - additionalProperties: {} - type: object - status: - enum: - - STARTING - - CONFIGURING - - HEALTHY - - DEGRADED - - FAILED - - STOPPING - - STOPPED - type: string - type: - enum: - - input - - output - type: string - required: - - id - - type - - status - - message - type: array - required: - - id - - type - - status - - message - type: array - default_api_key: - type: string - default_api_key_history: - items: - additionalProperties: false - deprecated: true - type: object - properties: - id: - type: string - retired_at: - type: string - required: - - id - - retired_at - type: array - default_api_key_id: - type: string - enrolled_at: - type: string - id: - type: string - last_checkin: - type: string - last_checkin_message: - type: string - last_checkin_status: - enum: - - error - - online - - degraded - - updating - - starting - type: string - local_metadata: - additionalProperties: {} - type: object - metrics: - additionalProperties: false - type: object - properties: - cpu_avg: - type: number - memory_size_byte_avg: - type: number - namespaces: - items: - type: string - type: array - outputs: - additionalProperties: - additionalProperties: false - type: object - properties: - api_key_id: - type: string - to_retire_api_key_ids: - items: - additionalProperties: false - type: object - properties: - id: - type: string - retired_at: - type: string - required: - - id - - retired_at - type: array - type: - type: string - required: - - api_key_id - - type - type: object - packages: - items: - type: string - type: array - policy_id: - type: string - policy_revision: - nullable: true - type: number - sort: - items: - anyOf: - - type: number - - type: string - - enum: [] - nullable: true - type: array - status: - enum: - - offline - - error - - online - - inactive - - enrolling - - unenrolling - - unenrolled - - updating - - degraded - type: string - tags: - items: - type: string - type: array - type: - enum: - - PERMANENT - - EPHEMERAL - - TEMPORARY - type: string - unenrolled_at: - type: string - unenrollment_started_at: - type: string - unhealthy_reason: - items: - enum: - - input - - output - - other - type: string - nullable: true - type: array - upgrade_details: - additionalProperties: false - type: object - properties: - action_id: - type: string - metadata: - additionalProperties: false - type: object - properties: - download_percent: - type: number - download_rate: - type: number - error_msg: - type: string - failed_state: - enum: - - UPG_REQUESTED - - UPG_SCHEDULED - - UPG_DOWNLOADING - - UPG_EXTRACTING - - UPG_REPLACING - - UPG_RESTARTING - - UPG_FAILED - - UPG_WATCHING - - UPG_ROLLBACK - type: string - retry_error_msg: - type: string - retry_until: - type: string - scheduled_at: - type: string - state: - enum: - - UPG_REQUESTED - - UPG_SCHEDULED - - UPG_DOWNLOADING - - UPG_EXTRACTING - - UPG_REPLACING - - UPG_RESTARTING - - UPG_FAILED - - UPG_WATCHING - - UPG_ROLLBACK - type: string - target_version: - type: string - required: - - target_version - - action_id - - state - upgrade_started_at: - nullable: true - type: string - upgraded_at: - nullable: true - type: string - user_provided_metadata: - additionalProperties: {} - type: object - required: - - id - - packages - - type - - active - - enrolled_at - - local_metadata - type: array page: type: number perPage: @@ -20090,43 +19771,6 @@ paths: summary: '' tags: - Elastic Agent actions - put: - operationId: put-fleet-agents-agentid-reassign - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - description: A required header to protect against CSRF attacks - in: header - name: kbn-xsrf - required: true - schema: - example: 'true' - type: string - - in: path - name: agentId - required: true - schema: - type: string - requestBody: - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - additionalProperties: false - type: object - properties: - policy_id: - type: string - required: - - policy_id - responses: {} - summary: '' - tags: [] /api/fleet/agents/{agentId}/request_diagnostics: post: description: Request agent diagnostics @@ -36841,29 +36485,6 @@ paths: summary: '' tags: - Fleet service tokens - /api/fleet/service-tokens: - post: - description: Create a service token - operationId: post-fleet-service-tokens-2 - parameters: - - description: The version of the API to use - in: header - name: elastic-api-version - schema: - default: '2023-10-31' - enum: - - '2023-10-31' - type: string - - description: A required header to protect against CSRF attacks - in: header - name: kbn-xsrf - required: true - schema: - example: 'true' - type: string - responses: {} - summary: '' - tags: [] /api/fleet/settings: get: description: Get settings diff --git a/packages/kbn-alerts-as-data-utils/src/schemas/generated/observability_uptime_schema.ts b/packages/kbn-alerts-as-data-utils/src/schemas/generated/observability_uptime_schema.ts index 8770b70402d08..bf37ffc1ddb9c 100644 --- a/packages/kbn-alerts-as-data-utils/src/schemas/generated/observability_uptime_schema.ts +++ b/packages/kbn-alerts-as-data-utils/src/schemas/generated/observability_uptime_schema.ts @@ -77,6 +77,7 @@ const ObservabilityUptimeAlertOptional = rt.partial({ 'anomaly.start': schemaDate, configId: schemaString, 'error.message': schemaString, + 'error.stack_trace': schemaString, 'host.name': schemaString, 'kibana.alert.context': schemaUnknown, 'kibana.alert.evaluation.threshold': schemaStringOrNumber, diff --git a/packages/kbn-es-types/src/search.ts b/packages/kbn-es-types/src/search.ts index 4c780fb2a2986..87f9dd15517c9 100644 --- a/packages/kbn-es-types/src/search.ts +++ b/packages/kbn-es-types/src/search.ts @@ -682,6 +682,7 @@ export interface ESQLSearchResponse { all_columns?: ESQLColumn[]; values: ESQLRow[]; took?: number; + _clusters?: estypes.ClusterStatistics; } export interface ESQLSearchParams { diff --git a/packages/kbn-search-response-warnings/src/extract_warnings.test.ts b/packages/kbn-search-response-warnings/src/extract_warnings.test.ts index cedf0546ae3a4..c5a1352c3d0f9 100644 --- a/packages/kbn-search-response-warnings/src/extract_warnings.test.ts +++ b/packages/kbn-search-response-warnings/src/extract_warnings.test.ts @@ -9,6 +9,7 @@ import { estypes } from '@elastic/elasticsearch'; import type { Start as InspectorStartContract } from '@kbn/inspector-plugin/public'; +import type { ESQLSearchResponse } from '@kbn/es-types'; import type { RequestAdapter } from '@kbn/inspector-plugin/common/adapters/request'; import { extractWarnings } from './extract_warnings'; @@ -108,6 +109,22 @@ describe('extract search response warnings', () => { expect(warnings).toEqual([]); }); + + it('should not include warnings when there is no _clusters or _shards information', () => { + const warnings = extractWarnings( + { + took: 46, + all_columns: [{ name: 'field1', type: 'string' }], + columns: [{ name: 'field1', type: 'string' }], + values: [['value1']], + } as ESQLSearchResponse, + mockInspectorService, + mockRequestAdapter, + 'My request' + ); + + expect(warnings).toEqual([]); + }); }); describe('remote clusters', () => { diff --git a/packages/kbn-search-response-warnings/src/extract_warnings.ts b/packages/kbn-search-response-warnings/src/extract_warnings.ts index 7d53a954f7715..58e963c239b12 100644 --- a/packages/kbn-search-response-warnings/src/extract_warnings.ts +++ b/packages/kbn-search-response-warnings/src/extract_warnings.ts @@ -8,6 +8,7 @@ */ import { estypes } from '@elastic/elasticsearch'; +import type { ESQLSearchResponse } from '@kbn/es-types'; import type { Start as InspectorStartContract, RequestAdapter } from '@kbn/inspector-plugin/public'; import type { SearchResponseWarning } from './types'; @@ -15,7 +16,7 @@ import type { SearchResponseWarning } from './types'; * @internal */ export function extractWarnings( - rawResponse: estypes.SearchResponse, + rawResponse: estypes.SearchResponse | ESQLSearchResponse, inspectorService: InspectorStartContract, requestAdapter: RequestAdapter, requestName: string, @@ -23,11 +24,13 @@ export function extractWarnings( ): SearchResponseWarning[] { const warnings: SearchResponseWarning[] = []; + // ES|QL supports _clusters in case of CCS but doesnt support _shards and timed_out (yet) const isPartial = rawResponse._clusters ? rawResponse._clusters.partial > 0 || rawResponse._clusters.skipped > 0 || rawResponse._clusters.running > 0 - : rawResponse.timed_out || rawResponse._shards.failed > 0; + : ('timed_out' in rawResponse && rawResponse.timed_out) || + ('_shards' in rawResponse && rawResponse._shards.failed > 0); if (isPartial) { warnings.push({ type: 'incomplete', @@ -39,9 +42,10 @@ export function extractWarnings( status: 'partial', indices: '', took: rawResponse.took, - timed_out: rawResponse.timed_out, - _shards: rawResponse._shards, - failures: rawResponse._shards.failures, + timed_out: 'timed_out' in rawResponse && rawResponse.timed_out, + ...('_shards' in rawResponse + ? { _shards: rawResponse._shards, failures: rawResponse._shards.failures } + : {}), }, }, openInInspector: () => { diff --git a/packages/kbn-search-response-warnings/tsconfig.json b/packages/kbn-search-response-warnings/tsconfig.json index 6823ef5abf8a1..1f87892403a61 100644 --- a/packages/kbn-search-response-warnings/tsconfig.json +++ b/packages/kbn-search-response-warnings/tsconfig.json @@ -10,6 +10,7 @@ "@kbn/core", "@kbn/react-kibana-mount", "@kbn/core-i18n-browser", + "@kbn/es-types", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/alerting/server/integration_tests/__snapshots__/alert_as_data_fields.test.ts.snap b/x-pack/plugins/alerting/server/integration_tests/__snapshots__/alert_as_data_fields.test.ts.snap index 8c65843f2d844..0513842a6126b 100644 --- a/x-pack/plugins/alerting/server/integration_tests/__snapshots__/alert_as_data_fields.test.ts.snap +++ b/x-pack/plugins/alerting/server/integration_tests/__snapshots__/alert_as_data_fields.test.ts.snap @@ -9851,6 +9851,10 @@ Object { "required": false, "type": "text", }, + "error.stack_trace": Object { + "required": false, + "type": "wildcard", + }, "host.name": Object { "required": false, "type": "keyword", @@ -9991,6 +9995,10 @@ Object { "required": false, "type": "text", }, + "error.stack_trace": Object { + "required": false, + "type": "wildcard", + }, "host.name": Object { "required": false, "type": "keyword", @@ -10131,6 +10139,10 @@ Object { "required": false, "type": "text", }, + "error.stack_trace": Object { + "required": false, + "type": "wildcard", + }, "host.name": Object { "required": false, "type": "keyword", @@ -10271,6 +10283,10 @@ Object { "required": false, "type": "text", }, + "error.stack_trace": Object { + "required": false, + "type": "wildcard", + }, "host.name": Object { "required": false, "type": "keyword", @@ -10417,6 +10433,10 @@ Object { "required": false, "type": "text", }, + "error.stack_trace": Object { + "required": false, + "type": "wildcard", + }, "host.name": Object { "required": false, "type": "keyword", diff --git a/x-pack/plugins/cloud_defend/server/routes/policies/policies.ts b/x-pack/plugins/cloud_defend/server/routes/policies/policies.ts index 71d7f17ca612e..ad40dcf3b693f 100644 --- a/x-pack/plugins/cloud_defend/server/routes/policies/policies.ts +++ b/x-pack/plugins/cloud_defend/server/routes/policies/policies.ts @@ -42,7 +42,7 @@ const createPolicies = ( const agentPolicyStatus = { id: agentPolicy.id, name: agentPolicy.name, - agents: agentStatusByAgentPolicyId[agentPolicy.id]?.total, + agents: agentStatusByAgentPolicyId[agentPolicy.id]?.active, }; return { package_policy: cloudDefendPackage, diff --git a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts index 90e11734d72c6..86eb6ba963402 100644 --- a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts +++ b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts @@ -214,7 +214,7 @@ export const getBenchmarkApplicableTo = (benchmarkId: BenchmarksCisId) => { }; export const getCloudProviderNameFromAbbreviation = (cloudProvider: string) => { - switch (cloudProvider) { + switch (cloudProvider.toLowerCase()) { case 'azure': return CLOUD_PROVIDER_NAMES.AZURE; case 'aws': diff --git a/x-pack/plugins/cloud_security_posture/public/common/constants.ts b/x-pack/plugins/cloud_security_posture/public/common/constants.ts index 50d191cf07167..fab73eb153e69 100644 --- a/x-pack/plugins/cloud_security_posture/public/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/public/common/constants.ts @@ -256,3 +256,33 @@ export const VULNERABILITY_GROUPING_OPTIONS = { CLOUD_ACCOUNT_NAME: VULNERABILITY_FIELDS.CLOUD_ACCOUNT_NAME, CVE: VULNERABILITY_FIELDS.VULNERABILITY_ID, }; + +/* +The fields below are default columns of the Cloud Security Data Table that need to have keyword mapping. +The runtime mappings are used to prevent filtering out the data when any of these columns are sorted in the Data Table. +TODO: Remove the fields below once they are mapped as Keyword in the Third Party integrations, or remove +the fields from the runtime mappings if they are removed from the Data Table. +*/ +export const CDR_VULNERABILITY_DATA_TABLE_RUNTIME_MAPPING_FIELDS: string[] = [ + VULNERABILITY_FIELDS.VENDOR, +]; +export const CDR_MISCONFIGURATION_DATA_TABLE_RUNTIME_MAPPING_FIELDS: string[] = [ + 'rule.benchmark.rule_number', + 'rule.section', + 'resource.sub_type', +]; + +/* +The fields below are used to group the data in the Cloud Security Data Table. +The keys are the fields that are used to group the data, and the values are the fields that need to have keyword mapping +to prevent filtering out the data when grouping by the key field. +TODO: Remove the fields below once they are mapped as Keyword in the Third Party integrations, or remove +the fields from the runtime mappings if they are removed from the Data Table. +*/ +export const CDR_VULNERABILITY_GROUPING_RUNTIME_MAPPING_FIELDS: Record = { + [VULNERABILITY_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME]: [VULNERABILITY_FIELDS.CLOUD_PROVIDER], +}; +export const CDR_MISCONFIGURATION_GROUPING_RUNTIME_MAPPING_FIELDS: Record = { + [FINDINGS_GROUPING_OPTIONS.ORCHESTRATOR_CLUSTER_NAME]: ['orchestrator.cluster.name'], + [FINDINGS_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME]: ['cloud.account.name'], +}; diff --git a/x-pack/plugins/cloud_security_posture/public/components/cloud_provider_icon.tsx b/x-pack/plugins/cloud_security_posture/public/components/cloud_provider_icon.tsx index b6acdac0ee1b1..a022e38960894 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/cloud_provider_icon.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/cloud_provider_icon.tsx @@ -18,7 +18,7 @@ interface Props { } const getCloudProviderIcon = (cloudProvider: string) => { - switch (cloudProvider) { + switch (cloudProvider.toLowerCase()) { case 'azure': return 'logoAzure'; case 'aws': diff --git a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_grouped_findings.tsx b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_grouped_findings.tsx index 6d901a76a29c3..b98ff432a3c96 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_grouped_findings.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_grouped_findings.tsx @@ -52,9 +52,6 @@ export interface FindingsGroupingAggregation { resourceSubType?: { buckets?: GenericBuckets[]; }; - resourceType?: { - buckets?: GenericBuckets[]; - }; benchmarkName?: { buckets?: GenericBuckets[]; }; diff --git a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings.ts b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings.ts index 068eb3df1b10f..64353230211bc 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings.ts +++ b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings.ts @@ -22,6 +22,7 @@ import type { CspBenchmarkRulesStates } from '@kbn/cloud-security-posture-common import type { FindingsBaseEsQuery } from '@kbn/cloud-security-posture'; import { useGetCspBenchmarkRulesStatesApi } from '@kbn/cloud-security-posture/src/hooks/use_get_benchmark_rules_state_api'; import type { RuntimePrimitiveTypes } from '@kbn/data-views-plugin/common'; +import { CDR_MISCONFIGURATION_DATA_TABLE_RUNTIME_MAPPING_FIELDS } from '../../../common/constants'; import { useKibana } from '../../../common/hooks/use_kibana'; import { getAggregationCount, getFindingsCountAggQuery } from '../utils/utils'; @@ -41,17 +42,18 @@ interface FindingsAggs { } const getRuntimeMappingsFromSort = (sort: string[][]) => { - return sort.reduce((acc, [field]) => { - // TODO: Add proper type for all fields available in the field selector - const type: RuntimePrimitiveTypes = field === '@timestamp' ? 'date' : 'keyword'; + return sort + .filter(([field]) => CDR_MISCONFIGURATION_DATA_TABLE_RUNTIME_MAPPING_FIELDS.includes(field)) + .reduce((acc, [field]) => { + const type: RuntimePrimitiveTypes = 'keyword'; - return { - ...acc, - [field]: { - type, - }, - }; - }, {}); + return { + ...acc, + [field]: { + type, + }, + }; + }, {}); }; export const getFindingsQuery = ( diff --git a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings_grouping.tsx b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings_grouping.tsx index e009ee966fb96..45c5418ed5129 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings_grouping.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/configurations/latest_findings/use_latest_findings_grouping.tsx @@ -21,6 +21,7 @@ import { } from '@kbn/cloud-security-posture-common'; import { useGetCspBenchmarkRulesStatesApi } from '@kbn/cloud-security-posture/src/hooks/use_get_benchmark_rules_state_api'; import { + CDR_MISCONFIGURATION_GROUPING_RUNTIME_MAPPING_FIELDS, FINDINGS_GROUPING_OPTIONS, LOCAL_STORAGE_FINDINGS_GROUPING_KEY, } from '../../../common/constants'; @@ -90,7 +91,6 @@ const getAggregationsByGroupField = (field: string): NamedAggregation[] => { ...aggMetrics, getTermAggregation('resourceName', 'resource.id'), getTermAggregation('resourceSubType', 'resource.sub_type'), - getTermAggregation('resourceType', 'resource.type'), ]; case FINDINGS_GROUPING_OPTIONS.RULE_NAME: return [ @@ -122,62 +122,18 @@ const getAggregationsByGroupField = (field: string): NamedAggregation[] => { const getRuntimeMappingsByGroupField = ( field: string ): Record | undefined => { - switch (field) { - case FINDINGS_GROUPING_OPTIONS.RESOURCE_NAME: - return { - [FINDINGS_GROUPING_OPTIONS.RESOURCE_NAME]: { - type: 'keyword', - }, - 'resource.id': { - type: 'keyword', - }, - 'resource.sub_type': { - type: 'keyword', - }, - 'resource.type': { - type: 'keyword', - }, - }; - case FINDINGS_GROUPING_OPTIONS.RULE_NAME: - return { - [FINDINGS_GROUPING_OPTIONS.RULE_NAME]: { - type: 'keyword', - }, - 'rule.benchmark.version': { - type: 'keyword', - }, - }; - case FINDINGS_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME: - return { - [FINDINGS_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME]: { + if (CDR_MISCONFIGURATION_GROUPING_RUNTIME_MAPPING_FIELDS?.[field]) { + return CDR_MISCONFIGURATION_GROUPING_RUNTIME_MAPPING_FIELDS[field].reduce( + (acc, runtimeField) => ({ + ...acc, + [runtimeField]: { type: 'keyword', }, - 'rule.benchmark.name': { - type: 'keyword', - }, - 'rule.benchmark.id': { - type: 'keyword', - }, - }; - case FINDINGS_GROUPING_OPTIONS.ORCHESTRATOR_CLUSTER_NAME: - return { - [FINDINGS_GROUPING_OPTIONS.ORCHESTRATOR_CLUSTER_NAME]: { - type: 'keyword', - }, - 'rule.benchmark.name': { - type: 'keyword', - }, - 'rule.benchmark.id': { - type: 'keyword', - }, - }; - default: - return { - [field]: { - type: 'keyword', - }, - }; + }), + {} + ); } + return {}; }; /** @@ -255,12 +211,7 @@ export const useLatestFindingsGrouping = ({ size: pageSize, sort: [{ groupByField: { order: 'desc' } }, { complianceScore: { order: 'asc' } }], statsAggregations: getAggregationsByGroupField(currentSelectedGroup), - runtimeMappings: { - ...getRuntimeMappingsByGroupField(currentSelectedGroup), - 'result.evaluation': { - type: 'keyword', - }, - }, + runtimeMappings: getRuntimeMappingsByGroupField(currentSelectedGroup), rootAggregations: [ { failedFindings: { diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx index 5f01a4693c8f5..a998707c4704f 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities.tsx @@ -24,7 +24,10 @@ import { import { FindingsBaseEsQuery, showErrorToast } from '@kbn/cloud-security-posture'; import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest'; import type { RuntimePrimitiveTypes } from '@kbn/data-views-plugin/common'; -import { VULNERABILITY_FIELDS } from '../../../common/constants'; +import { + CDR_VULNERABILITY_DATA_TABLE_RUNTIME_MAPPING_FIELDS, + VULNERABILITY_FIELDS, +} from '../../../common/constants'; import { useKibana } from '../../../common/hooks/use_kibana'; import { getCaseInsensitiveSortScript } from '../utils/custom_sort_script'; type LatestFindingsRequest = IKibanaSearchRequest; @@ -54,22 +57,18 @@ const getMultiFieldsSort = (sort: string[][]) => { }; const getRuntimeMappingsFromSort = (sort: string[][]) => { - return sort.reduce((acc, [field]) => { - // TODO: Add proper type for all fields available in the field selector - const type: RuntimePrimitiveTypes = - field === VULNERABILITY_FIELDS.SCORE_BASE - ? 'double' - : field === '@timestamp' - ? 'date' - : 'keyword'; + return sort + .filter(([field]) => CDR_VULNERABILITY_DATA_TABLE_RUNTIME_MAPPING_FIELDS.includes(field)) + .reduce((acc, [field]) => { + const type: RuntimePrimitiveTypes = 'keyword'; - return { - ...acc, - [field]: { - type, - }, - }; - }, {}); + return { + ...acc, + [field]: { + type, + }, + }; + }, {}); }; export const getVulnerabilitiesQuery = ( diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx index d79b4620ec899..1d73b21f083a5 100644 --- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx +++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/hooks/use_latest_vulnerabilities_grouping.tsx @@ -23,6 +23,7 @@ import { LOCAL_STORAGE_VULNERABILITIES_GROUPING_KEY, VULNERABILITY_GROUPING_OPTIONS, VULNERABILITY_FIELDS, + CDR_VULNERABILITY_GROUPING_RUNTIME_MAPPING_FIELDS, } from '../../../common/constants'; import { useDataViewContext } from '../../../common/contexts/data_view_context'; import { @@ -102,41 +103,18 @@ const getAggregationsByGroupField = (field: string): NamedAggregation[] => { const getRuntimeMappingsByGroupField = ( field: string ): Record | undefined => { - switch (field) { - case VULNERABILITY_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME: - return { - [VULNERABILITY_GROUPING_OPTIONS.CLOUD_ACCOUNT_NAME]: { - type: 'keyword', - }, - [VULNERABILITY_FIELDS.CLOUD_PROVIDER]: { - type: 'keyword', - }, - }; - case VULNERABILITY_GROUPING_OPTIONS.RESOURCE_NAME: - return { - [VULNERABILITY_GROUPING_OPTIONS.RESOURCE_NAME]: { - type: 'keyword', - }, - [VULNERABILITY_FIELDS.RESOURCE_ID]: { - type: 'keyword', - }, - }; - case VULNERABILITY_GROUPING_OPTIONS.CVE: - return { - [VULNERABILITY_GROUPING_OPTIONS.CVE]: { - type: 'keyword', - }, - [VULNERABILITY_FIELDS.DESCRIPTION]: { - type: 'keyword', - }, - }; - default: - return { - [field]: { + if (CDR_VULNERABILITY_GROUPING_RUNTIME_MAPPING_FIELDS?.[field]) { + return CDR_VULNERABILITY_GROUPING_RUNTIME_MAPPING_FIELDS[field].reduce( + (acc, runtimeField) => ({ + ...acc, + [runtimeField]: { type: 'keyword', }, - }; + }), + {} + ); } + return {}; }; /** diff --git a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/v1.ts b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/v1.ts index 611a58436e995..c52b57d057c38 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/v1.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/benchmarks/v1.ts @@ -48,7 +48,7 @@ export const getBenchmarksData = ( const agentPolicyStatus = { id: agentPolicy.id, name: agentPolicy.name, - agents: agentStatusByAgentPolicyId[agentPolicy.id]?.total, + agents: agentStatusByAgentPolicyId[agentPolicy.id]?.active, }; return { package_policy: cspPackage, diff --git a/x-pack/plugins/fleet/common/constants/routes.ts b/x-pack/plugins/fleet/common/constants/routes.ts index c071c6feecbf8..61d50d0f9e073 100644 --- a/x-pack/plugins/fleet/common/constants/routes.ts +++ b/x-pack/plugins/fleet/common/constants/routes.ts @@ -135,8 +135,6 @@ export const APP_API_ROUTES = { CHECK_PERMISSIONS_PATTERN: `${API_ROOT}/check-permissions`, GENERATE_SERVICE_TOKEN_PATTERN: `${API_ROOT}/service_tokens`, AGENT_POLICIES_SPACES: `${INTERNAL_ROOT}/agent_policies_spaces`, - // deprecated since 8.0 - GENERATE_SERVICE_TOKEN_PATTERN_DEPRECATED: `${API_ROOT}/service-tokens`, }; // Agent API routes @@ -159,8 +157,6 @@ export const AGENT_API_ROUTES = { AVAILABLE_VERSIONS_PATTERN: `${API_ROOT}/agents/available_versions`, STATUS_PATTERN: `${API_ROOT}/agent_status`, DATA_PATTERN: `${API_ROOT}/agent_status/data`, - // deprecated since 8.0 - STATUS_PATTERN_DEPRECATED: `${API_ROOT}/agent-status`, UPGRADE_PATTERN: `${API_ROOT}/agents/{agentId}/upgrade`, BULK_UPGRADE_PATTERN: `${API_ROOT}/agents/bulk_upgrade`, ACTION_STATUS_PATTERN: `${API_ROOT}/agents/action_status`, diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts index bb69346bbdce4..b990e5367bb42 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts @@ -21,15 +21,13 @@ import type { ListResult, ListWithKuery } from './common'; export interface GetAgentsRequest { query: ListWithKuery & { - showInactive: boolean; + showInactive?: boolean; showUpgradeable?: boolean; withMetrics?: boolean; }; } export interface GetAgentsResponse extends ListResult { - // deprecated in 8.x - list?: Agent[]; statusSummary?: Record; } @@ -128,16 +126,6 @@ export type PostBulkAgentUpgradeResponse = BulkAgentAction; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface PostAgentUpgradeResponse {} -// deprecated -export interface PutAgentReassignRequest { - params: { - agentId: string; - }; - body: { policy_id: string }; -} -// deprecated -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface PutAgentReassignResponse {} export interface PostAgentReassignRequest { params: { agentId: string; @@ -217,8 +205,6 @@ export interface GetAgentStatusRequest { export interface GetAgentStatusResponse { results: { events: number; - // deprecated - total: number; online: number; error: number; offline: number; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx index 24f8fa8a04fe5..93631f63d0e04 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx @@ -238,8 +238,8 @@ export const CreatePackagePolicySinglePage: CreatePackagePolicyParams = ({ let count = 0; for (const policyId of agentPolicyIds) { const { data } = await sendGetAgentStatus({ policyId }); - if (data?.results.total) { - count += data.results.total; + if (data?.results.active) { + count += data.results.active; } } setAgentCount(count); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx index 91cd710db4343..9de7a3f22adff 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx @@ -150,8 +150,8 @@ export const SettingsView = memo<{ agentPolicy: AgentPolicy }>( if (isFleetEnabled) { setIsLoading(true); const { data } = await sendGetAgentStatus({ policyId: agentPolicy.id }); - if (data?.results.total) { - setAgentCount(data.results.total); + if (data?.results.active) { + setAgentCount(data.results.active); } else { await submitUpdateAgentPolicy(); } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 6157f09968680..9522d02756887 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -166,8 +166,8 @@ export const EditPackagePolicyForm = memo<{ let count = 0; for (const id of packagePolicy.policy_ids) { const { data } = await sendGetAgentStatus({ policyId: id }); - if (data?.results.total) { - count += data.results.total; + if (data?.results.active) { + count += data.results.active; } } setAgentCount(count); diff --git a/x-pack/plugins/fleet/server/routes/agent/handlers.ts b/x-pack/plugins/fleet/server/routes/agent/handlers.ts index 4f4b5592f2d04..76d0fefe90fde 100644 --- a/x-pack/plugins/fleet/server/routes/agent/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/handlers.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { uniq } from 'lodash'; +import { omit, uniq } from 'lodash'; import { type RequestHandler, SavedObjectsErrorHelpers } from '@kbn/core/server'; import type { TypeOf } from '@kbn/config-schema'; @@ -13,7 +13,6 @@ import type { GetAgentsResponse, GetOneAgentResponse, GetAgentStatusResponse, - PutAgentReassignResponse, GetAgentTagsResponse, GetAvailableVersionsResponse, GetActionStatusResponse, @@ -30,7 +29,6 @@ import type { DeleteAgentRequestSchema, GetAgentStatusRequestSchema, GetAgentDataRequestSchema, - PutAgentReassignRequestSchemaDeprecated, PostAgentReassignRequestSchema, PostBulkAgentReassignRequestSchema, PostBulkUpdateAgentTagsRequestSchema, @@ -207,7 +205,6 @@ export const getAgentsHandler: FleetRequestHandler< } const body: GetAgentsResponse = { - list: agents, // deprecated items: agents, total, page, @@ -243,29 +240,6 @@ export const getAgentTagsHandler: RequestHandler< } }; -export const putAgentsReassignHandlerDeprecated: RequestHandler< - TypeOf, - undefined, - TypeOf -> = async (context, request, response) => { - const coreContext = await context.core; - const soClient = coreContext.savedObjects.client; - const esClient = coreContext.elasticsearch.client.asInternalUser; - try { - await AgentService.reassignAgent( - soClient, - esClient, - request.params.agentId, - request.body.policy_id - ); - - const body: PutAgentReassignResponse = {}; - return response.ok({ body }); - } catch (error) { - return defaultFleetErrorHandler({ error, response }); - } -}; - export const postAgentReassignHandler: RequestHandler< TypeOf, undefined, @@ -341,7 +315,7 @@ export const getAgentStatusForAgentPolicyHandler: FleetRequestHandler< parsePolicyIds(request.query.policyIds) ); - const body: GetAgentStatusResponse = { results }; + const body: GetAgentStatusResponse = { results: omit(results, 'total') }; return response.ok({ body }); } catch (error) { diff --git a/x-pack/plugins/fleet/server/routes/agent/index.test.ts b/x-pack/plugins/fleet/server/routes/agent/index.test.ts index 7f210028ff742..34f66da425da3 100644 --- a/x-pack/plugins/fleet/server/routes/agent/index.test.ts +++ b/x-pack/plugins/fleet/server/routes/agent/index.test.ts @@ -222,7 +222,6 @@ describe('schema validation', () => { it('list agents should return valid response', async () => { const expectedResponse: GetAgentsResponse = { items: [agent], - list: [agent], total: 1, page: 1, perPage: 1, @@ -366,7 +365,6 @@ describe('schema validation', () => { const expectedResponse: GetAgentStatusResponse = { results: { events: 1, - total: 1, online: 1, error: 1, offline: 1, diff --git a/x-pack/plugins/fleet/server/routes/agent/index.ts b/x-pack/plugins/fleet/server/routes/agent/index.ts index fc45869dc1219..1c40f36a7e481 100644 --- a/x-pack/plugins/fleet/server/routes/agent/index.ts +++ b/x-pack/plugins/fleet/server/routes/agent/index.ts @@ -23,7 +23,6 @@ import { GetAgentStatusRequestSchema, GetAgentDataRequestSchema, PostNewAgentActionRequestSchema, - PutAgentReassignRequestSchemaDeprecated, PostAgentReassignRequestSchema, PostBulkAgentReassignRequestSchema, PostAgentUpgradeRequestSchema, @@ -68,7 +67,6 @@ import { updateAgentHandler, deleteAgentHandler, getAgentStatusForAgentPolicyHandler, - putAgentsReassignHandlerDeprecated, postBulkAgentReassignHandler, getAgentDataHandler, bulkUpdateAgentTagsHandler, @@ -391,23 +389,6 @@ export const registerAPIRoutes = (router: FleetAuthzRouter, config: FleetConfigT postAgentUnenrollHandler ); - router.versioned - .put({ - path: AGENT_API_ROUTES.REASSIGN_PATTERN, - fleetAuthz: { - fleet: { allAgents: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: PutAgentReassignRequestSchemaDeprecated }, - }, - putAgentsReassignHandlerDeprecated - ); - router.versioned .post({ path: AGENT_API_ROUTES.REASSIGN_PATTERN, @@ -613,22 +594,6 @@ export const registerAPIRoutes = (router: FleetAuthzRouter, config: FleetConfigT }, getAgentStatusForAgentPolicyHandler ); - router.versioned - .get({ - path: AGENT_API_ROUTES.STATUS_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { readAgents: true }, - }, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: { request: GetAgentStatusRequestSchema }, - }, - getAgentStatusForAgentPolicyHandler - ); // Agent data router.versioned .get({ diff --git a/x-pack/plugins/fleet/server/routes/app/index.ts b/x-pack/plugins/fleet/server/routes/app/index.ts index c0b7dbcfa1743..e66f9f02a687b 100644 --- a/x-pack/plugins/fleet/server/routes/app/index.ts +++ b/x-pack/plugins/fleet/server/routes/app/index.ts @@ -285,22 +285,4 @@ export const registerRoutes = (router: FleetAuthzRouter, config: FleetConfigType }, generateServiceTokenHandler ); - - router.versioned - .post({ - path: APP_API_ROUTES.GENERATE_SERVICE_TOKEN_PATTERN_DEPRECATED, - fleetAuthz: { - fleet: { allAgents: true }, - }, - description: `Create a service token`, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, - }) - .addVersion( - { - version: API_VERSIONS.public.v1, - validate: {}, - }, - generateServiceTokenHandler - ); }; diff --git a/x-pack/plugins/fleet/server/types/rest_spec/agent.ts b/x-pack/plugins/fleet/server/types/rest_spec/agent.ts index c1dface818f28..f9db02b92a659 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/agent.ts @@ -217,11 +217,6 @@ export const AgentResponseSchema = schema.object({ }); export const GetAgentsResponseSchema = ListResponseSchema(AgentResponseSchema).extends({ - list: schema.maybe( - schema.arrayOf(AgentResponseSchema, { - meta: { deprecated: true }, - }) - ), statusSummary: schema.maybe(schema.recordOf(AgentStatusSchema, schema.number())), }); @@ -377,15 +372,6 @@ export const PostBulkAgentUpgradeRequestSchema = { }), }; -export const PutAgentReassignRequestSchemaDeprecated = { - params: schema.object({ - agentId: schema.string(), - }), - body: schema.object({ - policy_id: schema.string(), - }), -}; - export const PostAgentReassignRequestSchema = { params: schema.object({ agentId: schema.string(), @@ -518,9 +504,6 @@ export const GetAgentStatusRequestSchema = { return validationObj?.error; } }, - meta: { - deprecated: true, - }, }) ), }), @@ -529,11 +512,6 @@ export const GetAgentStatusRequestSchema = { export const GetAgentStatusResponseSchema = schema.object({ results: schema.object({ events: schema.number(), - total: schema.number({ - meta: { - deprecated: true, - }, - }), online: schema.number(), error: schema.number(), offline: schema.number(), diff --git a/x-pack/plugins/integration_assistant/docs/imgs/categorization_graph.png b/x-pack/plugins/integration_assistant/docs/imgs/categorization_graph.png index a15dbf54d905a..de45a18546b40 100644 Binary files a/x-pack/plugins/integration_assistant/docs/imgs/categorization_graph.png and b/x-pack/plugins/integration_assistant/docs/imgs/categorization_graph.png differ diff --git a/x-pack/plugins/integration_assistant/docs/imgs/cel_graph.png b/x-pack/plugins/integration_assistant/docs/imgs/cel_graph.png new file mode 100644 index 0000000000000..8b339caa83798 Binary files /dev/null and b/x-pack/plugins/integration_assistant/docs/imgs/cel_graph.png differ diff --git a/x-pack/plugins/integration_assistant/docs/imgs/log_detection_graph.png b/x-pack/plugins/integration_assistant/docs/imgs/log_detection_graph.png index 285e012c57a14..f89ffc800f0a5 100644 Binary files a/x-pack/plugins/integration_assistant/docs/imgs/log_detection_graph.png and b/x-pack/plugins/integration_assistant/docs/imgs/log_detection_graph.png differ diff --git a/x-pack/plugins/integration_assistant/docs/imgs/related_graph.png b/x-pack/plugins/integration_assistant/docs/imgs/related_graph.png index 73a2c3acac0d4..222c864f3115f 100644 Binary files a/x-pack/plugins/integration_assistant/docs/imgs/related_graph.png and b/x-pack/plugins/integration_assistant/docs/imgs/related_graph.png differ diff --git a/x-pack/plugins/integration_assistant/docs/imgs/unstructured_graph.png b/x-pack/plugins/integration_assistant/docs/imgs/unstructured_graph.png new file mode 100644 index 0000000000000..45ab5abc8d6b3 Binary files /dev/null and b/x-pack/plugins/integration_assistant/docs/imgs/unstructured_graph.png differ diff --git a/x-pack/plugins/integration_assistant/scripts/draw_graphs_script.ts b/x-pack/plugins/integration_assistant/scripts/draw_graphs_script.ts index 12a37f71b184a..f9fd71c1f934f 100644 --- a/x-pack/plugins/integration_assistant/scripts/draw_graphs_script.ts +++ b/x-pack/plugins/integration_assistant/scripts/draw_graphs_script.ts @@ -20,6 +20,8 @@ import { getEcsGraph, getEcsSubGraph } from '../server/graphs/ecs/graph'; import { getLogFormatDetectionGraph } from '../server/graphs/log_type_detection/graph'; import { getRelatedGraph } from '../server/graphs/related/graph'; import { getKVGraph } from '../server/graphs/kv/graph'; +import { getUnstructuredGraph } from '../server/graphs/unstructured'; +import { getCelGraph } from '../server/graphs/cel/graph'; // Some mock elements just to get the graph to compile const model = new FakeLLM({ @@ -45,17 +47,20 @@ async function drawGraph(compiledGraph: RunnableGraph, graphName: string) { await saveFile(`${graphName}.png`, buffer); } +const GRAPH_LIST = { + related_graph: getRelatedGraph, + log_detection_graph: getLogFormatDetectionGraph, + categorization_graph: getCategorizationGraph, + kv_graph: getKVGraph, + ecs_graph: getEcsGraph, + ecs_subgraph: getEcsSubGraph, + unstructured_graph: getUnstructuredGraph, + cel_graph: getCelGraph, +}; + export async function drawGraphs() { - const relatedGraph = (await getRelatedGraph({ client, model })).getGraph(); - const logFormatDetectionGraph = (await getLogFormatDetectionGraph({ client, model })).getGraph(); - const categorizationGraph = (await getCategorizationGraph({ client, model })).getGraph(); - const ecsSubGraph = (await getEcsSubGraph({ model })).getGraph(); - const ecsGraph = (await getEcsGraph({ model })).getGraph(); - const kvGraph = (await getKVGraph({ client, model })).getGraph(); - drawGraph(relatedGraph, 'related_graph'); - drawGraph(logFormatDetectionGraph, 'log_detection_graph'); - drawGraph(categorizationGraph, 'categorization_graph'); - drawGraph(ecsSubGraph, 'ecs_subgraph'); - drawGraph(ecsGraph, 'ecs_graph'); - drawGraph(kvGraph, 'kv_graph'); + for (const [name, graph] of Object.entries(GRAPH_LIST)) { + const compiledGraph = (await graph({ client, model })).getGraph(); + drawGraph(compiledGraph, name); + } } diff --git a/x-pack/plugins/integration_assistant/server/graphs/categorization/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/categorization/graph.ts index 2f07bcd106862..cc1601095da62 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/categorization/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/categorization/graph.ts @@ -233,6 +233,6 @@ export async function getCategorizationGraph({ client, model }: CategorizationGr } ); - const compiledCategorizationGraph = workflow.compile().withConfig({ runName: 'Categorization' }); + const compiledCategorizationGraph = workflow.compile(); return compiledCategorizationGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/cel/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/cel/graph.ts index a8f2e0521c788..5d58f82f6f744 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/cel/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/cel/graph.ts @@ -104,6 +104,6 @@ export async function getCelGraph({ model }: CelInputGraphParams) { .addEdge('handleGetStateVariables', 'handleGetStateDetails') .addEdge('handleGetStateDetails', 'modelOutput'); - const compiledCelGraph = workflow.compile().withConfig({ runName: 'CEL' }); + const compiledCelGraph = workflow.compile(); return compiledCelGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/ecs/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/ecs/graph.ts index 89a7e5c600723..dc2f26f9505e4 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/ecs/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/ecs/graph.ts @@ -78,7 +78,7 @@ export async function getEcsSubGraph({ model }: EcsGraphParams) { }) .addEdge('modelSubOutput', END); - const compiledEcsSubGraph = workflow.compile().withConfig({ runName: 'ECS Mapping (Chunk)' }); + const compiledEcsSubGraph = workflow.compile(); return compiledEcsSubGraph; } @@ -96,7 +96,7 @@ export async function getEcsGraph({ model }: EcsGraphParams) { .addNode('handleMergedSubGraphResponse', (state: EcsMappingState) => modelMergedInputFromSubGraph({ state }) ) - .addNode('subGraph', subGraph) + .addNode('subGraph', subGraph.withConfig({ runName: 'ECS Mapping (Chunk)' })) .addEdge(START, 'modelInput') .addEdge('subGraph', 'handleMergedSubGraphResponse') .addEdge('handleDuplicates', 'handleValidation') @@ -119,6 +119,6 @@ export async function getEcsGraph({ model }: EcsGraphParams) { }) .addEdge('modelOutput', END); - const compiledEcsGraph = workflow.compile().withConfig({ runName: 'ECS Mapping' }); + const compiledEcsGraph = workflow.compile(); return compiledEcsGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/kv/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/kv/graph.ts index f72984655c1f8..6f7b43ba40f22 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/kv/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/kv/graph.ts @@ -139,6 +139,6 @@ export async function getKVGraph({ model, client }: KVGraphParams) { }) .addEdge('modelOutput', END); - const compiledKVGraph = workflow.compile().withConfig({ runName: 'Key-Value' }); + const compiledKVGraph = workflow.compile(); return compiledKVGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/log_type_detection/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/log_type_detection/graph.ts index 95d624a7436c7..ae4c607ab3f68 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/log_type_detection/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/log_type_detection/graph.ts @@ -118,8 +118,14 @@ export async function getLogFormatDetectionGraph({ model, client }: LogDetection .addNode('handleLogFormatDetection', (state: LogFormatDetectionState) => handleLogFormatDetection({ state, model, client }) ) - .addNode('handleKVGraph', await getKVGraph({ model, client })) - .addNode('handleUnstructuredGraph', await getUnstructuredGraph({ model, client })) + .addNode( + 'handleKVGraph', + (await getKVGraph({ model, client })).withConfig({ runName: 'Key-Value' }) + ) + .addNode( + 'handleUnstructuredGraph', + (await getUnstructuredGraph({ model, client })).withConfig({ runName: 'Unstructured' }) + ) .addNode('handleCSV', (state: LogFormatDetectionState) => handleCSV({ state, model, client })) .addEdge(START, 'modelInput') .addEdge('modelInput', 'handleLogFormatDetection') @@ -138,6 +144,6 @@ export async function getLogFormatDetectionGraph({ model, client }: LogDetection } ); - const compiledLogFormatDetectionGraph = workflow.compile().withConfig({ runName: 'Log Format' }); + const compiledLogFormatDetectionGraph = workflow.compile(); return compiledLogFormatDetectionGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/related/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/related/graph.ts index e8dc44a152e80..20ac1c639dcf4 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/related/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/related/graph.ts @@ -179,6 +179,6 @@ export async function getRelatedGraph({ client, model }: RelatedGraphParams) { } ); - const compiledRelatedGraph = workflow.compile().withConfig({ runName: 'Related' }); + const compiledRelatedGraph = workflow.compile(); return compiledRelatedGraph; } diff --git a/x-pack/plugins/integration_assistant/server/graphs/unstructured/graph.ts b/x-pack/plugins/integration_assistant/server/graphs/unstructured/graph.ts index cf3a645effa68..6048404728bfb 100644 --- a/x-pack/plugins/integration_assistant/server/graphs/unstructured/graph.ts +++ b/x-pack/plugins/integration_assistant/server/graphs/unstructured/graph.ts @@ -107,6 +107,6 @@ export async function getUnstructuredGraph({ model, client }: UnstructuredGraphP .addEdge('handleUnstructuredError', 'handleUnstructuredValidate') .addEdge('modelOutput', END); - const compiledUnstructuredGraph = workflow.compile().withConfig({ runName: 'Unstructured' }); + const compiledUnstructuredGraph = workflow.compile(); return compiledUnstructuredGraph; } diff --git a/x-pack/plugins/integration_assistant/server/routes/analyze_logs_routes.ts b/x-pack/plugins/integration_assistant/server/routes/analyze_logs_routes.ts index 639cd62f275b1..04ba66acbebfb 100644 --- a/x-pack/plugins/integration_assistant/server/routes/analyze_logs_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/analyze_logs_routes.ts @@ -91,7 +91,9 @@ export function registerAnalyzeLogsRoutes( logSamples, }; const graph = await getLogFormatDetectionGraph({ model, client }); - const graphResults = await graph.invoke(logFormatParameters, options); + const graphResults = await graph + .withConfig({ runName: 'Log Format' }) + .invoke(logFormatParameters, options); const graphLogFormat = graphResults.results.samplesFormat.name; if (graphLogFormat === 'unsupported') { throw new UnsupportedLogFormatError(GenerationErrorCode.UNSUPPORTED_LOG_SAMPLES_FORMAT); diff --git a/x-pack/plugins/integration_assistant/server/routes/categorization_routes.test.ts b/x-pack/plugins/integration_assistant/server/routes/categorization_routes.test.ts index abe626cf7ae73..0e6f4ffa0491a 100644 --- a/x-pack/plugins/integration_assistant/server/routes/categorization_routes.test.ts +++ b/x-pack/plugins/integration_assistant/server/routes/categorization_routes.test.ts @@ -23,7 +23,9 @@ const mockResult = jest.fn().mockResolvedValue({ jest.mock('../graphs/categorization', () => { return { getCategorizationGraph: jest.fn().mockResolvedValue({ - invoke: () => mockResult(), + withConfig: () => ({ + invoke: () => mockResult(), + }), }), }; }); diff --git a/x-pack/plugins/integration_assistant/server/routes/categorization_routes.ts b/x-pack/plugins/integration_assistant/server/routes/categorization_routes.ts index 77ce549f589f4..10d72b92563fe 100644 --- a/x-pack/plugins/integration_assistant/server/routes/categorization_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/categorization_routes.ts @@ -99,7 +99,9 @@ export function registerCategorizationRoutes( }; const graph = await getCategorizationGraph({ client, model }); - const results = await graph.invoke(parameters, options); + const results = await graph + .withConfig({ runName: 'Categorization' }) + .invoke(parameters, options); return res.ok({ body: CategorizationResponse.parse(results) }); } catch (err) { diff --git a/x-pack/plugins/integration_assistant/server/routes/cel_route.test.ts b/x-pack/plugins/integration_assistant/server/routes/cel_route.test.ts index be435aa9866bb..02b5f03948a12 100644 --- a/x-pack/plugins/integration_assistant/server/routes/cel_route.test.ts +++ b/x-pack/plugins/integration_assistant/server/routes/cel_route.test.ts @@ -22,7 +22,9 @@ const mockResult = jest.fn().mockResolvedValue({ jest.mock('../graphs/cel', () => { return { getCelGraph: jest.fn().mockResolvedValue({ - invoke: () => mockResult(), + withConfig: () => ({ + invoke: () => mockResult(), + }), }), }; }); diff --git a/x-pack/plugins/integration_assistant/server/routes/cel_routes.ts b/x-pack/plugins/integration_assistant/server/routes/cel_routes.ts index ecf012a88cfe5..5f417bbc0aec9 100644 --- a/x-pack/plugins/integration_assistant/server/routes/cel_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/cel_routes.ts @@ -78,7 +78,7 @@ export function registerCelInputRoutes(router: IRouter { return { getEcsGraph: jest.fn().mockResolvedValue({ - invoke: () => mockResult(), + withConfig: () => ({ + invoke: () => mockResult(), + }), }), }; }); diff --git a/x-pack/plugins/integration_assistant/server/routes/ecs_routes.ts b/x-pack/plugins/integration_assistant/server/routes/ecs_routes.ts index 43ca0fe396cae..0bc293492b24d 100644 --- a/x-pack/plugins/integration_assistant/server/routes/ecs_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/ecs_routes.ts @@ -92,7 +92,9 @@ export function registerEcsRoutes(router: IRouter { return { getRelatedGraph: jest.fn().mockResolvedValue({ - invoke: () => mockResult(), + withConfig: () => ({ + invoke: () => mockResult(), + }), }), }; }); diff --git a/x-pack/plugins/integration_assistant/server/routes/related_routes.ts b/x-pack/plugins/integration_assistant/server/routes/related_routes.ts index fe3a63abd4ce9..8e147e8385dc0 100644 --- a/x-pack/plugins/integration_assistant/server/routes/related_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/related_routes.ts @@ -90,7 +90,9 @@ export function registerRelatedRoutes(router: IRouter { locationId: ping?.observer?.name, locationName: ping?.observer?.geo?.name, errorMessage: ping?.error?.message, + errorStackTrace: ping?.error?.stack_trace, }; }); const total = result.aggregations?.total?.value ?? 0; diff --git a/x-pack/plugins/observability_solution/synthetics/common/rules/synthetics_rule_field_map.ts b/x-pack/plugins/observability_solution/synthetics/common/rules/synthetics_rule_field_map.ts index f82f44ba2d24d..390916026668c 100644 --- a/x-pack/plugins/observability_solution/synthetics/common/rules/synthetics_rule_field_map.ts +++ b/x-pack/plugins/observability_solution/synthetics/common/rules/synthetics_rule_field_map.ts @@ -32,6 +32,10 @@ export const syntheticsRuleFieldMap: FieldMap = { type: 'text', required: false, }, + 'error.stack_trace': { + type: 'wildcard', + required: false, + }, 'agent.name': { type: 'keyword', required: false, diff --git a/x-pack/plugins/observability_solution/synthetics/common/runtime_types/certs.ts b/x-pack/plugins/observability_solution/synthetics/common/runtime_types/certs.ts index 4fe14a54c0d66..49ac5573294e1 100644 --- a/x-pack/plugins/observability_solution/synthetics/common/runtime_types/certs.ts +++ b/x-pack/plugins/observability_solution/synthetics/common/runtime_types/certs.ts @@ -51,6 +51,7 @@ export const CertType = t.intersection([ '@timestamp': t.string, serviceName: t.string, errorMessage: t.string, + errorStackTrace: t.union([t.string, t.null]), labels: t.record(t.string, t.string), tags: t.array(t.string), }), diff --git a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/message_utils.ts b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/message_utils.ts index 812a900667cf7..6f01e9b234bf6 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/message_utils.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/message_utils.ts @@ -24,6 +24,7 @@ import { AGENT_NAME, STATE_ID, SERVICE_NAME, + ERROR_STACK_TRACE, } from '../../../common/field_names'; import { OverviewPing } from '../../../common/runtime_types'; import { UNNAMED_LOCATION } from '../../../common/constants'; @@ -42,6 +43,8 @@ export const getMonitorAlertDocument = ( [OBSERVER_GEO_NAME]: locationNames, [OBSERVER_NAME]: locationIds, [ERROR_MESSAGE]: monitorSummary.lastErrorMessage, + // done to avoid assigning null to the field + [ERROR_STACK_TRACE]: monitorSummary.lastErrorStack ? monitorSummary.lastErrorStack : undefined, [AGENT_NAME]: monitorSummary.hostName, [ALERT_REASON]: monitorSummary.reason, [STATE_ID]: monitorSummary.stateId, @@ -114,7 +117,9 @@ export const getMonitorSummary = ({ monitorId: monitorInfo.monitor?.id, monitorName, monitorType: typeToLabelMap[monitorInfo.monitor?.type] || monitorInfo.monitor?.type, - lastErrorMessage: monitorInfo.error?.message!, + lastErrorMessage: monitorInfo.error?.message, + // done to avoid assigning null to the field + lastErrorStack: monitorInfo.error?.stack_trace ? monitorInfo.error?.stack_trace : undefined, serviceName: monitorInfo.service?.name, labels: monitorInfo.labels, locationName: formattedLocationName, diff --git a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/types.ts b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/types.ts index 82294e55c08fc..85ae989876107 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/types.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/status_rule/types.ts @@ -69,6 +69,7 @@ export interface MonitorSummaryStatusRule { }; stateId?: string; lastErrorMessage?: string; + lastErrorStack?: string | null; timestamp: string; labels?: Record; } diff --git a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/tls_rule/message_utils.ts b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/tls_rule/message_utils.ts index 15a6f093becd9..a6a7d82fb3335 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/tls_rule/message_utils.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/tls_rule/message_utils.ts @@ -29,6 +29,7 @@ import { CERT_VALID_NOT_AFTER, CERT_VALID_NOT_BEFORE, ERROR_MESSAGE, + ERROR_STACK_TRACE, MONITOR_ID, MONITOR_NAME, MONITOR_TYPE, @@ -103,6 +104,7 @@ export const getCertSummary = (cert: Cert, expirationThreshold: number, ageThres configId: cert.configId, monitorTags: cert.tags, errorMessage: cert.errorMessage, + errorStackTrace: cert.errorStackTrace, labels: cert.labels, }; }; @@ -123,6 +125,8 @@ export const getTLSAlertDocument = (cert: Cert, monitorSummary: CertSummary, uui [OBSERVER_GEO_NAME]: monitorSummary.locationName ? [monitorSummary.locationName] : [], [OBSERVER_NAME]: monitorSummary.locationId ? [monitorSummary.locationId] : [], [ERROR_MESSAGE]: monitorSummary.errorMessage, + // done to avoid assigning null to the field + [ERROR_STACK_TRACE]: monitorSummary.errorStackTrace ? monitorSummary.errorStackTrace : undefined, 'location.id': monitorSummary.locationId ? [monitorSummary.locationId] : [], 'location.name': monitorSummary.locationName ? [monitorSummary.locationName] : [], labels: cert.labels, diff --git a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/translations.ts b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/translations.ts index 40017b00646f1..03063f92ee56c 100644 --- a/x-pack/plugins/observability_solution/synthetics/server/alert_rules/translations.ts +++ b/x-pack/plugins/observability_solution/synthetics/server/alert_rules/translations.ts @@ -79,6 +79,15 @@ export const commonMonitorStateI18: Array<{ } ), }, + { + name: 'lastErrorStack', + description: i18n.translate( + 'xpack.synthetics.alertRules.monitorStatus.actionVariables.state.lastErrorStack', + { + defaultMessage: 'Monitor last error stack trace.', + } + ), + }, { name: 'locationName', description: i18n.translate( diff --git a/x-pack/plugins/observability_solution/uptime/common/rules/uptime_rule_field_map.ts b/x-pack/plugins/observability_solution/uptime/common/rules/uptime_rule_field_map.ts index 6e0f73e183462..c157177b585ba 100644 --- a/x-pack/plugins/observability_solution/uptime/common/rules/uptime_rule_field_map.ts +++ b/x-pack/plugins/observability_solution/uptime/common/rules/uptime_rule_field_map.ts @@ -32,6 +32,10 @@ export const uptimeRuleFieldMap: FieldMap = { type: 'text', required: false, }, + 'error.stack_trace': { + type: 'wildcard', + required: false, + }, 'agent.name': { type: 'keyword', required: false, diff --git a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts index 9e84410712506..64b10f0a8248e 100644 --- a/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts +++ b/x-pack/plugins/osquery/server/routes/fleet_wrapper/get_agent_policies.ts @@ -59,7 +59,7 @@ export const getAgentPoliciesRoute = (router: IRouter, osqueryContext: OsqueryAp (agentPolicy: GetAgentPoliciesResponseItem) => agentService?.asInternalUser .getAgentStatusForAgentPolicy(agentPolicy.id) - .then(({ total: agentTotal }) => (agentPolicy.agents = agentTotal)), + .then(({ active: agentTotal }) => (agentPolicy.agents = agentTotal)), { concurrency: 10 } ); } diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.test.ts b/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.test.ts index 06d6d396ce022..956ced4309304 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.test.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.test.ts @@ -149,7 +149,7 @@ describe('GET all roles by space id', () => { const paramsSchema = (config.validate as any).params; - expect(config.options).toEqual({ tags: ['access:manage_spaces'] }); + expect(config.security?.authz).toEqual({ requiredPrivileges: ['manage_spaces'] }); expect(() => paramsSchema.validate({})).toThrowErrorMatchingInlineSnapshot( `"[spaceId]: expected value of type [string] but got [undefined]"` ); diff --git a/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.ts b/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.ts index 734f0292db116..a441ba15164c1 100644 --- a/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.ts +++ b/x-pack/plugins/security/server/routes/authorization/roles/get_all_by_space.ts @@ -24,8 +24,10 @@ export function defineGetAllRolesBySpaceRoutes({ router.get( { path: '/internal/security/roles/{spaceId}', - options: { - tags: ['access:manage_spaces'], + security: { + authz: { + requiredPrivileges: ['manage_spaces'], + }, }, validate: { params: schema.object({ spaceId: schema.string({ minLength: 1 }) }), diff --git a/x-pack/plugins/security/server/routes/session_management/invalidate.test.ts b/x-pack/plugins/security/server/routes/session_management/invalidate.test.ts index fbc14015d80c1..12c31be12dd57 100644 --- a/x-pack/plugins/security/server/routes/session_management/invalidate.test.ts +++ b/x-pack/plugins/security/server/routes/session_management/invalidate.test.ts @@ -46,9 +46,10 @@ describe('Invalidate sessions routes', () => { expect(routeConfig.options).toEqual({ access: 'public', summary: 'Invalidate user sessions', - tags: ['access:sessionManagement'], }); + expect(routeConfig.security?.authz).toEqual({ requiredPrivileges: ['sessionManagement'] }); + const bodySchema = (routeConfig.validate as any).body as ObjectType; expect(() => bodySchema.validate({})).toThrowErrorMatchingInlineSnapshot( `"[match]: expected at least one defined value but got [undefined]"` diff --git a/x-pack/plugins/security/server/routes/session_management/invalidate.ts b/x-pack/plugins/security/server/routes/session_management/invalidate.ts index a45d8f00c1ca4..bbc81c21706d9 100644 --- a/x-pack/plugins/security/server/routes/session_management/invalidate.ts +++ b/x-pack/plugins/security/server/routes/session_management/invalidate.ts @@ -37,6 +37,11 @@ export function defineInvalidateSessionsRoutes({ ), }), }, + security: { + authz: { + requiredPrivileges: ['sessionManagement'], + }, + }, options: { // The invalidate session API was introduced to address situations where the session index // could grow rapidly - when session timeouts are disabled, or with anonymous access. @@ -44,7 +49,7 @@ export function defineInvalidateSessionsRoutes({ // anonymous access. However, keeping this endpoint available internally in serverless would // be useful in situations where we need to batch-invalidate user sessions. access: buildFlavor === 'serverless' ? 'internal' : 'public', - tags: ['access:sessionManagement'], + summary: `Invalidate user sessions`, }, }, diff --git a/x-pack/plugins/security/server/routes/user_profile/bulk_get.test.ts b/x-pack/plugins/security/server/routes/user_profile/bulk_get.test.ts index f5d449bd8423d..eece6b58f8f01 100644 --- a/x-pack/plugins/security/server/routes/user_profile/bulk_get.test.ts +++ b/x-pack/plugins/security/server/routes/user_profile/bulk_get.test.ts @@ -51,7 +51,7 @@ describe('Bulk get profile routes', () => { }); it('correctly defines route.', () => { - expect(routeConfig.options).toEqual({ tags: ['access:bulkGetUserProfiles'] }); + expect(routeConfig.security?.authz).toEqual({ requiredPrivileges: ['bulkGetUserProfiles'] }); const bodySchema = (routeConfig.validate as any).body as ObjectType; expect(() => bodySchema.validate(0)).toThrowErrorMatchingInlineSnapshot( diff --git a/x-pack/plugins/security/server/routes/user_profile/bulk_get.ts b/x-pack/plugins/security/server/routes/user_profile/bulk_get.ts index 20da1d573901f..0ffe760d57d52 100644 --- a/x-pack/plugins/security/server/routes/user_profile/bulk_get.ts +++ b/x-pack/plugins/security/server/routes/user_profile/bulk_get.ts @@ -24,7 +24,11 @@ export function defineBulkGetUserProfilesRoute({ dataPath: schema.maybe(schema.string()), }), }, - options: { tags: ['access:bulkGetUserProfiles'] }, + security: { + authz: { + requiredPrivileges: ['bulkGetUserProfiles'], + }, + }, }, createLicensedRouteHandler(async (context, request, response) => { const userProfileServiceInternal = getUserProfileService(); diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx index 99e2475f95a78..63ffcf7b9eae1 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/entity_store/components/dashboard_panels.tsx @@ -141,6 +141,7 @@ const EntityStoreDashboardPanelsComponent = () => { ); } + // TODO Rename variable because the Risk score could be installed but disabled const isRiskScoreAvailable = riskEngineStatus.data && riskEngineStatus.data.risk_engine_status !== RiskEngineStatusEnum.NOT_INSTALLED; @@ -199,35 +200,37 @@ const EntityStoreDashboardPanelsComponent = () => { )} - {entityStore.status === 'not_installed' && !isRiskScoreAvailable && ( - // TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status - setModalState({ visible: true })} - loadingRiskEngine={riskEngineInitializing} - /> - )} + {(entityStore.status === 'not_installed' || entityStore.status === 'stopped') && + !isRiskScoreAvailable && ( + // TODO: Move modal inside EnableEntityStore component, eliminating the onEnable prop in favour of forwarding the riskScoreEnabled status + setModalState({ visible: true })} + loadingRiskEngine={riskEngineInitializing} + /> + )} - {entityStore.status === 'not_installed' && isRiskScoreAvailable && ( - <> - - - setModalState({ - visible: true, - }) - } - /> - - - - - - - - - )} + {(entityStore.status === 'not_installed' || entityStore.status === 'stopped') && + isRiskScoreAvailable && ( + <> + + + setModalState({ + visible: true, + }) + } + /> + + + + + + + + + )} = export const reassignAgentPolicy = ( agentId: string, agentPolicyId: string -): Cypress.Chainable> => - request({ +): Cypress.Chainable> => + request({ url: agentRouteService.getReassignPath(agentId), - method: 'PUT', + method: 'POST', body: { policy_id: agentPolicyId, }, diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx index ffcee81a3cb8f..75e932d5385fd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx @@ -124,7 +124,7 @@ describe('Policy Details', () => { if (path === `${AGENT_API_ROUTES.STATUS_PATTERN}`) { asyncActions = asyncActions.then(async () => sleep()); return Promise.resolve({ - results: { events: 0, total: 5, online: 3, error: 1, offline: 1 }, + results: { events: 0, active: 5, online: 3, error: 1, offline: 1 }, success: true, }); } diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx index 7f72a8d475134..13f18d071d543 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.tsx @@ -60,7 +60,7 @@ export const PolicyDetails = React.memo(() => { const headerRightContent = ( { const paramsSchema = (config.validate as any).params; - expect(config.options).toEqual({ tags: ['access:manage_spaces'] }); + expect(config.security?.authz).toEqual({ requiredPrivileges: ['manage_spaces'] }); expect(() => paramsSchema.validate({})).toThrowErrorMatchingInlineSnapshot( `"[spaceId]: expected value of type [string] but got [undefined]"` ); diff --git a/x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.ts b/x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.ts index 848449bfd47b3..6c80a645f0c62 100644 --- a/x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.ts +++ b/x-pack/plugins/spaces/server/routes/api/internal/get_content_summary.ts @@ -38,8 +38,10 @@ export function initGetSpaceContentSummaryApi(deps: InternalRouteDeps) { router.get( { path: '/internal/spaces/{spaceId}/content_summary', - options: { - tags: ['access:manage_spaces'], + security: { + authz: { + requiredPrivileges: ['manage_spaces'], + }, }, validate: { params: schema.object({ diff --git a/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts b/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts index 517b29a54cd64..6007508451d9e 100644 --- a/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts +++ b/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts @@ -45,6 +45,7 @@ interface FillPoolStat extends JsonObject { claim_duration: number[]; claim_conflicts: number[]; claim_mismatches: number[]; + claim_stale_tasks: number[]; result_frequency_percent_as_number: FillPoolResult[]; persistence: TaskPersistence[]; } @@ -150,6 +151,7 @@ export function createTaskRunAggregator( const claimDurationQueue = createRunningAveragedStat(runningAverageWindowSize); const claimConflictsQueue = createRunningAveragedStat(runningAverageWindowSize); const claimMismatchesQueue = createRunningAveragedStat(runningAverageWindowSize); + const claimStaleTasksQueue = createRunningAveragedStat(runningAverageWindowSize); const polledTasksByPersistenceQueue = createRunningAveragedStat(runningAverageWindowSize); const taskPollingEvents$: Observable> = combineLatest([ @@ -161,9 +163,8 @@ export function createTaskRunAggregator( isOk(taskEvent.event) ), map((taskEvent: TaskLifecycleEvent) => { - const { result, stats: { tasksClaimed, tasksUpdated, tasksConflicted } = {} } = ( - taskEvent.event as unknown as Ok - ).value; + const { result, stats: { tasksClaimed, tasksUpdated, tasksConflicted, staleTasks } = {} } = + (taskEvent.event as unknown as Ok).value; const duration = (taskEvent?.timing?.stop ?? 0) - (taskEvent?.timing?.start ?? 0); return { polling: { @@ -179,6 +180,9 @@ export function createTaskRunAggregator( isNumber(tasksClaimed) && isNumber(tasksUpdated) ? claimMismatchesQueue(tasksUpdated - tasksClaimed) : claimMismatchesQueue(), + claim_stale_tasks: isNumber(staleTasks) + ? claimStaleTasksQueue(staleTasks) + : claimStaleTasksQueue(), result_frequency_percent_as_number: resultFrequencyQueue(result), }, }; @@ -258,6 +262,7 @@ export function createTaskRunAggregator( claim_duration: [], claim_conflicts: [], claim_mismatches: [], + claim_stale_tasks: [], result_frequency_percent_as_number: [], persistence: [], }, @@ -347,6 +352,7 @@ export function summarizeTaskRunStat( result_frequency_percent_as_number: pollingResultFrequency, claim_conflicts: claimConflicts, claim_mismatches: claimMismatches, + claim_stale_tasks: claimStaleTasks, persistence: pollingPersistence, }, drift, @@ -373,6 +379,7 @@ export function summarizeTaskRunStat( duration: calculateRunningAverage(pollingDuration as number[]), claim_conflicts: calculateRunningAverage(claimConflicts as number[]), claim_mismatches: calculateRunningAverage(claimMismatches as number[]), + claim_stale_tasks: calculateRunningAverage(claimStaleTasks as number[]), result_frequency_percent_as_number: { ...DEFAULT_POLLING_FREQUENCIES, ...calculateFrequency(pollingResultFrequency as FillPoolResult[]), diff --git a/x-pack/plugins/task_manager/server/routes/health.test.ts b/x-pack/plugins/task_manager/server/routes/health.test.ts index e3a7eb278d225..1e06ea91a6fcf 100644 --- a/x-pack/plugins/task_manager/server/routes/health.test.ts +++ b/x-pack/plugins/task_manager/server/routes/health.test.ts @@ -942,6 +942,7 @@ function mockHealthStats(overrides = {}) { claim_conflicts: [0, 100, 75], claim_mismatches: [0, 100, 75], claim_duration: [0, 100, 75], + claim_stale_tasks: [0, 100, 75], result_frequency_percent_as_number: [ FillPoolResult.NoTasksClaimed, FillPoolResult.NoTasksClaimed, diff --git a/x-pack/plugins/task_manager/server/task_claimers/index.ts b/x-pack/plugins/task_manager/server/task_claimers/index.ts index 4b6c8b96d6ca4..178ebacf68cb9 100644 --- a/x-pack/plugins/task_manager/server/task_claimers/index.ts +++ b/x-pack/plugins/task_manager/server/task_claimers/index.ts @@ -40,6 +40,7 @@ export interface ClaimOwnershipResult { tasksClaimed: number; tasksLeftUnclaimed?: number; tasksErrors?: number; + staleTasks?: number; }; docs: ConcreteTaskInstance[]; timing?: TaskTiming; @@ -70,6 +71,7 @@ export function getEmptyClaimOwnershipResult(): ClaimOwnershipResult { tasksUpdated: 0, tasksConflicted: 0, tasksClaimed: 0, + staleTasks: 0, }, docs: [], }; diff --git a/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.test.ts b/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.test.ts index 0d3560c3bec6e..e089d3b2d8785 100644 --- a/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.test.ts +++ b/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.test.ts @@ -433,6 +433,7 @@ describe('TaskClaiming', () => { tasksConflicted: 0, tasksErrors: 0, tasksUpdated: 3, + staleTasks: 0, tasksLeftUnclaimed: 3, }); expect(result.docs.length).toEqual(3); @@ -529,6 +530,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 1, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(1); }); @@ -640,6 +642,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 1, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(1); }); @@ -737,6 +740,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 1, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(1); }); @@ -792,6 +796,7 @@ describe('TaskClaiming', () => { tasksClaimed: 0, tasksConflicted: 0, tasksUpdated: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(0); }); @@ -885,6 +890,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 2, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(2); }); @@ -978,6 +984,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 2, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(2); }); @@ -1031,7 +1038,7 @@ describe('TaskClaiming', () => { expect(mockApmTrans.end).toHaveBeenCalledWith('success'); expect(taskManagerLogger.debug).toHaveBeenCalledWith( - 'task claimer claimed: 2; stale: 1; conflicts: 1; missing: 0; capacity reached: 0; updateErrors: 0; getErrors: 0; removed: 0;', + 'task claimer claimed: 2; stale: 1; conflicts: 0; missing: 0; capacity reached: 0; updateErrors: 0; getErrors: 0; removed: 0;', { tags: ['taskClaiming', 'claimAvailableTasksMget'] } ); @@ -1067,10 +1074,11 @@ describe('TaskClaiming', () => { expect(result.stats).toEqual({ tasksClaimed: 2, - tasksConflicted: 1, + tasksConflicted: 0, tasksErrors: 0, tasksUpdated: 2, tasksLeftUnclaimed: 0, + staleTasks: 1, }); expect(result.docs.length).toEqual(2); }); @@ -1197,6 +1205,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 4, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(4); }); @@ -1330,6 +1339,7 @@ describe('TaskClaiming', () => { tasksErrors: 1, tasksUpdated: 3, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(3); }); @@ -1458,6 +1468,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 4, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(4); for (const r of result.docs) { @@ -1699,6 +1710,7 @@ describe('TaskClaiming', () => { tasksErrors: 1, tasksUpdated: 3, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(3); }); @@ -1829,6 +1841,7 @@ describe('TaskClaiming', () => { tasksErrors: 0, tasksUpdated: 3, tasksLeftUnclaimed: 0, + staleTasks: 0, }); expect(result.docs.length).toEqual(3); }); diff --git a/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.ts b/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.ts index 4b7e5ec6b3691..4e74454e8c982 100644 --- a/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.ts +++ b/x-pack/plugins/task_manager/server/task_claimers/strategy_mget.ts @@ -196,7 +196,7 @@ async function claimAvailableTasks(opts: TaskClaimerOpts): Promise { const { body: apiResponse } = await supertest.get(`/api/fleet/agents`).expect(200); - expect(apiResponse).to.have.keys('page', 'total', 'items', 'list'); + expect(apiResponse).to.have.keys('page', 'total', 'items'); expect(apiResponse.total).to.eql(4); }); it('should return 200 if the passed kuery is valid', async () => { await supertest - .get(`/api/fleet/agent_status?kuery=fleet-agents.local_metadata.host.hostname:test`) + .get(`/api/fleet/agents?kuery=fleet-agents.local_metadata.host.hostname:test`) .set('kbn-xsrf', 'xxxx') .expect(200); }); it('should return 200 also if the passed kuery does not have prefix fleet-agents', async () => { await supertest - .get(`/api/fleet/agent_status?kuery=local_metadata.host.hostname:test`) + .get(`/api/fleet/agents?kuery=local_metadata.host.hostname:test`) .set('kbn-xsrf', 'xxxx') .expect(200); }); @@ -181,7 +181,7 @@ export default function ({ getService }: FtrProviderContext) { .get(`/api/fleet/agents?withMetrics=true`) .expect(200); - expect(apiResponse).to.have.keys('page', 'total', 'items', 'list'); + expect(apiResponse).to.have.keys('page', 'total', 'items'); expect(apiResponse.total).to.eql(4); const agent1: Agent = apiResponse.items.find((agent: any) => agent.id === 'agent1'); diff --git a/x-pack/test/fleet_api_integration/apis/agents/privileges.ts b/x-pack/test/fleet_api_integration/apis/agents/privileges.ts index 9bbb2d1091dab..0b503e28cf136 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/privileges.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/privileges.ts @@ -262,7 +262,7 @@ export default function (providerContext: FtrProviderContext) { }, { method: 'GET', - path: '/api/fleet/agent-status', + path: '/api/fleet/agent_status', scenarios: READ_SCENARIOS, }, { diff --git a/x-pack/test/fleet_api_integration/apis/agents/status.ts b/x-pack/test/fleet_api_integration/apis/agents/status.ts index 7c1134d055bc8..42b60a0624a96 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/status.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/status.ts @@ -217,7 +217,6 @@ export default function ({ getService }: FtrProviderContext) { results: { events: 0, other: 0, - total: 8, online: 2, active: 8, all: 11, @@ -230,10 +229,6 @@ export default function ({ getService }: FtrProviderContext) { }); }); - it('should work with deprecated api', async () => { - await supertest.get(`/api/fleet/agent-status`).set('kbn-xsrf', 'xxxx').expect(200); - }); - it('should work with adequate package privileges', async () => { await superTestWithoutAuth .get(`/api/fleet/agent_status`) @@ -296,7 +291,6 @@ export default function ({ getService }: FtrProviderContext) { results: { events: 0, other: 0, - total: 10, online: 3, active: 10, all: 11, diff --git a/x-pack/test/fleet_api_integration/apis/agents/update_agent_tags.ts b/x-pack/test/fleet_api_integration/apis/agents/update_agent_tags.ts index 497e82ea6abc4..3a11fc4398aed 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/update_agent_tags.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/update_agent_tags.ts @@ -170,7 +170,7 @@ export default function (providerContext: FtrProviderContext) { it('should not update tags of hosted agent', async () => { // move agent2 to policy2 to keep it regular - await supertest.put(`/api/fleet/agents/agent2/reassign`).set('kbn-xsrf', 'xxx').send({ + await supertest.post(`/api/fleet/agents/agent2/reassign`).set('kbn-xsrf', 'xxx').send({ policy_id: 'policy2', }); // update enrolled policy to hosted diff --git a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts index 33e85b2389b55..621c5843d5dc3 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts @@ -1525,7 +1525,7 @@ export default function (providerContext: FtrProviderContext) { it('enrolled in a hosted agent policy bulk upgrade should respond with 200 and object of results. Should not update the hosted agent SOs', async () => { // move agent2 to policy2 to keep it regular - await supertest.put(`/api/fleet/agents/agent2/reassign`).set('kbn-xsrf', 'xxx').send({ + await supertest.post(`/api/fleet/agents/agent2/reassign`).set('kbn-xsrf', 'xxx').send({ policy_id: 'policy2', }); // update enrolled policy to hosted diff --git a/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts b/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts index 6650105775c0f..474d777fcd906 100644 --- a/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts +++ b/x-pack/test/fleet_api_integration/apis/fleet_telemetry.ts @@ -137,7 +137,7 @@ export default function (providerContext: FtrProviderContext) { .set('kbn-xsrf', 'xxxx') .expect(200); - if (apiResponse.list.length === expectedAgentCount) { + if (apiResponse.items.length === expectedAgentCount) { return apiResponse; } diff --git a/x-pack/test/fleet_api_integration/apis/service_tokens.ts b/x-pack/test/fleet_api_integration/apis/service_tokens.ts index 13fb8545fd80d..7737f2ad7c261 100644 --- a/x-pack/test/fleet_api_integration/apis/service_tokens.ts +++ b/x-pack/test/fleet_api_integration/apis/service_tokens.ts @@ -45,10 +45,6 @@ export default function (providerContext: FtrProviderContext) { }); }); - it('should work with deprecated api', async () => { - await supertest.post(`/api/fleet/service-tokens`).set('kbn-xsrf', 'xxxx').expect(200); - }); - it('should create a valid remote service account token', async () => { const { body: apiResponse } = await supertest .post(`/api/fleet/service_tokens`) diff --git a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts b/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts index 4cb2506977123..f297e4092ba6b 100644 --- a/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts +++ b/x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts @@ -154,7 +154,8 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) { expect(resp.body).to.eql({ statusCode: 403, error: 'Forbidden', - message: 'Forbidden', + message: + 'API [POST /api/spaces/_copy_saved_objects] is unauthorized for user, this action is granted by the Kibana privileges [copySavedObjectsToSpaces]', }); }; diff --git a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts b/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts index e07d56a95ba24..845d41d1431b9 100644 --- a/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts +++ b/x-pack/test/spaces_api_integration/common/suites/resolve_copy_to_space_conflicts.ts @@ -252,7 +252,8 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) { expect(resp.body).to.eql({ statusCode: 403, error: 'Forbidden', - message: 'Forbidden', + message: + 'API [POST /api/spaces/_resolve_copy_saved_objects_errors] is unauthorized for user, this action is granted by the Kibana privileges [copySavedObjectsToSpaces]', }); };