Skip to content

Commit 115dbec

Browse files
authored
[Fleet] Remove deprecated APIs for agents endpoints (#198313)
1 parent 34aab05 commit 115dbec

File tree

27 files changed

+26
-1995
lines changed

27 files changed

+26
-1995
lines changed

oas_docs/bundle.json

Lines changed: 0 additions & 540 deletions
Large diffs are not rendered by default.

oas_docs/bundle.serverless.json

Lines changed: 0 additions & 540 deletions
Large diffs are not rendered by default.

oas_docs/output/kibana.serverless.yaml

Lines changed: 0 additions & 379 deletions
Large diffs are not rendered by default.

oas_docs/output/kibana.yaml

Lines changed: 0 additions & 379 deletions
Large diffs are not rendered by default.

x-pack/plugins/cloud_defend/server/routes/policies/policies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const createPolicies = (
4242
const agentPolicyStatus = {
4343
id: agentPolicy.id,
4444
name: agentPolicy.name,
45-
agents: agentStatusByAgentPolicyId[agentPolicy.id]?.total,
45+
agents: agentStatusByAgentPolicyId[agentPolicy.id]?.active,
4646
};
4747
return {
4848
package_policy: cloudDefendPackage,

x-pack/plugins/cloud_security_posture/server/routes/benchmarks/v1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const getBenchmarksData = (
4848
const agentPolicyStatus = {
4949
id: agentPolicy.id,
5050
name: agentPolicy.name,
51-
agents: agentStatusByAgentPolicyId[agentPolicy.id]?.total,
51+
agents: agentStatusByAgentPolicyId[agentPolicy.id]?.active,
5252
};
5353
return {
5454
package_policy: cspPackage,

x-pack/plugins/fleet/common/constants/routes.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ export const APP_API_ROUTES = {
135135
CHECK_PERMISSIONS_PATTERN: `${API_ROOT}/check-permissions`,
136136
GENERATE_SERVICE_TOKEN_PATTERN: `${API_ROOT}/service_tokens`,
137137
AGENT_POLICIES_SPACES: `${INTERNAL_ROOT}/agent_policies_spaces`,
138-
// deprecated since 8.0
139-
GENERATE_SERVICE_TOKEN_PATTERN_DEPRECATED: `${API_ROOT}/service-tokens`,
140138
};
141139

142140
// Agent API routes
@@ -159,8 +157,6 @@ export const AGENT_API_ROUTES = {
159157
AVAILABLE_VERSIONS_PATTERN: `${API_ROOT}/agents/available_versions`,
160158
STATUS_PATTERN: `${API_ROOT}/agent_status`,
161159
DATA_PATTERN: `${API_ROOT}/agent_status/data`,
162-
// deprecated since 8.0
163-
STATUS_PATTERN_DEPRECATED: `${API_ROOT}/agent-status`,
164160
UPGRADE_PATTERN: `${API_ROOT}/agents/{agentId}/upgrade`,
165161
BULK_UPGRADE_PATTERN: `${API_ROOT}/agents/bulk_upgrade`,
166162
ACTION_STATUS_PATTERN: `${API_ROOT}/agents/action_status`,

x-pack/plugins/fleet/common/types/rest_spec/agent.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ import type { ListResult, ListWithKuery } from './common';
2121

2222
export interface GetAgentsRequest {
2323
query: ListWithKuery & {
24-
showInactive: boolean;
24+
showInactive?: boolean;
2525
showUpgradeable?: boolean;
2626
withMetrics?: boolean;
2727
};
2828
}
2929

3030
export interface GetAgentsResponse extends ListResult<Agent> {
31-
// deprecated in 8.x
32-
list?: Agent[];
3331
statusSummary?: Record<AgentStatus, number>;
3432
}
3533

@@ -128,16 +126,6 @@ export type PostBulkAgentUpgradeResponse = BulkAgentAction;
128126
// eslint-disable-next-line @typescript-eslint/no-empty-interface
129127
export interface PostAgentUpgradeResponse {}
130128

131-
// deprecated
132-
export interface PutAgentReassignRequest {
133-
params: {
134-
agentId: string;
135-
};
136-
body: { policy_id: string };
137-
}
138-
// deprecated
139-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
140-
export interface PutAgentReassignResponse {}
141129
export interface PostAgentReassignRequest {
142130
params: {
143131
agentId: string;
@@ -217,8 +205,6 @@ export interface GetAgentStatusRequest {
217205
export interface GetAgentStatusResponse {
218206
results: {
219207
events: number;
220-
// deprecated
221-
total: number;
222208
online: number;
223209
error: number;
224210
offline: number;

x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ export const CreatePackagePolicySinglePage: CreatePackagePolicyParams = ({
238238
let count = 0;
239239
for (const policyId of agentPolicyIds) {
240240
const { data } = await sendGetAgentStatus({ policyId });
241-
if (data?.results.total) {
242-
count += data.results.total;
241+
if (data?.results.active) {
242+
count += data.results.active;
243243
}
244244
}
245245
setAgentCount(count);

x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/settings/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ export const SettingsView = memo<{ agentPolicy: AgentPolicy }>(
150150
if (isFleetEnabled) {
151151
setIsLoading(true);
152152
const { data } = await sendGetAgentStatus({ policyId: agentPolicy.id });
153-
if (data?.results.total) {
154-
setAgentCount(data.results.total);
153+
if (data?.results.active) {
154+
setAgentCount(data.results.active);
155155
} else {
156156
await submitUpdateAgentPolicy();
157157
}

0 commit comments

Comments
 (0)