diff --git a/x-pack/plugins/fleet/common/openapi/README.md b/x-pack/plugins/fleet/common/openapi/README.md index 4afbef549f248..7ccccf052f37d 100644 --- a/x-pack/plugins/fleet/common/openapi/README.md +++ b/x-pack/plugins/fleet/common/openapi/README.md @@ -16,8 +16,8 @@ For example, online viewers for the specification like these: * It's currently generated with: ``` - npx swagger-cli bundle -o bundled.json -t json entrypoint.yaml - npx swagger-cli bundle -o bundled.yaml -t yaml entrypoint.yaml + npx @redocly/openapi-cli bundle --ext yaml --output bundled.yaml entrypoint.yaml + npx @redocly/openapi-cli bundle --ext json --output bundled.json entrypoint.yaml ``` * [Paths](paths/README.md): this defines each endpoint. A path can have one operation per http method. * [Components](components/README.md): Reusable components like [`schemas`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject), diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index b121095c8b91b..287ec8c24bafa 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -1,13 +1,16 @@ { "openapi": "3.0.0", + "tags": [], "info": { - "title": "Ingest Manager", + "title": "Fleet", + "description": "OpenAPI schema for Fleet API endpoints", "version": "0.2", "contact": { - "name": "Ingest Team" + "name": "Fleet Team" }, "license": { - "name": "Elastic" + "name": "Elastic License 2.0", + "url": "https://www.elastic.co/licensing/elastic-license" } }, "servers": [ @@ -32,7 +35,7 @@ "items": { "type": "array", "items": { - "$ref": "#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/agent_policy" } }, "total": { @@ -59,31 +62,13 @@ "operationId": "agent-policy-list", "parameters": [ { - "name": "perPage", - "in": "query", - "description": "The number of items to return", - "required": false, - "schema": { - "type": "integer", - "default": 50 - } + "$ref": "#/components/parameters/page_size" }, { - "name": "page", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "default": 1 - } + "$ref": "#/components/parameters/page_index" }, { - "name": "kuery", - "in": "query", - "required": false, - "schema": { - "type": "string" - } + "$ref": "#/components/parameters/kuery" } ], "description": "" @@ -100,58 +85,7 @@ "type": "object", "properties": { "item": { - "allOf": [ - { - "$ref": "#/paths/~1agent_policies/post/requestBody/content/application~1json/schema" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "active", - "inactive" - ] - }, - "packagePolicies": { - "oneOf": [ - { - "items": { - "type": "string" - } - }, - { - "items": { - "$ref": "#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item" - } - } - ], - "type": "array" - }, - "updated_on": { - "type": "string", - "format": "date-time" - }, - "updated_by": { - "type": "string" - }, - "revision": { - "type": "number" - }, - "agents": { - "type": "number" - } - }, - "required": [ - "id", - "status" - ] - } - ] + "$ref": "#/components/schemas/agent_policy" } } } @@ -164,19 +98,7 @@ "content": { "application/json": { "schema": { - "title": "NewAgentPolicy", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "namespace": { - "type": "string" - }, - "description": { - "type": "string" - } - } + "$ref": "#/components/schemas/new_agent_policy" } } } @@ -184,7 +106,7 @@ "security": [], "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -212,7 +134,7 @@ "type": "object", "properties": { "item": { - "$ref": "#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/agent_policy" } }, "required": [ @@ -239,7 +161,7 @@ "type": "object", "properties": { "item": { - "$ref": "#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/agent_policy" } }, "required": [ @@ -255,14 +177,14 @@ "content": { "application/json": { "schema": { - "$ref": "#/paths/~1agent_policies/post/requestBody/content/application~1json/schema" + "$ref": "#/components/schemas/new_agent_policy" } } } }, "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -290,7 +212,7 @@ "type": "object", "properties": { "item": { - "$ref": "#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/agent_policy" } }, "required": [ @@ -375,7 +297,7 @@ }, "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] }, @@ -383,9 +305,56 @@ }, "/agent-status": { "get": { - "summary": "Fleet - Agent - Status for policy", + "summary": "Fleet - Agent - Summary stats", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "integer" + }, + "events": { + "type": "integer" + }, + "inactive": { + "type": "integer" + }, + "offline": { + "type": "integer" + }, + "online": { + "type": "integer" + }, + "other": { + "type": "integer" + }, + "total": { + "type": "integer" + }, + "updating": { + "type": "integer" + } + }, + "required": [ + "error", + "events", + "inactive", + "offline", + "online", + "other", + "total", + "updating" + ] + } + } + } + } + }, "operationId": "get-fleet-agent-status", "parameters": [ { @@ -414,7 +383,7 @@ "list": { "type": "array", "items": { - "type": "object" + "$ref": "#/components/schemas/agent_policy" } }, "total": { @@ -460,11 +429,46 @@ "post": { "summary": "Fleet - Agent - Unenroll", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "400": { + "description": "BAD REQUEST", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "message": { + "type": "string" + }, + "statusCode": { + "type": "number", + "enum": [ + 400 + ] + } + } + } + } + } + } + }, "operationId": "post-fleet-agents-unenroll", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ], "requestBody": { @@ -506,7 +510,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema" + "$ref": "#/components/schemas/upgrade_agent" } } } @@ -516,7 +520,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema" + "$ref": "#/components/schemas/upgrade_agent" } } } @@ -525,7 +529,7 @@ "operationId": "post-fleet-agents-upgrade", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ], "requestBody": { @@ -533,34 +537,7 @@ "content": { "application/json": { "schema": { - "title": "UpgradeAgent", - "oneOf": [ - { - "type": "object", - "properties": { - "version": { - "type": "string" - } - }, - "required": [ - "version" - ] - }, - { - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "source_uri": { - "type": "string" - } - }, - "required": [ - "version" - ] - } - ] + "$ref": "#/components/schemas/upgrade_agent" } } } @@ -577,7 +554,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/paths/~1agents~1bulk_upgrade/post/requestBody/content/application~1json/schema" + "$ref": "#/components/schemas/bulk_upgrade_agents" } } } @@ -587,7 +564,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema" + "$ref": "#/components/schemas/upgrade_agent" } } } @@ -596,7 +573,7 @@ "operationId": "post-fleet-agents-bulk-upgrade", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ], "requestBody": { @@ -604,66 +581,7 @@ "content": { "application/json": { "schema": { - "title": "BulkUpgradeAgents", - "oneOf": [ - { - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "version", - "agents" - ] - }, - { - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "source_uri": { - "type": "string" - }, - "agents": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "version", - "agents" - ] - }, - { - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "source_uri": { - "type": "string" - }, - "agents": { - "type": "string" - } - }, - "required": [ - "version", - "agents" - ] - } - ] + "$ref": "#/components/schemas/bulk_upgrade_agents" } } } @@ -747,7 +665,7 @@ }, "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -756,18 +674,74 @@ "get": { "summary": "Enrollment - List", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "list": { + "type": "array", + "items": { + "$ref": "#/components/schemas/enrollment_api_key" + } + }, + "page": { + "type": "number" + }, + "perPage": { + "type": "number" + }, + "total": { + "type": "number" + } + }, + "required": [ + "list", + "page", + "perPage", + "total" + ] + } + } + } + } + }, "operationId": "get-fleet-enrollment-api-keys", "parameters": [] }, "post": { "summary": "Enrollment - Create", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "item": { + "$ref": "#/components/schemas/enrollment_api_key" + }, + "action": { + "type": "string", + "enum": [ + "created" + ] + } + } + } + } + } + } + }, "operationId": "post-fleet-enrollment-api-keys", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -786,17 +760,58 @@ "get": { "summary": "Enrollment - Info", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "item": { + "$ref": "#/components/schemas/enrollment_api_key" + } + }, + "required": [ + "item" + ] + } + } + } + } + }, "operationId": "get-fleet-enrollment-api-keys-keyId" }, "delete": { "summary": "Enrollment - Delete", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": [ + "deleted" + ] + } + }, + "required": [ + "action" + ] + } + } + } + } + }, "operationId": "delete-fleet-enrollment-api-keys-keyId", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -851,51 +866,7 @@ "schema": { "type": "array", "items": { - "title": "SearchResult", - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "download": { - "type": "string" - }, - "icons": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "title": { - "type": "string" - }, - "type": { - "type": "string" - }, - "version": { - "type": "string" - }, - "status": { - "type": "string" - }, - "savedObject": { - "type": "object" - } - }, - "required": [ - "description", - "download", - "icons", - "name", - "path", - "title", - "type", - "version", - "status" - ] + "$ref": "#/components/schemas/search_result" } } } @@ -921,182 +892,7 @@ { "properties": { "response": { - "title": "PackageInfo", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "title": { - "type": "string" - }, - "version": { - "type": "string" - }, - "readme": { - "type": "string" - }, - "description": { - "type": "string" - }, - "type": { - "type": "string" - }, - "categories": { - "type": "array", - "items": { - "type": "string" - } - }, - "requirement": { - "oneOf": [ - { - "properties": { - "kibana": { - "type": "object", - "properties": { - "versions": { - "type": "string" - } - } - } - } - }, - { - "properties": { - "elasticsearch": { - "type": "object", - "properties": { - "versions": { - "type": "string" - } - } - } - } - } - ], - "type": "object" - }, - "screenshots": { - "type": "array", - "items": { - "type": "object", - "properties": { - "src": { - "type": "string" - }, - "path": { - "type": "string" - }, - "title": { - "type": "string" - }, - "size": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "required": [ - "src", - "path" - ] - } - }, - "icons": { - "type": "array", - "items": { - "type": "string" - } - }, - "assets": { - "type": "array", - "items": { - "type": "string" - } - }, - "internal": { - "type": "boolean" - }, - "format_version": { - "type": "string" - }, - "data_streams": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "name": { - "type": "string" - }, - "release": { - "type": "string" - }, - "ingeset_pipeline": { - "type": "string" - }, - "vars": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "default": { - "type": "string" - } - }, - "required": [ - "name", - "default" - ] - } - }, - "type": { - "type": "string" - }, - "package": { - "type": "string" - } - }, - "required": [ - "title", - "name", - "release", - "ingeset_pipeline", - "type", - "package" - ] - } - }, - "download": { - "type": "string" - }, - "path": { - "type": "string" - }, - "removable": { - "type": "boolean" - } - }, - "required": [ - "name", - "title", - "version", - "description", - "type", - "categories", - "requirement", - "assets", - "format_version", - "download", - "path" - ] + "$ref": "#/components/schemas/package_info" } } }, @@ -1183,7 +979,7 @@ "description": "", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] }, @@ -1228,7 +1024,7 @@ "operationId": "post-epm-delete-pkgkey", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ], "requestBody": { @@ -1270,7 +1066,7 @@ "type": "object", "properties": { "item": { - "type": "object" + "$ref": "#/components/schemas/agent" } }, "required": [ @@ -1286,44 +1082,67 @@ "put": { "summary": "Fleet - Agent - Update", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "item": { + "$ref": "#/components/schemas/agent" + } + }, + "required": [ + "item" + ] + } + } + } + } + }, "operationId": "put-fleet-agents-agentId", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] }, "delete": { "summary": "Fleet - Agent - Delete", "tags": [], - "responses": {}, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "action": { + "type": "string", + "enum": [ + "deleted" + ] + } + }, + "required": [ + "action" + ] + } + } + } + } + }, "operationId": "delete-fleet-agents-agentId", "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } }, - "/install/{osType}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "osType", - "in": "path", - "required": true - } - ], - "get": { - "summary": "Fleet - Get OS install script", - "tags": [], - "responses": {}, - "operationId": "get-fleet-install-osType" - } - }, "/package_policies": { "get": { "summary": "PackagePolicies - List", @@ -1339,7 +1158,7 @@ "items": { "type": "array", "items": { - "$ref": "#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/package_policy" } }, "total": { @@ -1377,96 +1196,14 @@ "content": { "application/json": { "schema": { - "title": "NewPackagePolicy", - "type": "object", - "description": "", - "properties": { - "enabled": { - "type": "boolean" - }, - "package": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - }, - "title": { - "type": "string" - } - }, - "required": [ - "name", - "version", - "title" - ] - }, - "namespace": { - "type": "string" - }, - "output_id": { - "type": "string" - }, - "inputs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "processors": { - "type": "array", - "items": { - "type": "string" - } - }, - "streams": { - "type": "array", - "items": {} - }, - "config": { - "type": "object" - }, - "vars": { - "type": "object" - } - }, - "required": [ - "type", - "enabled", - "streams" - ] - } - }, - "policy_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - }, - "required": [ - "output_id", - "inputs", - "policy_id", - "name" - ] + "$ref": "#/components/schemas/new_package_policy" } } } }, "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -1484,31 +1221,7 @@ "type": "object", "properties": { "item": { - "title": "PackagePolicy", - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "revision": { - "type": "number" - }, - "inputs": { - "type": "array", - "items": {} - } - }, - "required": [ - "id", - "revision" - ] - }, - { - "$ref": "#/paths/~1package_policies/post/requestBody/content/application~1json/schema" - } - ] + "$ref": "#/components/schemas/package_policy" } }, "required": [ @@ -1538,20 +1251,7 @@ "content": { "application/json": { "schema": { - "title": "UpdatePackagePolicy", - "allOf": [ - { - "type": "object", - "properties": { - "version": { - "type": "string" - } - } - }, - { - "$ref": "#/paths/~1package_policies/post/requestBody/content/application~1json/schema" - } - ] + "$ref": "#/components/schemas/update_package_policy" } } } @@ -1565,7 +1265,7 @@ "type": "object", "properties": { "item": { - "$ref": "#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item" + "$ref": "#/components/schemas/package_policy" }, "sucess": { "type": "boolean" @@ -1582,14 +1282,14 @@ }, "parameters": [ { - "$ref": "#/paths/~1setup/post/parameters/0" + "$ref": "#/components/parameters/kbn_xsrf" } ] } }, "/setup": { "post": { - "summary": "Ingest Manager - Setup", + "summary": "Fleet - Setup", "tags": [], "responses": { "200": { @@ -1626,12 +1326,7 @@ "operationId": "post-setup", "parameters": [ { - "schema": { - "type": "string" - }, - "in": "header", - "name": "kbn-xsrf", - "required": true + "$ref": "#/components/parameters/kbn_xsrf" } ] } @@ -1643,18 +1338,694 @@ "type": "http", "scheme": "basic" }, - "Enrollment API Key": { + "Enrollment_API_Key": { "name": "Authorization", "type": "apiKey", "in": "header", "description": "e.g. Authorization: ApiKey base64EnrollmentApiKey" }, - "Access API Key": { + "Access_API_Key": { "name": "Authorization", "type": "apiKey", "in": "header", "description": "e.g. Authorization: ApiKey base64AccessApiKey" } + }, + "parameters": { + "page_size": { + "name": "perPage", + "in": "query", + "description": "The number of items to return", + "required": false, + "schema": { + "type": "integer", + "default": 50 + } + }, + "page_index": { + "name": "page", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "default": 1 + } + }, + "kuery": { + "name": "kuery", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + "kbn_xsrf": { + "schema": { + "type": "string" + }, + "in": "header", + "name": "kbn-xsrf", + "required": true + } + }, + "schemas": { + "new_agent_policy": { + "title": "NewAgentPolicy", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "description": { + "type": "string" + } + } + }, + "new_package_policy": { + "title": "NewPackagePolicy", + "type": "object", + "description": "", + "properties": { + "enabled": { + "type": "boolean" + }, + "package": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "name", + "version", + "title" + ] + }, + "namespace": { + "type": "string" + }, + "output_id": { + "type": "string" + }, + "inputs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "processors": { + "type": "array", + "items": { + "type": "string" + } + }, + "streams": { + "type": "array", + "items": {} + }, + "config": { + "type": "object" + }, + "vars": { + "type": "object" + } + }, + "required": [ + "type", + "enabled", + "streams" + ] + } + }, + "policy_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "output_id", + "inputs", + "policy_id", + "name" + ] + }, + "package_policy": { + "title": "PackagePolicy", + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "revision": { + "type": "number" + }, + "inputs": { + "type": "array", + "items": {} + } + }, + "required": [ + "id", + "revision" + ] + }, + { + "$ref": "#/components/schemas/new_package_policy" + } + ] + }, + "agent_policy": { + "allOf": [ + { + "$ref": "#/components/schemas/new_agent_policy" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "active", + "inactive" + ] + }, + "packagePolicies": { + "oneOf": [ + { + "items": { + "type": "string" + } + }, + { + "items": { + "$ref": "#/components/schemas/package_policy" + } + } + ], + "type": "array" + }, + "updated_on": { + "type": "string", + "format": "date-time" + }, + "updated_by": { + "type": "string" + }, + "revision": { + "type": "number" + }, + "agents": { + "type": "number" + } + }, + "required": [ + "id", + "status" + ] + } + ] + }, + "upgrade_agent": { + "title": "UpgradeAgent", + "oneOf": [ + { + "type": "object", + "properties": { + "version": { + "type": "string" + } + }, + "required": [ + "version" + ] + }, + { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "source_uri": { + "type": "string" + } + }, + "required": [ + "version" + ] + } + ] + }, + "bulk_upgrade_agents": { + "title": "BulkUpgradeAgents", + "oneOf": [ + { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "agents": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "version", + "agents" + ] + }, + { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "source_uri": { + "type": "string" + }, + "agents": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "version", + "agents" + ] + }, + { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "source_uri": { + "type": "string" + }, + "agents": { + "type": "string" + } + }, + "required": [ + "version", + "agents" + ] + } + ] + }, + "enrollment_api_key": { + "title": "EnrollmentApiKey", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "api_key_id": { + "type": "string" + }, + "api_key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "policy_id": { + "type": "string" + }, + "created_at": { + "type": "string" + } + }, + "required": [ + "id", + "api_key_id", + "api_key", + "active", + "created_at" + ] + }, + "search_result": { + "title": "SearchResult", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "download": { + "type": "string" + }, + "icons": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "type": "string" + }, + "version": { + "type": "string" + }, + "status": { + "type": "string" + }, + "savedObject": { + "type": "object" + } + }, + "required": [ + "description", + "download", + "icons", + "name", + "path", + "title", + "type", + "version", + "status" + ] + }, + "package_info": { + "title": "PackageInfo", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "title": { + "type": "string" + }, + "version": { + "type": "string" + }, + "readme": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "categories": { + "type": "array", + "items": { + "type": "string" + } + }, + "requirement": { + "oneOf": [ + { + "properties": { + "kibana": { + "type": "object", + "properties": { + "versions": { + "type": "string" + } + } + } + } + }, + { + "properties": { + "elasticsearch": { + "type": "object", + "properties": { + "versions": { + "type": "string" + } + } + } + } + } + ], + "type": "object" + }, + "screenshots": { + "type": "array", + "items": { + "type": "object", + "properties": { + "src": { + "type": "string" + }, + "path": { + "type": "string" + }, + "title": { + "type": "string" + }, + "size": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "src", + "path" + ] + } + }, + "icons": { + "type": "array", + "items": { + "type": "string" + } + }, + "assets": { + "type": "array", + "items": { + "type": "string" + } + }, + "internal": { + "type": "boolean" + }, + "format_version": { + "type": "string" + }, + "data_streams": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "name": { + "type": "string" + }, + "release": { + "type": "string" + }, + "ingeset_pipeline": { + "type": "string" + }, + "vars": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "default": { + "type": "string" + } + }, + "required": [ + "name", + "default" + ] + } + }, + "type": { + "type": "string" + }, + "package": { + "type": "string" + } + }, + "required": [ + "title", + "name", + "release", + "ingeset_pipeline", + "type", + "package" + ] + } + }, + "download": { + "type": "string" + }, + "path": { + "type": "string" + }, + "removable": { + "type": "boolean" + } + }, + "required": [ + "name", + "title", + "version", + "description", + "type", + "categories", + "requirement", + "assets", + "format_version", + "download", + "path" + ] + }, + "agent_type": { + "type": "string", + "title": "AgentType", + "enum": [ + "PERMANENT", + "EPHEMERAL", + "TEMPORARY" + ] + }, + "agent_metadata": { + "title": "AgentMetadata", + "type": "object" + }, + "agent_status": { + "type": "string", + "title": "AgentStatus", + "enum": [ + "offline", + "error", + "online", + "inactive", + "warning" + ] + }, + "agent": { + "title": "Agent", + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/agent_type" + }, + "active": { + "type": "boolean" + }, + "enrolled_at": { + "type": "string" + }, + "unenrolled_at": { + "type": "string" + }, + "unenrollment_started_at": { + "type": "string" + }, + "shared_id": { + "type": "string", + "deprecated": true + }, + "access_api_key_id": { + "type": "string" + }, + "default_api_key_id": { + "type": "string" + }, + "policy_id": { + "type": "string" + }, + "policy_revision": { + "type": "number" + }, + "last_checkin": { + "type": "string" + }, + "user_provided_metadata": { + "$ref": "#/components/schemas/agent_metadata" + }, + "local_metadata": { + "$ref": "#/components/schemas/agent_metadata" + }, + "id": { + "type": "string" + }, + "access_api_key": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/agent_status" + }, + "default_api_key": { + "type": "string" + } + }, + "required": [ + "type", + "active", + "enrolled_at", + "id", + "status" + ] + }, + "update_package_policy": { + "title": "UpdatePackagePolicy", + "allOf": [ + { + "type": "object", + "properties": { + "version": { + "type": "string" + } + } + }, + { + "$ref": "#/components/schemas/new_package_policy" + } + ] + } } }, "security": [ @@ -1662,4 +2033,4 @@ "basicAuth": [] } ] -} +} \ No newline at end of file diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 537ef136c7611..b91540f4cdeea 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -1,11 +1,14 @@ openapi: 3.0.0 +tags: [] info: - title: Ingest Manager + title: Fleet + description: OpenAPI schema for Fleet API endpoints version: '0.2' contact: - name: Ingest Team + name: Fleet Team license: - name: Elastic + name: Elastic License 2.0 + url: 'https://www.elastic.co/licensing/elastic-license' servers: - url: 'http://localhost:5601/api/fleet' description: local @@ -25,7 +28,7 @@ paths: items: type: array items: - $ref: '#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/agent_policy' total: type: number page: @@ -39,24 +42,9 @@ paths: - perPage operationId: agent-policy-list parameters: - - name: perPage - in: query - description: The number of items to return - required: false - schema: - type: integer - default: 50 - - name: page - in: query - required: false - schema: - type: integer - default: 1 - - name: kuery - in: query - required: false - schema: - type: string + - $ref: '#/components/parameters/page_size' + - $ref: '#/components/parameters/page_index' + - $ref: '#/components/parameters/kuery' description: '' post: summary: Agent policy - Create @@ -70,53 +58,16 @@ paths: type: object properties: item: - allOf: - - $ref: '#/paths/~1agent_policies/post/requestBody/content/application~1json/schema' - - type: object - properties: - id: - type: string - status: - type: string - enum: - - active - - inactive - packagePolicies: - oneOf: - - items: - type: string - - items: - $ref: '#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item' - type: array - updated_on: - type: string - format: date-time - updated_by: - type: string - revision: - type: number - agents: - type: number - required: - - id - - status + $ref: '#/components/schemas/agent_policy' operationId: post-agent-policy requestBody: content: application/json: schema: - title: NewAgentPolicy - type: object - properties: - name: - type: string - namespace: - type: string - description: - type: string + $ref: '#/components/schemas/new_agent_policy' security: [] parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' '/agent_policies/{agentPolicyId}': parameters: - schema: @@ -136,7 +87,7 @@ paths: type: object properties: item: - $ref: '#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/agent_policy' required: - item operationId: agent-policy-info @@ -154,7 +105,7 @@ paths: type: object properties: item: - $ref: '#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/agent_policy' required: - item operationId: put-agent-policy-agentPolicyId @@ -162,9 +113,9 @@ paths: content: application/json: schema: - $ref: '#/paths/~1agent_policies/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/new_agent_policy' parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' '/agent_policies/{agentPolicyId}/copy': parameters: - schema: @@ -184,7 +135,7 @@ paths: type: object properties: item: - $ref: '#/paths/~1agent_policies/post/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/agent_policy' required: - item requestBody: @@ -233,13 +184,45 @@ paths: items: type: string parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' parameters: [] /agent-status: get: - summary: Fleet - Agent - Status for policy + summary: Fleet - Agent - Summary stats tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + error: + type: integer + events: + type: integer + inactive: + type: integer + offline: + type: integer + online: + type: integer + other: + type: integer + total: + type: integer + updating: + type: integer + required: + - error + - events + - inactive + - offline + - online + - other + - total + - updating operationId: get-fleet-agent-status parameters: - schema: @@ -262,7 +245,7 @@ paths: list: type: array items: - type: object + $ref: '#/components/schemas/agent_policy' total: type: number page: @@ -287,10 +270,31 @@ paths: post: summary: Fleet - Agent - Unenroll tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: BAD REQUEST + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + enum: + - 400 operationId: post-fleet-agents-unenroll parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' requestBody: content: application/json: @@ -317,37 +321,22 @@ paths: content: application/json: schema: - $ref: '#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/upgrade_agent' '400': description: BAD REQUEST content: application/json: schema: - $ref: '#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/upgrade_agent' operationId: post-fleet-agents-upgrade parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' requestBody: required: true content: application/json: schema: - title: UpgradeAgent - oneOf: - - type: object - properties: - version: - type: string - required: - - version - - type: object - properties: - version: - type: string - source_uri: - type: string - required: - - version + $ref: '#/components/schemas/upgrade_agent' /agents/bulk_upgrade: post: summary: Fleet - Agent - Bulk Upgrade @@ -358,58 +347,22 @@ paths: content: application/json: schema: - $ref: '#/paths/~1agents~1bulk_upgrade/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/bulk_upgrade_agents' '400': description: BAD REQUEST content: application/json: schema: - $ref: '#/paths/~1agents~1%7BagentId%7D~1upgrade/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/upgrade_agent' operationId: post-fleet-agents-bulk-upgrade parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' requestBody: required: true content: application/json: schema: - title: BulkUpgradeAgents - oneOf: - - type: object - properties: - version: - type: string - agents: - type: array - items: - type: string - required: - - version - - agents - - type: object - properties: - version: - type: string - source_uri: - type: string - agents: - type: array - items: - type: string - required: - - version - - agents - - type: object - properties: - version: - type: string - source_uri: - type: string - agents: - type: string - required: - - version - - agents + $ref: '#/components/schemas/bulk_upgrade_agents' /agents/setup: get: summary: Agents setup - Info @@ -458,21 +411,56 @@ paths: - admin_username - admin_password parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' /enrollment-api-keys: get: summary: Enrollment - List tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + $ref: '#/components/schemas/enrollment_api_key' + page: + type: number + perPage: + type: number + total: + type: number + required: + - list + - page + - perPage + - total operationId: get-fleet-enrollment-api-keys parameters: [] post: summary: Enrollment - Create tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: '#/components/schemas/enrollment_api_key' + action: + type: string + enum: + - created operationId: post-fleet-enrollment-api-keys parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' '/enrollment-api-keys/{keyId}': parameters: - schema: @@ -483,15 +471,39 @@ paths: get: summary: Enrollment - Info tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: '#/components/schemas/enrollment_api_key' + required: + - item operationId: get-fleet-enrollment-api-keys-keyId delete: summary: Enrollment - Delete tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + action: + type: string + enum: + - deleted + required: + - action operationId: delete-fleet-enrollment-api-keys-keyId parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' /epm/categories: get: summary: EPM - Categories @@ -529,39 +541,7 @@ paths: schema: type: array items: - title: SearchResult - type: object - properties: - description: - type: string - download: - type: string - icons: - type: string - name: - type: string - path: - type: string - title: - type: string - type: - type: string - version: - type: string - status: - type: string - savedObject: - type: object - required: - - description - - download - - icons - - name - - path - - title - - type - - version - - status + $ref: '#/components/schemas/search_result' operationId: get-epm-list parameters: [] '/epm/packages/{pkgkey}': @@ -578,124 +558,7 @@ paths: allOf: - properties: response: - title: PackageInfo - type: object - properties: - name: - type: string - title: - type: string - version: - type: string - readme: - type: string - description: - type: string - type: - type: string - categories: - type: array - items: - type: string - requirement: - oneOf: - - properties: - kibana: - type: object - properties: - versions: - type: string - - properties: - elasticsearch: - type: object - properties: - versions: - type: string - type: object - screenshots: - type: array - items: - type: object - properties: - src: - type: string - path: - type: string - title: - type: string - size: - type: string - type: - type: string - required: - - src - - path - icons: - type: array - items: - type: string - assets: - type: array - items: - type: string - internal: - type: boolean - format_version: - type: string - data_streams: - type: array - items: - type: object - properties: - title: - type: string - name: - type: string - release: - type: string - ingeset_pipeline: - type: string - vars: - type: array - items: - type: object - properties: - name: - type: string - default: - type: string - required: - - name - - default - type: - type: string - package: - type: string - required: - - title - - name - - release - - ingeset_pipeline - - type - - package - download: - type: string - path: - type: string - removable: - type: boolean - required: - - name - - title - - version - - description - - type - - categories - - requirement - - assets - - format_version - - download - - path + $ref: '#/components/schemas/package_info' - properties: status: type: string @@ -744,7 +607,7 @@ paths: operationId: post-epm-install-pkgkey description: '' parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' delete: summary: EPM - Packages - Delete tags: [] @@ -772,7 +635,7 @@ paths: - response operationId: post-epm-delete-pkgkey parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' requestBody: content: application/json: @@ -800,36 +663,48 @@ paths: type: object properties: item: - type: object + $ref: '#/components/schemas/agent' required: - item operationId: get-fleet-agents-agentId put: summary: Fleet - Agent - Update tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: '#/components/schemas/agent' + required: + - item operationId: put-fleet-agents-agentId parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' delete: summary: Fleet - Agent - Delete tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + action: + type: string + enum: + - deleted + required: + - action operationId: delete-fleet-agents-agentId parameters: - - $ref: '#/paths/~1setup/post/parameters/0' - '/install/{osType}': - parameters: - - schema: - type: string - name: osType - in: path - required: true - get: - summary: Fleet - Get OS install script - tags: [] - responses: {} - operationId: get-fleet-install-osType + - $ref: '#/components/parameters/kbn_xsrf' /package_policies: get: summary: PackagePolicies - List @@ -845,7 +720,7 @@ paths: items: type: array items: - $ref: '#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/package_policy' total: type: number page: @@ -868,66 +743,9 @@ paths: content: application/json: schema: - title: NewPackagePolicy - type: object - description: '' - properties: - enabled: - type: boolean - package: - type: object - properties: - name: - type: string - version: - type: string - title: - type: string - required: - - name - - version - - title - namespace: - type: string - output_id: - type: string - inputs: - type: array - items: - type: object - properties: - type: - type: string - enabled: - type: boolean - processors: - type: array - items: - type: string - streams: - type: array - items: {} - config: - type: object - vars: - type: object - required: - - type - - enabled - - streams - policy_id: - type: string - name: - type: string - description: - type: string - required: - - output_id - - inputs - - policy_id - - name + $ref: '#/components/schemas/new_package_policy' parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' '/package_policies/{packagePolicyId}': get: summary: PackagePolicies - Info @@ -941,21 +759,7 @@ paths: type: object properties: item: - title: PackagePolicy - allOf: - - type: object - properties: - id: - type: string - revision: - type: number - inputs: - type: array - items: {} - required: - - id - - revision - - $ref: '#/paths/~1package_policies/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/package_policy' required: - item operationId: get-packagePolicies-packagePolicyId @@ -972,13 +776,7 @@ paths: content: application/json: schema: - title: UpdatePackagePolicy - allOf: - - type: object - properties: - version: - type: string - - $ref: '#/paths/~1package_policies/post/requestBody/content/application~1json/schema' + $ref: '#/components/schemas/update_package_policy' responses: '200': description: OK @@ -988,17 +786,17 @@ paths: type: object properties: item: - $ref: '#/paths/~1package_policies~1%7BpackagePolicyId%7D/get/responses/200/content/application~1json/schema/properties/item' + $ref: '#/components/schemas/package_policy' sucess: type: boolean required: - item - sucess parameters: - - $ref: '#/paths/~1setup/post/parameters/0' + - $ref: '#/components/parameters/kbn_xsrf' /setup: post: - summary: Ingest Manager - Setup + summary: Fleet - Setup tags: [] responses: '200': @@ -1021,25 +819,470 @@ paths: type: string operationId: post-setup parameters: - - schema: - type: string - in: header - name: kbn-xsrf - required: true + - $ref: '#/components/parameters/kbn_xsrf' components: securitySchemes: basicAuth: type: http scheme: basic - Enrollment API Key: + Enrollment_API_Key: name: Authorization type: apiKey in: header description: 'e.g. Authorization: ApiKey base64EnrollmentApiKey' - Access API Key: + Access_API_Key: name: Authorization type: apiKey in: header description: 'e.g. Authorization: ApiKey base64AccessApiKey' + parameters: + page_size: + name: perPage + in: query + description: The number of items to return + required: false + schema: + type: integer + default: 50 + page_index: + name: page + in: query + required: false + schema: + type: integer + default: 1 + kuery: + name: kuery + in: query + required: false + schema: + type: string + kbn_xsrf: + schema: + type: string + in: header + name: kbn-xsrf + required: true + schemas: + new_agent_policy: + title: NewAgentPolicy + type: object + properties: + name: + type: string + namespace: + type: string + description: + type: string + new_package_policy: + title: NewPackagePolicy + type: object + description: '' + properties: + enabled: + type: boolean + package: + type: object + properties: + name: + type: string + version: + type: string + title: + type: string + required: + - name + - version + - title + namespace: + type: string + output_id: + type: string + inputs: + type: array + items: + type: object + properties: + type: + type: string + enabled: + type: boolean + processors: + type: array + items: + type: string + streams: + type: array + items: {} + config: + type: object + vars: + type: object + required: + - type + - enabled + - streams + policy_id: + type: string + name: + type: string + description: + type: string + required: + - output_id + - inputs + - policy_id + - name + package_policy: + title: PackagePolicy + allOf: + - type: object + properties: + id: + type: string + revision: + type: number + inputs: + type: array + items: {} + required: + - id + - revision + - $ref: '#/components/schemas/new_package_policy' + agent_policy: + allOf: + - $ref: '#/components/schemas/new_agent_policy' + - type: object + properties: + id: + type: string + status: + type: string + enum: + - active + - inactive + packagePolicies: + oneOf: + - items: + type: string + - items: + $ref: '#/components/schemas/package_policy' + type: array + updated_on: + type: string + format: date-time + updated_by: + type: string + revision: + type: number + agents: + type: number + required: + - id + - status + upgrade_agent: + title: UpgradeAgent + oneOf: + - type: object + properties: + version: + type: string + required: + - version + - type: object + properties: + version: + type: string + source_uri: + type: string + required: + - version + bulk_upgrade_agents: + title: BulkUpgradeAgents + oneOf: + - type: object + properties: + version: + type: string + agents: + type: array + items: + type: string + required: + - version + - agents + - type: object + properties: + version: + type: string + source_uri: + type: string + agents: + type: array + items: + type: string + required: + - version + - agents + - type: object + properties: + version: + type: string + source_uri: + type: string + agents: + type: string + required: + - version + - agents + enrollment_api_key: + title: EnrollmentApiKey + type: object + properties: + id: + type: string + api_key_id: + type: string + api_key: + type: string + name: + type: string + active: + type: boolean + policy_id: + type: string + created_at: + type: string + required: + - id + - api_key_id + - api_key + - active + - created_at + search_result: + title: SearchResult + type: object + properties: + description: + type: string + download: + type: string + icons: + type: string + name: + type: string + path: + type: string + title: + type: string + type: + type: string + version: + type: string + status: + type: string + savedObject: + type: object + required: + - description + - download + - icons + - name + - path + - title + - type + - version + - status + package_info: + title: PackageInfo + type: object + properties: + name: + type: string + title: + type: string + version: + type: string + readme: + type: string + description: + type: string + type: + type: string + categories: + type: array + items: + type: string + requirement: + oneOf: + - properties: + kibana: + type: object + properties: + versions: + type: string + - properties: + elasticsearch: + type: object + properties: + versions: + type: string + type: object + screenshots: + type: array + items: + type: object + properties: + src: + type: string + path: + type: string + title: + type: string + size: + type: string + type: + type: string + required: + - src + - path + icons: + type: array + items: + type: string + assets: + type: array + items: + type: string + internal: + type: boolean + format_version: + type: string + data_streams: + type: array + items: + type: object + properties: + title: + type: string + name: + type: string + release: + type: string + ingeset_pipeline: + type: string + vars: + type: array + items: + type: object + properties: + name: + type: string + default: + type: string + required: + - name + - default + type: + type: string + package: + type: string + required: + - title + - name + - release + - ingeset_pipeline + - type + - package + download: + type: string + path: + type: string + removable: + type: boolean + required: + - name + - title + - version + - description + - type + - categories + - requirement + - assets + - format_version + - download + - path + agent_type: + type: string + title: AgentType + enum: + - PERMANENT + - EPHEMERAL + - TEMPORARY + agent_metadata: + title: AgentMetadata + type: object + agent_status: + type: string + title: AgentStatus + enum: + - offline + - error + - online + - inactive + - warning + agent: + title: Agent + type: object + properties: + type: + $ref: '#/components/schemas/agent_type' + active: + type: boolean + enrolled_at: + type: string + unenrolled_at: + type: string + unenrollment_started_at: + type: string + shared_id: + type: string + deprecated: true + access_api_key_id: + type: string + default_api_key_id: + type: string + policy_id: + type: string + policy_revision: + type: number + last_checkin: + type: string + user_provided_metadata: + $ref: '#/components/schemas/agent_metadata' + local_metadata: + $ref: '#/components/schemas/agent_metadata' + id: + type: string + access_api_key: + type: string + status: + $ref: '#/components/schemas/agent_status' + default_api_key: + type: string + required: + - type + - active + - enrolled_at + - id + - status + update_package_policy: + title: UpdatePackagePolicy + allOf: + - type: object + properties: + version: + type: string + - $ref: '#/components/schemas/new_package_policy' security: - basicAuth: [] diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/enrollment_api_key.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/enrollment_api_key.yaml index 3efe77b3bd606..e8491504d8416 100644 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/enrollment_api_key.yaml +++ b/x-pack/plugins/fleet/common/openapi/components/schemas/enrollment_api_key.yaml @@ -1,3 +1,23 @@ -type: string title: EnrollmentApiKey -format: byte +type: object +properties: + id: + type: string + api_key_id: + type: string + api_key: + type: string + name: + type: string + active: + type: boolean + policy_id: + type: string + created_at: + type: string +required: + - id + - api_key_id + - api_key + - active + - created_at diff --git a/x-pack/plugins/fleet/common/openapi/entrypoint.yaml b/x-pack/plugins/fleet/common/openapi/entrypoint.yaml index 6ea8ae966bdca..f4d39287b4322 100644 --- a/x-pack/plugins/fleet/common/openapi/entrypoint.yaml +++ b/x-pack/plugins/fleet/common/openapi/entrypoint.yaml @@ -1,11 +1,14 @@ openapi: 3.0.0 +tags: [] info: - title: Ingest Manager + title: Fleet + description: OpenAPI schema for Fleet API endpoints version: '0.2' contact: - name: Ingest Team + name: Fleet Team license: - name: Elastic + name: Elastic License 2.0 + url: https://www.elastic.co/licensing/elastic-license servers: - url: 'http://localhost:5601/api/fleet' description: local @@ -42,8 +45,6 @@ paths: $ref: 'paths/epm@packages@{pkgkey}.yaml' '/agents/{agentId}': $ref: 'paths/agents@{agent_id}.yaml' - '/install/{osType}': - $ref: 'paths/install@{os_type}.yaml' /package_policies: $ref: paths/package_policies.yaml '/package_policies/{packagePolicyId}': @@ -55,12 +56,12 @@ components: basicAuth: type: http scheme: basic - Enrollment API Key: + Enrollment_API_Key: name: Authorization type: apiKey in: header description: 'e.g. Authorization: ApiKey base64EnrollmentApiKey' - Access API Key: + Access_API_Key: name: Authorization type: apiKey in: header diff --git a/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml b/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml index 77ec9e85069a2..b6dbd04c7d8ea 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agent_status.yaml @@ -1,7 +1,39 @@ get: - summary: Fleet - Agent - Status for policy + summary: Fleet - Agent - Summary stats tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + error: + type: integer + events: + type: integer + inactive: + type: integer + offline: + type: integer + online: + type: integer + other: + type: integer + total: + type: integer + updating: + type: integer + required: + - error + - events + - inactive + - offline + - online + - other + - total + - updating operationId: get-fleet-agent-status parameters: - schema: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents.yaml index e5039bc2caccf..c20ba259fe016 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents.yaml @@ -12,7 +12,7 @@ get: list: type: array items: - type: object + $ref: ../components/schemas/agent_policy.yaml total: type: number page: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}.yaml index e65c80d8fae88..780bd085b1285 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}.yaml @@ -16,21 +16,45 @@ get: type: object properties: item: - type: object + $ref: ../components/schemas/agent.yaml required: - item operationId: get-fleet-agents-agentId put: summary: Fleet - Agent - Update tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: ../components/schemas/agent.yaml + required: + - item operationId: put-fleet-agents-agentId parameters: - $ref: ../components/headers/kbn_xsrf.yaml delete: summary: Fleet - Agent - Delete tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + action: + type: string + enum: + - deleted + required: + - action operationId: delete-fleet-agents-agentId parameters: - $ref: ../components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml index eccbbbfc9b8ca..02ca76f135b2d 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@{agent_id}@unenroll.yaml @@ -7,7 +7,28 @@ parameters: post: summary: Fleet - Agent - Unenroll tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: BAD REQUEST + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + statusCode: + type: number + enum: + - 400 operationId: post-fleet-agents-unenroll parameters: - $ref: ../components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys.yaml b/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys.yaml index 22d27c0596d68..a954714f33d00 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys.yaml @@ -1,13 +1,48 @@ get: summary: Enrollment - List tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + $ref: ../components/schemas/enrollment_api_key.yaml + page: + type: number + perPage: + type: number + total: + type: number + required: + - list + - page + - perPage + - total operationId: get-fleet-enrollment-api-keys parameters: [] post: summary: Enrollment - Create tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: ../components/schemas/enrollment_api_key.yaml + action: + type: string + enum: + - created operationId: post-fleet-enrollment-api-keys parameters: - $ref: ../components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys@{key_id}.yaml b/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys@{key_id}.yaml index 3b43950427e82..3c63b7e338a6b 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys@{key_id}.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/enrollment_api_keys@{key_id}.yaml @@ -7,12 +7,36 @@ parameters: get: summary: Enrollment - Info tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + item: + $ref: ../components/schemas/enrollment_api_key.yaml + required: + - item operationId: get-fleet-enrollment-api-keys-keyId delete: summary: Enrollment - Delete tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + action: + type: string + enum: + - deleted + required: + - action operationId: delete-fleet-enrollment-api-keys-keyId parameters: - $ref: ../components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/fleet/common/openapi/paths/install@{os_type}.yaml b/x-pack/plugins/fleet/common/openapi/paths/install@{os_type}.yaml deleted file mode 100644 index 80351aa7ae119..0000000000000 --- a/x-pack/plugins/fleet/common/openapi/paths/install@{os_type}.yaml +++ /dev/null @@ -1,11 +0,0 @@ -parameters: - - schema: - type: string - name: osType - in: path - required: true -get: - summary: Fleet - Get OS install script - tags: [] - responses: {} - operationId: get-fleet-install-osType diff --git a/x-pack/plugins/fleet/common/openapi/paths/setup.yaml b/x-pack/plugins/fleet/common/openapi/paths/setup.yaml index 62ad2cb66dacb..859ea50cc25c5 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/setup.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/setup.yaml @@ -1,5 +1,5 @@ post: - summary: Ingest Manager - Setup + summary: Fleet - Setup tags: [] responses: '200': diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index 36554b8409364..bbb571f963dc9 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -414,7 +414,7 @@ export interface IndexTemplateMappings { // This is an index template v2, see https://github.com/elastic/elasticsearch/issues/53101 // until "proper" documentation of the new format is available. -// Ingest Manager does not use nor support the legacy index template v1 format at all +// Fleet does not use nor support the legacy index template v1 format at all export interface IndexTemplate { priority: number; index_patterns: string[]; diff --git a/x-pack/plugins/fleet/common/types/rest_spec/index.ts b/x-pack/plugins/fleet/common/types/rest_spec/index.ts index dfbf5b968f3c7..870cf3f3f1b82 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/index.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/index.ts @@ -13,7 +13,6 @@ export * from './agent_policy'; export * from './fleet_setup'; export * from './epm'; export * from './enrollment_api_key'; -export * from './install_script'; export * from './ingest_setup'; export * from './output'; export * from './settings'; diff --git a/x-pack/plugins/fleet/common/types/rest_spec/install_script.ts b/x-pack/plugins/fleet/common/types/rest_spec/install_script.ts deleted file mode 100644 index 4a43405e4e3ba..0000000000000 --- a/x-pack/plugins/fleet/common/types/rest_spec/install_script.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export interface InstallScriptRequest { - params: { - osType: 'macos'; - }; -} diff --git a/x-pack/plugins/fleet/server/services/install_script/index.ts b/x-pack/plugins/fleet/server/services/install_script/index.ts deleted file mode 100644 index b978eddbfc673..0000000000000 --- a/x-pack/plugins/fleet/server/services/install_script/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { appContextService } from '../app_context'; - -import { macosInstallTemplate } from './install_templates/macos'; -import { linuxInstallTemplate } from './install_templates/linux'; - -export function getScript(osType: 'macos' | 'linux', kibanaUrl: string): string { - const variables = { kibanaUrl, kibanaVersion: appContextService.getKibanaVersion() }; - - switch (osType) { - case 'macos': - return macosInstallTemplate(variables); - case 'linux': - return linuxInstallTemplate(variables); - default: - throw new Error(`${osType} is not supported.`); - } -} diff --git a/x-pack/plugins/fleet/server/services/install_script/install_templates/linux.ts b/x-pack/plugins/fleet/server/services/install_script/install_templates/linux.ts deleted file mode 100644 index 4e31193efc0e6..0000000000000 --- a/x-pack/plugins/fleet/server/services/install_script/install_templates/linux.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { InstallTemplateFunction } from './types'; - -export const linuxInstallTemplate: InstallTemplateFunction = (variables) => { - const artifact = `elastic-agent-${variables.kibanaVersion}-linux-x86_64`; - - return `#!/bin/sh - -set -e -curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/${artifact}.tar.gz -tar -xzvf ${artifact}.tar.gz -cd ${artifact} -./elastic-agent enroll ${variables.kibanaUrl} $API_KEY --force -./elastic-agent run -`; -}; diff --git a/x-pack/plugins/fleet/server/services/install_script/install_templates/macos.ts b/x-pack/plugins/fleet/server/services/install_script/install_templates/macos.ts deleted file mode 100644 index abe52f64d0e5c..0000000000000 --- a/x-pack/plugins/fleet/server/services/install_script/install_templates/macos.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { InstallTemplateFunction } from './types'; - -export const macosInstallTemplate: InstallTemplateFunction = (variables) => { - const artifact = `elastic-agent-${variables.kibanaVersion}-darwin-x86_64`; - - return `#!/bin/sh - -set -e -curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/${artifact}.tar.gz -tar -xzvf ${artifact}.tar.gz -cd ${artifact} -./elastic-agent enroll ${variables.kibanaUrl} $API_KEY --force -./elastic-agent run -`; -}; diff --git a/x-pack/plugins/fleet/server/services/install_script/install_templates/types.ts b/x-pack/plugins/fleet/server/services/install_script/install_templates/types.ts deleted file mode 100644 index e8fa001f7eb65..0000000000000 --- a/x-pack/plugins/fleet/server/services/install_script/install_templates/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export type InstallTemplateFunction = (variables: { - kibanaUrl: string; - kibanaVersion: string; -}) => string; diff --git a/x-pack/plugins/fleet/server/types/rest_spec/index.ts b/x-pack/plugins/fleet/server/types/rest_spec/index.ts index c4fbb05ffd42f..badf02e2e6242 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/index.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/index.ts @@ -11,7 +11,6 @@ export * from './agent'; export * from './package_policy'; export * from './epm'; export * from './enrollment_api_key'; -export * from './install_script'; export * from './output'; export * from './preconfiguration'; export * from './settings'; diff --git a/x-pack/plugins/fleet/server/types/rest_spec/install_script.ts b/x-pack/plugins/fleet/server/types/rest_spec/install_script.ts deleted file mode 100644 index 05ddfeb6f7c04..0000000000000 --- a/x-pack/plugins/fleet/server/types/rest_spec/install_script.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { schema } from '@kbn/config-schema'; - -export const InstallScriptRequestSchema = { - params: schema.object({ - osType: schema.oneOf([schema.literal('macos'), schema.literal('linux')]), - }), -};