Skip to content

Commit

Permalink
[Fleet] Add new APIs and preconfiguration for Fleet server hosts per …
Browse files Browse the repository at this point in the history
…policy (#142746)
  • Loading branch information
nchaulet authored Oct 6, 2022
1 parent d206d83 commit ad95c57
Show file tree
Hide file tree
Showing 35 changed files with 1,681 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export class KbnClientSavedObjects {
'epm-packages',
'epm-packages-assets',
'fleet-preconfiguration-deletion-record',
'fleet-fleet-server-host',
];

const newOptions = { types, space: options?.space };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"file": "280f28bd48b3ad1f1a9f84c6c0ae6dd5ed1179da",
"file-upload-usage-collection-telemetry": "8478924cf0057bd90df737155b364f98d05420a5",
"fileShare": "3f88784b041bb8728a7f40763a08981828799a75",
"fleet-fleet-server-host": "f00ca963f1bee868806319789cdc33f1f53a97e2",
"fleet-preconfiguration-deletion-record": "7b28f200513c28ae774f1b7d7d7906954e3c6e16",
"graph-workspace": "3342f2cd561afdde8f42f5fb284bf550dee8ebb5",
"guided-onboarding-guide-state": "561db8d481b131a2bbf46b1e534d6ce960255135",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const previouslyRegisteredTypes = [
'fleet-agents',
'fleet-enrollment-api-keys',
'fleet-preconfiguration-deletion-record',
'fleet-fleet-server-host',
'graph-workspace',
'guided-setup-state',
'guided-onboarding-guide-state',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 FLEET_SERVER_HOST_SAVED_OBJECT_TYPE = 'fleet-fleet-server-host';

export const DEFAULT_FLEET_SERVER_HOST_ID = 'fleet-default-fleet-server-host';
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 './enrollment_api_key';
export * from './settings';
export * from './preconfiguration';
export * from './download_source';
export * from './fleet_server_policy_config';
export * from './authz';

// TODO: This is the default `index.max_result_window` ES setting, which dictates
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/fleet/common/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ export const OUTPUT_API_ROUTES = {
LOGSTASH_API_KEY_PATTERN: `${API_ROOT}/logstash_api_keys`,
};

// Fleet server API routes
export const FLEET_SERVER_HOST_API_ROUTES = {
LIST_PATTERN: `${API_ROOT}/fleet_server_hosts`,
CREATE_PATTERN: `${API_ROOT}/fleet_server_hosts`,
INFO_PATTERN: `${API_ROOT}/fleet_server_hosts/{itemId}`,
UPDATE_PATTERN: `${API_ROOT}/fleet_server_hosts/{itemId}`,
DELETE_PATTERN: `${API_ROOT}/fleet_server_hosts/{itemId}`,
};

// Settings API routes
export const SETTINGS_API_ROUTES = {
INFO_PATTERN: `${API_ROOT}/settings`,
Expand Down
258 changes: 255 additions & 3 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -3706,6 +3706,230 @@
}
]
}
},
"/fleet_server_hosts": {
"get": {
"summary": "Fleet Server Hosts - List",
"description": "Return a list of Fleet server host",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/fleet_server_host"
}
},
"total": {
"type": "integer"
},
"page": {
"type": "integer"
},
"perPage": {
"type": "integer"
}
}
}
}
}
}
},
"operationId": "get-fleet-server-hosts"
},
"post": {
"summary": "Fleet Server Hosts - Create",
"description": "Create a new Fleet Server Host",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/fleet_server_host"
}
}
}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"host_urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"host_urls"
]
}
}
}
},
"operationId": "post-fleet-server-hosts"
}
},
"/fleet_server_hosts/{itemId}": {
"get": {
"summary": "Fleet Server Hosts - Info",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/fleet_server_host"
}
},
"required": [
"item"
]
}
}
}
}
},
"operationId": "get-one-fleet-server-hosts"
},
"parameters": [
{
"schema": {
"type": "string"
},
"name": "itemId",
"in": "path",
"required": true
}
],
"delete": {
"summary": "Fleet Server Hosts - Delete",
"operationId": "delete-fleet-server-hosts",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
}
}
}
},
"parameters": [
{
"schema": {
"type": "string"
},
"name": "itemId",
"in": "path",
"required": true
},
{
"$ref": "#/components/parameters/kbn_xsrf"
}
]
},
"put": {
"summary": "Fleet Server Hosts - Update",
"operationId": "update-fleet-server-hosts",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"host_urls": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/fleet_server_host"
}
},
"required": [
"item"
]
}
}
}
}
},
"parameters": [
{
"schema": {
"type": "string"
},
"name": "itemId",
"in": "path",
"required": true
},
{
"$ref": "#/components/parameters/kbn_xsrf"
}
]
}
}
},
"components": {
Expand Down Expand Up @@ -3977,9 +4201,6 @@
"has_seen_add_data_notice": {
"type": "boolean"
},
"has_seen_fleet_migration_notice": {
"type": "boolean"
},
"fleet_server_hosts": {
"type": "array",
"items": {
Expand Down Expand Up @@ -5470,6 +5691,37 @@
"name",
"host"
]
},
"fleet_server_host": {
"title": "Fleet Server Host",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"is_default": {
"type": "boolean"
},
"is_preconfigured": {
"type": "boolean"
},
"host_urls": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"fleet_server_hosts",
"id",
"is_default",
"is_preconfigured",
"host_urls"
]
}
}
},
Expand Down
Loading

0 comments on commit ad95c57

Please sign in to comment.