-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
routes.ts
229 lines (201 loc) · 9.3 KB
/
routes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
* 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.
*/
// Base API paths
export const INTERNAL_ROOT = `/internal/fleet`;
export const API_ROOT = `/api/fleet`;
export const EPM_API_ROOT = `${API_ROOT}/epm`;
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';
// EPM API routes
const EPM_PACKAGES_MANY = `${EPM_API_ROOT}/packages`;
const EPM_PACKAGES_INSTALLED = `${EPM_API_ROOT}/packages/installed`;
const EPM_PACKAGES_BULK = `${EPM_PACKAGES_MANY}/_bulk`;
const EPM_PACKAGES_ONE_WITHOUT_VERSION = `${EPM_PACKAGES_MANY}/{pkgName}`;
const EPM_PACKAGES_ONE = `${EPM_PACKAGES_MANY}/{pkgName}/{pkgVersion}`;
const EPM_PACKAGES_ONE_WITH_OPTIONAL_VERSION = `${EPM_PACKAGES_MANY}/{pkgName}/{pkgVersion?}`;
export const EPM_API_ROUTES = {
BULK_INSTALL_PATTERN: EPM_PACKAGES_BULK,
LIST_PATTERN: EPM_PACKAGES_MANY,
INSTALLED_LIST_PATTERN: EPM_PACKAGES_INSTALLED,
LIMITED_LIST_PATTERN: `${EPM_PACKAGES_MANY}/limited`,
INFO_WITHOUT_VERSION_PATTERN: EPM_PACKAGES_ONE_WITHOUT_VERSION,
INFO_PATTERN: EPM_PACKAGES_ONE_WITH_OPTIONAL_VERSION,
DATA_STREAMS_PATTERN: `${EPM_API_ROOT}/data_streams`,
INSTALL_FROM_REGISTRY_PATTERN: EPM_PACKAGES_ONE_WITH_OPTIONAL_VERSION,
INSTALL_BY_UPLOAD_PATTERN: EPM_PACKAGES_MANY,
CUSTOM_INTEGRATIONS_PATTERN: `${EPM_API_ROOT}/custom_integrations`,
DELETE_PATTERN: EPM_PACKAGES_ONE_WITH_OPTIONAL_VERSION,
INSTALL_KIBANA_ASSETS_PATTERN: `${EPM_PACKAGES_ONE}/kibana_assets`,
DELETE_KIBANA_ASSETS_PATTERN: `${EPM_PACKAGES_ONE}/kibana_assets`,
FILEPATH_PATTERN: `${EPM_PACKAGES_ONE}/{filePath*}`,
CATEGORIES_PATTERN: `${EPM_API_ROOT}/categories`,
VERIFICATION_KEY_ID: `${EPM_API_ROOT}/verification_key_id`,
STATS_PATTERN: `${EPM_PACKAGES_MANY}/{pkgName}/stats`,
BULK_ASSETS_PATTERN: `${EPM_API_ROOT}/bulk_assets`,
INPUTS_PATTERN: `${EPM_API_ROOT}/templates/{pkgName}/{pkgVersion}/inputs`,
REAUTHORIZE_TRANSFORMS: `${EPM_PACKAGES_ONE}/transforms/authorize`,
};
// Data stream API routes
export const DATA_STREAM_API_ROUTES = {
LIST_PATTERN: `${DATA_STREAM_API_ROOT}`,
};
// Package policy API routes
export const PACKAGE_POLICY_API_ROUTES = {
LIST_PATTERN: `${PACKAGE_POLICY_API_ROOT}`,
BULK_GET_PATTERN: `${PACKAGE_POLICY_API_ROOT}/_bulk_get`,
INFO_PATTERN: `${PACKAGE_POLICY_API_ROOT}/{packagePolicyId}`,
CREATE_PATTERN: `${PACKAGE_POLICY_API_ROOT}`,
UPDATE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/{packagePolicyId}`,
DELETE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/delete`,
UPGRADE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/upgrade`,
DRYRUN_PATTERN: `${PACKAGE_POLICY_API_ROOT}/upgrade/dryrun`,
ORPHANED_INTEGRATION_POLICIES: `${INTERNAL_ROOT}/orphaned_integration_policies`,
};
// Agent policy API routes
export const AGENT_POLICY_API_ROUTES = {
LIST_PATTERN: `${AGENT_POLICY_API_ROOT}`,
BULK_GET_PATTERN: `${AGENT_POLICY_API_ROOT}/_bulk_get`,
INFO_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}`,
CREATE_PATTERN: `${AGENT_POLICY_API_ROOT}`,
UPDATE_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}`,
COPY_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/copy`,
DELETE_PATTERN: `${AGENT_POLICY_API_ROOT}/delete`,
FULL_INFO_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/full`,
FULL_INFO_DOWNLOAD_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/download`,
LIST_OUTPUTS_PATTERN: `${AGENT_POLICY_API_ROOT}/outputs`,
INFO_OUTPUTS_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/outputs`,
};
// Kubernetes Manifest API routes
export const K8S_API_ROUTES = {
K8S_DOWNLOAD_PATTERN: `${K8S_API_ROOT}/download`,
K8S_INFO_PATTERN: `${K8S_API_ROOT}`,
};
// Output API routes
export const OUTPUT_API_ROUTES = {
LIST_PATTERN: `${API_ROOT}/outputs`,
INFO_PATTERN: `${API_ROOT}/outputs/{outputId}`,
UPDATE_PATTERN: `${API_ROOT}/outputs/{outputId}`,
DELETE_PATTERN: `${API_ROOT}/outputs/{outputId}`,
CREATE_PATTERN: `${API_ROOT}/outputs`,
GET_OUTPUT_HEALTH_PATTERN: `${API_ROOT}/outputs/{outputId}/health`,
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}`,
POLICY_STATUS_PATTERN: `${API_ROOT}/fleet_server_policy_status`,
};
export const FLEET_PROXY_API_ROUTES = {
LIST_PATTERN: `${API_ROOT}/proxies`,
CREATE_PATTERN: `${API_ROOT}/proxies`,
INFO_PATTERN: `${API_ROOT}/proxies/{itemId}`,
UPDATE_PATTERN: `${API_ROOT}/proxies/{itemId}`,
DELETE_PATTERN: `${API_ROOT}/proxies/{itemId}`,
};
// Settings API routes
export const SETTINGS_API_ROUTES = {
INFO_PATTERN: `${API_ROOT}/settings`,
UPDATE_PATTERN: `${API_ROOT}/settings`,
ENROLLMENT_INFO_PATTERN: `${INTERNAL_ROOT}/settings/enrollment`,
SPACE_INFO_PATTERN: `${API_ROOT}/space_settings`,
SPACE_UPDATE_PATTERN: `${API_ROOT}/space_settings`,
};
// App API routes
export const APP_API_ROUTES = {
HEALTH_CHECK_PATTERN: `${API_ROOT}/health_check`,
CHECK_PERMISSIONS_PATTERN: `${API_ROOT}/check-permissions`,
GENERATE_SERVICE_TOKEN_PATTERN: `${API_ROOT}/service_tokens`,
AGENT_POLICIES_SPACES: `${INTERNAL_ROOT}/agent_policies_spaces`,
};
// Agent API routes
export const AGENT_API_ROUTES = {
LIST_PATTERN: `${API_ROOT}/agents`,
INFO_PATTERN: `${API_ROOT}/agents/{agentId}`,
UPDATE_PATTERN: `${API_ROOT}/agents/{agentId}`,
BULK_UPDATE_AGENT_TAGS_PATTERN: `${API_ROOT}/agents/bulk_update_agent_tags`,
DELETE_PATTERN: `${API_ROOT}/agents/{agentId}`,
CHECKIN_PATTERN: `${API_ROOT}/agents/{agentId}/checkin`,
ACKS_PATTERN: `${API_ROOT}/agents/{agentId}/acks`,
ACTIONS_PATTERN: `${API_ROOT}/agents/{agentId}/actions`,
CANCEL_ACTIONS_PATTERN: `${API_ROOT}/agents/actions/{actionId}/cancel`,
UNENROLL_PATTERN: `${API_ROOT}/agents/{agentId}/unenroll`,
BULK_UNENROLL_PATTERN: `${API_ROOT}/agents/bulk_unenroll`,
REASSIGN_PATTERN: `${API_ROOT}/agents/{agentId}/reassign`,
BULK_REASSIGN_PATTERN: `${API_ROOT}/agents/bulk_reassign`,
REQUEST_DIAGNOSTICS_PATTERN: `${API_ROOT}/agents/{agentId}/request_diagnostics`,
BULK_REQUEST_DIAGNOSTICS_PATTERN: `${API_ROOT}/agents/bulk_request_diagnostics`,
AVAILABLE_VERSIONS_PATTERN: `${API_ROOT}/agents/available_versions`,
STATUS_PATTERN: `${API_ROOT}/agent_status`,
DATA_PATTERN: `${API_ROOT}/agent_status/data`,
UPGRADE_PATTERN: `${API_ROOT}/agents/{agentId}/upgrade`,
BULK_UPGRADE_PATTERN: `${API_ROOT}/agents/bulk_upgrade`,
ACTION_STATUS_PATTERN: `${API_ROOT}/agents/action_status`,
LIST_TAGS_PATTERN: `${API_ROOT}/agents/tags`,
LIST_UPLOADS_PATTERN: `${API_ROOT}/agents/{agentId}/uploads`,
GET_UPLOAD_FILE_PATTERN: `${API_ROOT}/agents/files/{fileId}/{fileName}`,
DELETE_UPLOAD_FILE_PATTERN: `${API_ROOT}/agents/files/{fileId}`,
};
export const ENROLLMENT_API_KEY_ROUTES = {
CREATE_PATTERN: `${API_ROOT}/enrollment_api_keys`,
LIST_PATTERN: `${API_ROOT}/enrollment_api_keys`,
INFO_PATTERN: `${API_ROOT}/enrollment_api_keys/{keyId}`,
DELETE_PATTERN: `${API_ROOT}/enrollment_api_keys/{keyId}`,
};
export const UNINSTALL_TOKEN_ROUTES = {
LIST_PATTERN: `${API_ROOT}/uninstall_tokens`,
INFO_PATTERN: `${API_ROOT}/uninstall_tokens/{uninstallTokenId}`,
};
// Agents setup API routes
export const AGENTS_SETUP_API_ROUTES = {
INFO_PATTERN: `${API_ROOT}/agents/setup`,
CREATE_PATTERN: `${API_ROOT}/agents/setup`,
};
// Message signing service
export const MESSAGE_SIGNING_SERVICE_API_ROUTES = {
ROTATE_KEY_PAIR: `${API_ROOT}/message_signing_service/rotate_key_pair`,
};
export const SETUP_API_ROUTE = `${API_ROOT}/setup`;
export const INSTALL_SCRIPT_API_ROUTES = `${API_ROOT}/install/{osType}`;
// Policy preconfig API routes
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}`,
};
export const CREATE_STANDALONE_AGENT_API_KEY_ROUTE = `${INTERNAL_ROOT}/create_standalone_agent_api_key`;
// Fleet debug routes
export const FLEET_DEBUG_ROUTES = {
INDEX_PATTERN: `${INTERNAL_ROOT}/debug/index`,
SAVED_OBJECTS_PATTERN: `${INTERNAL_ROOT}/debug/saved_objects`,
SAVED_OBJECT_NAMES_PATTERN: `${INTERNAL_ROOT}/debug/saved_object_names`,
};
// API versioning constants
export const API_VERSIONS = {
public: {
v1: '2023-10-31',
},
internal: {
v1: '1',
},
};
export const PUBLIC_API_ACCESS = 'public';
export const INTERNAL_API_ACCESS = 'internal';