Skip to content

Commit c577a5f

Browse files
authored
[Fleet] Add create/delete agentless policies API (#241712)
1 parent 5d2171a commit c577a5f

File tree

41 files changed

+8539
-2133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+8539
-2133
lines changed

.buildkite/ftr_platform_stateful_configs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ enabled:
169169
- x-pack/platform/test/disable_ems/config.ts
170170
- x-pack/platform/test/examples/config.ts
171171
- x-pack/platform/test/fleet_api_integration/config.agent.ts
172+
- x-pack/platform/test/fleet_api_integration/config.agentless.ts
172173
- x-pack/platform/test/fleet_api_integration/config.agent_policy.ts
173174
- x-pack/platform/test/fleet_api_integration/config.epm.ts
174175
- x-pack/platform/test/fleet_api_integration/config.event_ingested.ts

oas_docs/bundle.json

Lines changed: 1947 additions & 605 deletions
Large diffs are not rendered by default.

oas_docs/bundle.serverless.json

Lines changed: 1947 additions & 605 deletions
Large diffs are not rendered by default.

oas_docs/output/kibana.serverless.yaml

Lines changed: 1076 additions & 143 deletions
Large diffs are not rendered by default.

oas_docs/output/kibana.yaml

Lines changed: 1076 additions & 143 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ export const AGENT_API_ROUTES = {
191191
BULK_PRIVILEGE_LEVEL_CHANGE_PATTERN: `${API_ROOT}/agents/bulk_privilege_level_change`,
192192
};
193193

194+
export const AGENTLESS_POLICIES_ROUTES = {
195+
CREATE_PATTERN: `${API_ROOT}/agentless_policies`,
196+
DELETE_PATTERN: `${API_ROOT}/agentless_policies/{policyId}`,
197+
};
198+
194199
export const ENROLLMENT_API_KEY_ROUTES = {
195200
CREATE_PATTERN: `${API_ROOT}/enrollment_api_keys`,
196201
LIST_PATTERN: `${API_ROOT}/enrollment_api_keys`,

x-pack/platform/plugins/shared/fleet/common/experimental_features.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const _allowedExperimentalValues = {
1919
enableAgentStatusAlerting: true,
2020
enableAgentPrivilegeLevelChange: false,
2121
installIntegrationsKnowledge: false,
22+
agentlessPoliciesAPI: true,
23+
useAgentlessAPIInUI: false,
24+
disabledAgentlessLegacyAPI: false,
2225
};
2326

2427
/**

x-pack/platform/plugins/shared/fleet/common/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ export type {
124124
BulkGetPackagePoliciesResponse,
125125
BulkGetAgentPoliciesResponse,
126126
GetBulkAssetsResponse,
127+
CreateAgentlessPolicyRequest,
128+
CreateAgentlessPolicyResponse,
129+
DeleteAgentlessPolicyRequest,
130+
DeleteAgentlessPolicyResponse,
127131
// Models
128132
Agent,
129133
AgentStatus,

x-pack/platform/plugins/shared/fleet/common/services/routes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
UNINSTALL_TOKEN_ROUTES,
2727
FLEET_DEBUG_ROUTES,
2828
REMOTE_SYNCED_INTEGRATIONS_API_ROUTES,
29+
AGENTLESS_POLICIES_ROUTES,
2930
} from '../constants';
3031

3132
export const epmRouteService = {
@@ -205,6 +206,15 @@ export const packagePolicyRouteService = {
205206
},
206207
};
207208

209+
export const agentlessPolicyRouteService = {
210+
getCreatePath: () => {
211+
return AGENTLESS_POLICIES_ROUTES.CREATE_PATTERN;
212+
},
213+
getDeletePath: (policyId: string) => {
214+
return AGENTLESS_POLICIES_ROUTES.DELETE_PATTERN.replace('{policyId}', policyId);
215+
},
216+
};
217+
208218
export const agentPolicyRouteService = {
209219
getListPath: () => {
210220
return AGENT_POLICY_API_ROUTES.LIST_PATTERN;

x-pack/platform/plugins/shared/fleet/common/services/simplified_package_policy_helper.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,19 @@ import { PackagePolicyValidationError } from '../errors';
2222
import { packageToPackagePolicy } from '.';
2323
import { isInputAllowedForDeploymentMode } from './agentless_policy_helper';
2424

25-
export type SimplifiedVars = Record<string, string | string[] | boolean | number | number[] | null>;
25+
export type SimplifiedVars = Record<
26+
string,
27+
| string
28+
| string[]
29+
| boolean
30+
| number
31+
| number[]
32+
| null
33+
| {
34+
isSecretRef: boolean;
35+
id: string;
36+
}
37+
>;
2638

2739
export type SimplifiedPackagePolicyStreams = Record<
2840
string,
@@ -54,7 +66,7 @@ export interface SimplifiedPackagePolicy {
5466
inputs?: SimplifiedInputs;
5567
supports_agentless?: boolean | null;
5668
supports_cloud_connector?: boolean | null;
57-
additional_datastreams_permissions?: string[];
69+
additional_datastreams_permissions?: string[] | null;
5870
}
5971

6072
export interface FormattedPackagePolicy extends Omit<PackagePolicy, 'inputs' | 'vars'> {

0 commit comments

Comments
 (0)