Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Add command to spin up a mock server for ingest endpoints #49259

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions x-pack/legacy/plugins/fleet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"author": "Elastic",
"name": "fleet",
"version": "8.0.0",
"private": true,
"license": "Elastic-License",
"devDependencies": {
"@stoplight/prism-cli": "^3.1.1"
},
"workspaces": {
"nohoist": [
"@stoplight/**"
]
}
}
8 changes: 8 additions & 0 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

require('../../../../../../src/setup_node_env');
require('./script');
16 changes: 16 additions & 0 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"title": "Asset",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "./asset_type.v1.json"
}
},
"required": [
"id",
"type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "string",
"title": "AssetType",
"description": "Types of assets which can be installed/removed",
"enum": [
"index-template",
"ingest-pipeline",
"ilm-policy",
"rollup-job",
"ml-job",
"data-frame-transform"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "Datasource",
"type": "object",
"description": "A package with a use case (eg prod_west). The use case ID must be unique. A datasource can have multiple streams.",
"properties": {
"name": {
"type": "string",
"example": "prod_west",
"description": "Should be unique"
},
"package": {
"$ref": "./package.v1.json"
},
"streams": {
"type": "array",
"items": {
"$ref": "./stream.v1.json"
}
},
"id": {
"type": "string",
"format": "uuid"
},
"read_alias": {
"type": "string"
}
},
"required": [
"name",
"package",
"streams"
]
}
50 changes: 50 additions & 0 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/models/input.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"title": "Input",
"type": "object",
"description": "Where the data comes from",
"properties": {
"type": {
"type": "string",
"enum": [
"log",
"metric/system",
"metric/docker",
"etc"
]
},
"config": {
"type": "object",
"example": "{paths: \"/var/log/*.log\"} or {metricsets: [\"container\", \"cpu\"]} or {username: \"elastic\", password: \"changeme\"}",
"description": "Mix of configurable and required properties still TBD. Object for now might become string"
},
"ingest_pipelines": {
"type": "array",
"description": "Need a distinction for \"main\" ingest pipeline. Should be handled during install. Likely by package/manifest format",
"items": {
"type": "string"
}
},
"id": {
"type": "string",
"format": "uuid"
},
"index_template": {
"type": "string"
},
"ilm_policy": {
"type": "string"
},
"fields": {
"type": "array",
"description": "",
"items": {
"type": "object",
"description": "contents from fields.yml"
}
}
},
"required": [
"type",
"config"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"title": "Output",
"type": "object",
"description": "Where to send the data",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string",
"example": "\"default\" or \"infosec1\""
},
"type": {
"type": "string",
"enum": [
"elasticsearch",
"something",
"else"
]
},
"url": {
"type": "string",
"format": "uri"
},
"api_token": {
"type": "string"
},
"index_name": {
"type": "string",
"example": "metrics-mysql-prod_west-access",
"description": "unique alias with write index"
},
"ingest_pipeline": {
"type": "string",
"example": "metrics-mysql-prod_west-access"
},
"config": {
"type": "object",
"description": "contains everything not otherwise specified (e.g. TLS, etc)"
}
},
"required": [
"id",
"name",
"type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"title": "Package",
"type": "object",
"description": "Multiple dashboard templates and multiple input templates, eg access log, error log, metrics, consisting of index template, ingest pipeline, ML jobs.",
"properties": {
"name": {
"type": "string",
"example": "coredns"
},
"version": {
"type": "string",
"example": "1.0.1, 1.3.1"
},
"description": {
"type": "string",
"example": "CoreDNS logs and metrics integration.\nThe CoreDNS integrations allows to gather logs and metrics from the CoreDNS DNS server to get better insights.\n"
},
"title": {
"type": "string",
"example": "CoreDNS"
},
"assets": {
"type": "array",
"items": {
"$ref": "./asset.v1.json"
}
}
},
"required": [
"name",
"version",
"assets"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"title": "Policy",
"type": "object",
"description": "Has config from zero or more datasources.",
"x-examples": {
"example-1": {
"value": {
"id": "policy_example",
"name": "Example Policy",
"datasources": [
{
"use_case": "prod_west",
"packcage": {},
"streams": [
{}
]
}
]
}
}
},
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"datasources": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "./datasource.v1.json"
}
},
"description": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
]
}
},
"required": [
"id",
"status"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"title": "Stream",
"type": "object",
"description": "A combination of an input type, the required config, an output, and any processors",
"properties": {
"id": {
"type": "string"
},
"input": {
"$ref": "./input.v1.json"
},
"config": {
"type": "object",
"example": "{paths: \"/var/log/*.log\"} or {metricsets: [\"container\", \"cpu\"]} or {username: \"elastic\", password: \"changeme\"}"
},
"output": {
"$ref": "./output.v1.json"
},
"processors": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"id",
"input",
"output"
]
}
Loading