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] Create new API to manage download_source setting #134889

Merged
merged 11 commits into from
Jun 24, 2022
12 changes: 12 additions & 0 deletions x-pack/plugins/fleet/common/constants/download_source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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 const DEFAULT_DOWNLOAD_SOURCE = 'artifactory.elastic.co';

export const DOWNLOAD_SOURCE_SAVED_OBJECT_TYPE = 'ingest-download-sources';

export const DEFAULT_DOWNLOAD_SOURCE_ID = 'fleet-default-download-source';
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from './output';
export * from './enrollment_api_key';
export * from './settings';
export * from './preconfiguration';
export * from './download_source';

// TODO: This is the default `index.max_result_window` ES setting, which dictates
// the maximum amount of results allowed to be returned from a search. It's possible
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/fleet/common/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const DATA_STREAM_API_ROOT = `${API_ROOT}/data_streams`;
export const PACKAGE_POLICY_API_ROOT = `${API_ROOT}/package_policies`;
export const AGENT_POLICY_API_ROOT = `${API_ROOT}/agent_policies`;
export const K8S_API_ROOT = `${API_ROOT}/kubernetes`;
export const DOWNLOAD_SOURCE_API_ROOT = `${API_ROOT}/agent_download_sources`;

export const LIMITED_CONCURRENCY_ROUTE_TAG = 'ingest:limited-concurrency';

Expand Down Expand Up @@ -151,3 +152,12 @@ export const PRECONFIGURATION_API_ROUTES = {
RESET_PATTERN: `${INTERNAL_ROOT}/reset_preconfigured_agent_policies`,
RESET_ONE_PATTERN: `${INTERNAL_ROOT}/reset_preconfigured_agent_policies/{agentPolicyId}`,
};

// Agent download source routes
export const DOWNLOAD_SOURCE_API_ROUTES = {
LIST_PATTERN: `${API_ROOT}/agent_download_sources`,
INFO_PATTERN: `${API_ROOT}/agent_download_sources/{sourceId}`,
CREATE_PATTERN: `${API_ROOT}/agent_download_sources`,
UPDATE_PATTERN: `${API_ROOT}/agent_download_sources/{sourceId}`,
DELETE_PATTERN: `${API_ROOT}/agent_download_sources/{sourceId}`,
};
231 changes: 231 additions & 0 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,213 @@
]
}
},
"/agent_download_sources": {
"get": {
"summary": "Agent Download Sources",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/download_sources"
}
},
"total": {
"type": "integer"
},
"page": {
"type": "integer"
},
"perPage": {
"type": "integer"
}
}
}
}
}
}
},
"operationId": "get-download-sources"
},
"post": {
"summary": "Agent Download Sources",
"description": "Create a new agent download source",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/download_sources"
}
}
}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"host": {
"type": "string"
}
},
"required": [
"name",
"host",
"is_default"
]
}
}
}
},
"operationId": "post-download-sources"
}
},
"/agent_download_sources/{sourceId}": {
"get": {
"summary": "Agent Download Sources - Info",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/download_sources"
}
},
"required": [
"item"
]
}
}
}
}
},
"operationId": "get-one-download-source"
},
"parameters": [
{
"schema": {
"type": "string"
},
"name": "sourceId",
"in": "path",
"required": true
}
],
"delete": {
"summary": "Agent Download Sources - Delete",
"operationId": "delete-download-source",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
}
}
}
},
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
]
},
"put": {
"summary": "Agent Download Sources - Update",
"operationId": "update-download-source",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"host": {
"type": "string"
}
},
"required": [
"name",
"is_default",
"host"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/download_sources"
}
},
"required": [
"item"
]
}
}
}
}
},
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
]
}
},
"/logstash_api_keys": {
"post": {
"summary": "Generate Logstash API key",
Expand Down Expand Up @@ -4572,6 +4779,30 @@
"name",
"type"
]
},
"download_sources": {
"title": "Download Source",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"name": {
"type": "string"
},
"host": {
"type": "string"
}
},
"required": [
"id",
"is_default",
"name",
"host"
]
}
}
},
Expand Down
Loading