diff --git a/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json b/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json index 8c9ede1fde9b..d75a914e080d 100644 --- a/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json +++ b/x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json @@ -43,12 +43,9 @@ }, "perPage": { "type": "number" - }, - "success": { - "type": "boolean" } }, - "required": ["items", "total", "page", "perPage", "success"] + "required": ["items", "total", "page", "perPage"] }, "examples": { "success": { @@ -71,8 +68,7 @@ ], "total": 1, "page": 1, - "perPage": 50, - "success": true + "perPage": 50 } } } @@ -107,9 +103,6 @@ "properties": { "item": { "$ref": "#/components/schemas/AgentPolicy" - }, - "success": { - "type": "boolean" } } } @@ -159,12 +152,9 @@ "properties": { "item": { "$ref": "#/components/schemas/AgentPolicy" - }, - "success": { - "type": "boolean" } }, - "required": ["item", "success"] + "required": ["item"] }, "examples": { "success": { @@ -707,8 +697,7 @@ "revision": 2, "updated_on": "2020-05-06T17:32:21.905Z", "updated_by": "system" - }, - "success": true + } } } } @@ -733,12 +722,9 @@ "properties": { "item": { "$ref": "#/components/schemas/AgentPolicy" - }, - "success": { - "type": "boolean" } }, - "required": ["item", "success"] + "required": ["item"] }, "examples": { "example-1": { @@ -751,8 +737,7 @@ "updated_on": "Fri Feb 28 2020 16:22:31 GMT-0500 (Eastern Standard Time)", "updated_by": "elastic", "packagePolicies": [] - }, - "success": true + } } } } @@ -810,12 +795,9 @@ "properties": { "item": { "$ref": "#/components/schemas/AgentPolicy" - }, - "success": { - "type": "boolean" } }, - "required": ["item", "success"] + "required": ["item"] } } } @@ -948,12 +930,9 @@ }, "perPage": { "type": "number" - }, - "success": { - "type": "boolean" } }, - "required": ["items", "success"] + "required": ["items"] }, "examples": { "example-1": { @@ -1157,8 +1136,7 @@ ], "total": 6, "page": 1, - "perPage": 20, - "success": true + "perPage": 20 } } } @@ -1251,12 +1229,9 @@ "properties": { "item": { "$ref": "#/components/schemas/PackagePolicy" - }, - "success": { - "type": "boolean" } }, - "required": ["item", "success"] + "required": ["item"] } } } @@ -1415,9 +1390,6 @@ "properties": { "response": { "$ref": "#/components/schemas/PackageInfo" - }, - "success": { - "type": "boolean" } } }, @@ -1709,8 +1681,7 @@ }, "references": [] } - }, - "success": true + } } }, "required-package": { @@ -1899,8 +1870,7 @@ }, "references": [] } - }, - "success": true + } } } } @@ -1950,12 +1920,9 @@ }, "required": ["id", "type"] } - }, - "success": { - "type": "boolean" } }, - "required": ["response", "success"] + "required": ["response"] } } } @@ -1994,12 +1961,9 @@ }, "required": ["id", "type"] } - }, - "success": { - "type": "boolean" } }, - "required": ["response", "success"] + "required": ["response"] } } } @@ -2678,8 +2642,7 @@ "version": "1.0.0", "status": "not_installed" } - ], - "success": true + ] } } } @@ -2743,9 +2706,6 @@ "type": "object" } }, - "success": { - "type": "boolean" - }, "total": { "type": "number" }, @@ -2756,7 +2716,7 @@ "type": "number" } }, - "required": ["list", "success", "total", "page", "perPage"] + "required": ["list", "total", "page", "perPage"] }, "examples": { "example-1": { @@ -2793,7 +2753,6 @@ "status": "online" } ], - "success": true, "total": 1, "page": 1, "perPage": 20 @@ -2836,12 +2795,9 @@ "properties": { "item": { "type": "object" - }, - "success": { - "type": "string" } }, - "required": ["item", "success"] + "required": ["item"] } } } @@ -2916,9 +2872,6 @@ "type": "string", "enum": ["checkin"] }, - "success": { - "type": "string" - }, "actions": { "type": "array", "items": { @@ -2950,7 +2903,6 @@ "success": { "value": { "action": "checkin", - "success": true, "actions": [ { "agent_id": "a6f14bd2-1a2a-481c-9212-9494d064ffdf", @@ -3346,21 +3298,17 @@ "schema": { "type": "object", "properties": { - "success": { - "type": "boolean" - }, "action": { "type": "string", "enum": ["acks"] } }, - "required": ["success", "action"] + "required": ["action"] }, "examples": { "success": { "value": { - "action": "checkin", - "success": true + "action": "checkin" } } } @@ -3417,9 +3365,6 @@ "action": { "type": "string" }, - "success": { - "type": "boolean" - }, "item": { "$ref": "#/components/schemas/Agent" } @@ -3429,7 +3374,6 @@ "success": { "value": { "action": "created", - "success": true, "item": { "id": "8086fb1a-72ca-4a67-8533-09300c1639fa", "active": true, diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/agent.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/agent.ts index 4a50938049a7..cf8d3ab1c908 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/agent.ts @@ -28,7 +28,6 @@ export interface GetAgentsResponse { total: number; page: number; perPage: number; - success: boolean; } export interface GetOneAgentRequest { @@ -39,7 +38,6 @@ export interface GetOneAgentRequest { export interface GetOneAgentResponse { item: Agent; - success: boolean; } export interface PostAgentCheckinRequest { @@ -55,7 +53,7 @@ export interface PostAgentCheckinRequest { export interface PostAgentCheckinResponse { action: string; - success: boolean; + actions: AgentAction[]; } @@ -72,7 +70,7 @@ export interface PostAgentEnrollRequest { export interface PostAgentEnrollResponse { action: string; - success: boolean; + item: Agent & { status: AgentStatus }; } @@ -87,7 +85,6 @@ export interface PostAgentAcksRequest { export interface PostAgentAcksResponse { action: string; - success: boolean; } export interface PostNewAgentActionRequest { @@ -100,7 +97,6 @@ export interface PostNewAgentActionRequest { } export interface PostNewAgentActionResponse { - success: boolean; item: AgentAction; } @@ -110,9 +106,8 @@ export interface PostAgentUnenrollRequest { }; } -export interface PostAgentUnenrollResponse { - success: boolean; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface PostAgentUnenrollResponse {} export interface PutAgentReassignRequest { params: { @@ -121,9 +116,8 @@ export interface PutAgentReassignRequest { body: { policy_id: string }; } -export interface PutAgentReassignResponse { - success: boolean; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface PutAgentReassignResponse {} export interface GetOneAgentEventsRequest { params: { @@ -141,7 +135,6 @@ export interface GetOneAgentEventsResponse { total: number; page: number; perPage: number; - success: boolean; } export interface DeleteAgentRequest { @@ -166,7 +159,6 @@ export interface GetAgentStatusRequest { } export interface GetAgentStatusResponse { - success: boolean; results: { events: number; total: number; diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/agent_policy.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/agent_policy.ts index 4683727ed51a..aa9fbc20fc0b 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/agent_policy.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/agent_policy.ts @@ -19,7 +19,6 @@ export interface GetAgentPoliciesResponse { total: number; page: number; perPage: number; - success: boolean; } export interface GetOneAgentPolicyRequest { @@ -30,7 +29,6 @@ export interface GetOneAgentPolicyRequest { export interface GetOneAgentPolicyResponse { item: AgentPolicy; - success: boolean; } export interface CreateAgentPolicyRequest { @@ -39,7 +37,6 @@ export interface CreateAgentPolicyRequest { export interface CreateAgentPolicyResponse { item: AgentPolicy; - success: boolean; } export type UpdateAgentPolicyRequest = GetOneAgentPolicyRequest & { @@ -48,7 +45,6 @@ export type UpdateAgentPolicyRequest = GetOneAgentPolicyRequest & { export interface UpdateAgentPolicyResponse { item: AgentPolicy; - success: boolean; } export interface CopyAgentPolicyRequest { @@ -57,7 +53,6 @@ export interface CopyAgentPolicyRequest { export interface CopyAgentPolicyResponse { item: AgentPolicy; - success: boolean; } export interface DeleteAgentPolicyRequest { @@ -68,7 +63,6 @@ export interface DeleteAgentPolicyRequest { export interface DeleteAgentPolicyResponse { id: string; - success: boolean; } export interface GetFullAgentPolicyRequest { @@ -79,5 +73,4 @@ export interface GetFullAgentPolicyRequest { export interface GetFullAgentPolicyResponse { item: FullAgentPolicy; - success: boolean; } diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/enrollment_api_key.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/enrollment_api_key.ts index 1929955cac84..1d1c2f79bf6c 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/enrollment_api_key.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/enrollment_api_key.ts @@ -19,7 +19,6 @@ export interface GetEnrollmentAPIKeysResponse { total: number; page: number; perPage: number; - success: boolean; } export interface GetOneEnrollmentAPIKeyRequest { @@ -30,7 +29,6 @@ export interface GetOneEnrollmentAPIKeyRequest { export interface GetOneEnrollmentAPIKeyResponse { item: EnrollmentAPIKey; - success: boolean; } export interface DeleteEnrollmentAPIKeyRequest { @@ -41,7 +39,6 @@ export interface DeleteEnrollmentAPIKeyRequest { export interface DeleteEnrollmentAPIKeyResponse { action: string; - success: boolean; } export interface PostEnrollmentAPIKeyRequest { @@ -55,5 +52,4 @@ export interface PostEnrollmentAPIKeyRequest { export interface PostEnrollmentAPIKeyResponse { action: string; item: EnrollmentAPIKey; - success: boolean; } diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/epm.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/epm.ts index 1901b8c0c703..5fb718f91b87 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/epm.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/epm.ts @@ -20,7 +20,6 @@ export interface GetCategoriesRequest { export interface GetCategoriesResponse { response: CategorySummaryList; - success: boolean; } export interface GetPackagesRequest { @@ -39,12 +38,10 @@ export interface GetPackagesResponse { > > >; - success: boolean; } export interface GetLimitedPackagesResponse { response: string[]; - success: boolean; } export interface GetFileRequest { @@ -62,7 +59,6 @@ export interface GetInfoRequest { export interface GetInfoResponse { response: PackageInfo; - success: boolean; } export interface InstallPackageRequest { @@ -73,7 +69,6 @@ export interface InstallPackageRequest { export interface InstallPackageResponse { response: AssetReference[]; - success: boolean; } export interface DeletePackageRequest { @@ -84,5 +79,4 @@ export interface DeletePackageRequest { export interface DeletePackageResponse { response: AssetReference[]; - success: boolean; } diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/output.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/output.ts index 416206036338..87e8a0977e3b 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/output.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/output.ts @@ -7,7 +7,6 @@ import { Output } from '../models'; export interface GetOneOutputResponse { item: Output; - success: boolean; } export interface GetOneOutputRequest { @@ -28,7 +27,6 @@ export interface PutOutputRequest { export interface PutOutputResponse { item: Output; - success: boolean; } export interface GetOutputsResponse { @@ -36,5 +34,4 @@ export interface GetOutputsResponse { total: number; page: number; perPage: number; - success: boolean; } diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/package_policy.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/package_policy.ts index e5bba3d6deab..61669ab876d8 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/package_policy.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/package_policy.ts @@ -18,7 +18,6 @@ export interface GetPackagePoliciesResponse { total: number; page: number; perPage: number; - success: boolean; } export interface GetOnePackagePolicyRequest { @@ -29,7 +28,6 @@ export interface GetOnePackagePolicyRequest { export interface GetOnePackagePolicyResponse { item: PackagePolicy; - success: boolean; } export interface CreatePackagePolicyRequest { @@ -38,7 +36,6 @@ export interface CreatePackagePolicyRequest { export interface CreatePackagePolicyResponse { item: PackagePolicy; - success: boolean; } export type UpdatePackagePolicyRequest = GetOnePackagePolicyRequest & { diff --git a/x-pack/plugins/ingest_manager/common/types/rest_spec/settings.ts b/x-pack/plugins/ingest_manager/common/types/rest_spec/settings.ts index c02a5e5878ee..90d623b8a4be 100644 --- a/x-pack/plugins/ingest_manager/common/types/rest_spec/settings.ts +++ b/x-pack/plugins/ingest_manager/common/types/rest_spec/settings.ts @@ -7,7 +7,6 @@ import { Settings } from '../models'; export interface GetSettingsResponse { item: Settings; - success: boolean; } export interface PutSettingsRequest { @@ -16,5 +15,4 @@ export interface PutSettingsRequest { export interface PutSettingsResponse { item: Settings; - success: boolean; } diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_copy_provider.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_copy_provider.tsx index 8a91cabe78d0..fefbe1fa82a0 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_copy_provider.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_copy_provider.tsx @@ -61,7 +61,7 @@ export const AgentPolicyCopyProvider: React.FunctionComponent = ({ childr try { const { data } = await sendCopyAgentPolicy(agentPolicy!.id, newAgentPolicy!); - if (data?.success) { + if (data) { notifications.toasts.addSuccess( i18n.translate('xpack.ingestManager.copyAgentPolicy.successNotificationTitle', { defaultMessage: 'Agent policy copied', @@ -70,9 +70,7 @@ export const AgentPolicyCopyProvider: React.FunctionComponent = ({ childr if (onSuccessCallback.current) { onSuccessCallback.current(data.item); } - } - - if (!data?.success) { + } else { notifications.toasts.addDanger( i18n.translate('xpack.ingestManager.copyAgentPolicy.failureNotificationTitle', { defaultMessage: "Error copying agent policy '{id}'", diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_delete_provider.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_delete_provider.tsx index 08367bf2a97b..15f71689ecdf 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_delete_provider.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/components/agent_policy_delete_provider.tsx @@ -59,7 +59,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent = ({ chil agentPolicyId: agentPolicy!, }); - if (data?.success) { + if (data) { notifications.toasts.addSuccess( i18n.translate('xpack.ingestManager.deleteAgentPolicy.successSingleNotificationTitle', { defaultMessage: "Deleted agent policy '{id}'", @@ -69,9 +69,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent = ({ chil if (onSuccessCallback.current) { onSuccessCallback.current(agentPolicy!); } - } - - if (!data?.success) { + } else { notifications.toasts.addDanger( i18n.translate('xpack.ingestManager.deleteAgentPolicy.failureSingleNotificationTitle', { defaultMessage: "Error deleting agent policy '{id}'", diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/details_page/components/settings/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/details_page/components/settings/index.tsx index 766bdc2e2c19..b8fbb4f1835a 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/details_page/components/settings/index.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/details_page/components/settings/index.tsx @@ -82,7 +82,7 @@ export const SettingsView = memo<{ agentPolicy: AgentPolicy }>( namespace, monitoring_enabled, }); - if (data?.success) { + if (data) { notifications.toasts.addSuccess( i18n.translate('xpack.ingestManager.editAgentPolicy.successNotificationTitle', { defaultMessage: "Successfully updated '{name}' settings", diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/list_page/components/create_agent_policy.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/list_page/components/create_agent_policy.tsx index b072990727e3..e3e2975777e1 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/list_page/components/create_agent_policy.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_policy/list_page/components/create_agent_policy.tsx @@ -116,7 +116,7 @@ export const CreateAgentPolicyFlyout: React.FunctionComponent = ({ try { const { data, error } = await createAgentPolicy(); setIsLoading(false); - if (data?.success) { + if (data) { notifications.toasts.addSuccess( i18n.translate( 'xpack.ingestManager.createAgentPolicy.successNotificationTitle', diff --git a/x-pack/plugins/ingest_manager/scripts/dev_agent/script.ts b/x-pack/plugins/ingest_manager/scripts/dev_agent/script.ts index c7b8edd0c332..65375a076e9a 100644 --- a/x-pack/plugins/ingest_manager/scripts/dev_agent/script.ts +++ b/x-pack/plugins/ingest_manager/scripts/dev_agent/script.ts @@ -122,7 +122,7 @@ async function enroll(kibanaURL: string, apiKey: string, log: ToolingLog): Promi }); const obj: PostAgentEnrollResponse = await res.json(); - if (!obj.success) { + if (!res.ok) { log.error(JSON.stringify(obj, null, 2)); throw new Error('unable to enroll'); } diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.test.ts b/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.test.ts index aaed189ae3dd..33b9dc617075 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.test.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.test.ts @@ -88,7 +88,6 @@ describe('test acks handlers', () => { await postAgentAcksHandler(({} as unknown) as RequestHandlerContext, mockRequest, mockResponse); expect(mockResponse.ok.mock.calls[0][0]?.body as PostAgentAcksResponse).toEqual({ action: 'acks', - success: true, }); }); }); diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.ts b/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.ts index 0b719d8a67df..564f5d03e945 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/acks_handlers.ts @@ -46,7 +46,6 @@ export const postAgentAcksHandlerBuilder = function ( const body: PostAgentAcksResponse = { action: 'acks', - success: true, }; return response.ok({ body }); diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.test.ts b/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.test.ts index bcb9a7797f26..5445a46fbe2b 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.test.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.test.ts @@ -97,6 +97,5 @@ describe('test actions handlers', () => { ?.body as unknown) as PostNewAgentActionResponse; expect(expectedAgentActionResponse.item).toEqual(agentAction); - expect(expectedAgentActionResponse.success).toEqual(true); }); }); diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.ts b/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.ts index 81893b1e7833..b81d44c40f8e 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/actions_handlers.ts @@ -35,7 +35,6 @@ export const postNewAgentActionHandlerBuilder = function ( }); const body: PostNewAgentActionResponse = { - success: true, item: savedAgentAction, }; diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/handlers.ts b/x-pack/plugins/ingest_manager/server/routes/agent/handlers.ts index 3e80a74dc2b1..2bce8daa6637 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/handlers.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/handlers.ts @@ -43,7 +43,6 @@ export const getAgentHandler: RequestHandler ({ agent_id: agent.id, type: a.type, @@ -248,7 +243,6 @@ export const postAgentEnrollHandler: RequestHandler< ); const body: PostAgentEnrollResponse = { action: 'created', - success: true, item: { ...agent, status: AgentService.getAgentStatus(agent), @@ -289,7 +283,6 @@ export const getAgentsHandler: RequestHandler< ...agent, status: AgentService.getAgentStatus(agent), })), - success: true, total, page, perPage, @@ -312,9 +305,7 @@ export const putAgentsReassignHandler: RequestHandler< try { await AgentService.reassignAgent(soClient, request.params.agentId, request.body.policy_id); - const body: PutAgentReassignResponse = { - success: true, - }; + const body: PutAgentReassignResponse = {}; return response.ok({ body }); } catch (e) { return response.customError({ @@ -336,7 +327,7 @@ export const getAgentStatusForAgentPolicyHandler: RequestHandler< request.query.policyId ); - const body: GetAgentStatusResponse = { results, success: true }; + const body: GetAgentStatusResponse = { results }; return response.ok({ body }); } catch (e) { diff --git a/x-pack/plugins/ingest_manager/server/routes/agent/unenroll_handler.ts b/x-pack/plugins/ingest_manager/server/routes/agent/unenroll_handler.ts index d1e54fe4fb3a..5df695d248f5 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent/unenroll_handler.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent/unenroll_handler.ts @@ -23,9 +23,7 @@ export const postAgentsUnenrollHandler: RequestHandler< await AgentService.unenrollAgent(soClient, request.params.agentId); } - const body: PostAgentUnenrollResponse = { - success: true, - }; + const body: PostAgentUnenrollResponse = {}; return response.ok({ body }); } catch (e) { return response.customError({ diff --git a/x-pack/plugins/ingest_manager/server/routes/agent_policy/handlers.ts b/x-pack/plugins/ingest_manager/server/routes/agent_policy/handlers.ts index cc178e1038e2..7eb3df234610 100644 --- a/x-pack/plugins/ingest_manager/server/routes/agent_policy/handlers.ts +++ b/x-pack/plugins/ingest_manager/server/routes/agent_policy/handlers.ts @@ -49,7 +49,6 @@ export const getAgentPoliciesHandler: RequestHandler< total, page, perPage, - success: true, }; await bluebird.map( @@ -82,7 +81,6 @@ export const getOneAgentPolicyHandler: RequestHandler { return { response: epmPackages, - success: true, }; }, @@ -114,7 +113,6 @@ const endpointListApiPathHandlerMocks = ({ return { items: [agentPolicy], total: 10, - success: true, perPage: 10, page: 1, }; @@ -132,7 +130,6 @@ const endpointListApiPathHandlerMocks = ({ page: 1, perPage: 10, total: endpointPackagePolicies?.length, - success: true, }; }, }; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_list/test_mock_utils.ts b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_list/test_mock_utils.ts index 5ef01c00dbf1..1093aed0608d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_list/test_mock_utils.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_list/test_mock_utils.ts @@ -64,7 +64,6 @@ export const mockPolicyResultList: (options?: { total, page: requestPageIndex, perPage: requestPageSize, - success: true, }; return mock; }; @@ -81,7 +80,6 @@ export const policyListApiPathHandlers = (totalPolicies: number = 1) => { [INGEST_API_EPM_PACKAGES]: (): GetPackagesResponse => { return { response: [generator.generateEpmPackage()], - success: true, }; }, }; diff --git a/x-pack/test/ingest_manager_api_integration/apis/agent_policy/agent_policy.ts b/x-pack/test/ingest_manager_api_integration/apis/agent_policy/agent_policy.ts index b55da0798c5f..410b0fe09300 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/agent_policy/agent_policy.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/agent_policy/agent_policy.ts @@ -14,7 +14,7 @@ export default function ({ getService }: FtrProviderContext) { describe('ingest_manager_agent_policies', () => { describe('POST /api/ingest_manager/agent_policies', () => { it('should work with valid values', async () => { - const { body: apiResponse } = await supertest + await supertest .post(`/api/ingest_manager/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ @@ -22,8 +22,6 @@ export default function ({ getService }: FtrProviderContext) { namespace: 'default', }) .expect(200); - - expect(apiResponse.success).to.be(true); }); it('should return a 400 with an empty namespace', async () => { @@ -61,7 +59,7 @@ export default function ({ getService }: FtrProviderContext) { it('should work with valid values', async () => { const { - body: { success, item }, + body: { item }, } = await supertest .post(`/api/ingest_manager/agent_policies/${TEST_POLICY_ID}/copy`) .set('kbn-xsrf', 'xxxx') @@ -73,7 +71,6 @@ export default function ({ getService }: FtrProviderContext) { // eslint-disable-next-line @typescript-eslint/naming-convention const { id, updated_at, ...newPolicy } = item; - expect(success).to.be(true); expect(newPolicy).to.eql({ name: 'Copied policy', description: 'Test', diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/acks.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/acks.ts index c9fa80c88762..1613ca9d11ee 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/acks.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/acks.ts @@ -90,7 +90,6 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); expect(apiResponse.action).to.be('acks'); - expect(apiResponse.success).to.be(true); const { body: eventResponse } = await supertest .get(`/api/ingest_manager/fleet/agents/agent1/events`) .set('kbn-xsrf', 'xx') diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/actions.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/actions.ts index 8dc4e5c232b8..2b4bb335dfc5 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/actions.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/actions.ts @@ -33,7 +33,6 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); - expect(apiResponse.success).to.be(true); expect(apiResponse.item.data).to.eql({ data: 'action_data' }); expect(apiResponse.item.sent_at).to.be('2020-03-18T19:45:02.620Z'); }); diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/checkin.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/checkin.ts index 79f6cfae175e..fbfc94a0840b 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/checkin.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/checkin.ts @@ -102,7 +102,6 @@ export default function (providerContext: FtrProviderContext) { .expect(200); expect(apiResponse.action).to.be('checkin'); - expect(apiResponse.success).to.be(true); }); }); } diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/complete_flow.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/complete_flow.ts index 2d14a7a10e66..1d5b682d71c7 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/complete_flow.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/complete_flow.ts @@ -62,7 +62,6 @@ export default function (providerContext: FtrProviderContext) { }, }) .expect(200); - expect(enrollmentResponse.success).to.eql(true); const agentAccessAPIKey = enrollmentResponse.item.access_api_key; @@ -76,14 +75,13 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); - expect(checkinApiResponse.success).to.eql(true); expect(checkinApiResponse.actions).length(1); expect(checkinApiResponse.actions[0].type).be('CONFIG_CHANGE'); const policyChangeAction = checkinApiResponse.actions[0]; const defaultOutputApiKey = policyChangeAction.data.config.outputs.default.api_key; // Ack actions - const { body: ackApiResponse } = await supertestWithoutAuth + await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`) .set('Authorization', `ApiKey ${agentAccessAPIKey}`) .set('kbn-xsrf', 'xx') @@ -102,7 +100,6 @@ export default function (providerContext: FtrProviderContext) { ], }) .expect(200); - expect(ackApiResponse.success).to.eql(true); // Second agent checkin const { body: secondCheckinApiResponse } = await supertestWithoutAuth @@ -113,7 +110,6 @@ export default function (providerContext: FtrProviderContext) { events: [], }) .expect(200); - expect(secondCheckinApiResponse.success).to.eql(true); expect(secondCheckinApiResponse.actions).length(0); // Get agent @@ -121,18 +117,16 @@ export default function (providerContext: FtrProviderContext) { .get(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}`) .expect(200); - expect(getAgentApiResponse.success).to.eql(true); expect(getAgentApiResponse.item.packages).to.contain( 'system', "Agent should run the 'system' package" ); // Unenroll agent - const { body: unenrollResponse } = await supertest + await supertest .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/unenroll`) .set('kbn-xsrf', 'xx') .expect(200); - expect(unenrollResponse.success).to.eql(true); // Checkin after unenrollment const { body: checkinAfterUnenrollResponse } = await supertestWithoutAuth @@ -144,13 +138,12 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); - expect(checkinAfterUnenrollResponse.success).to.eql(true); expect(checkinAfterUnenrollResponse.actions).length(1); expect(checkinAfterUnenrollResponse.actions[0].type).be('UNENROLL'); const unenrollAction = checkinAfterUnenrollResponse.actions[0]; // ack unenroll actions - const { body: ackUnenrollApiResponse } = await supertestWithoutAuth + await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`) .set('Authorization', `ApiKey ${agentAccessAPIKey}`) .set('kbn-xsrf', 'xx') @@ -168,7 +161,6 @@ export default function (providerContext: FtrProviderContext) { ], }) .expect(200); - expect(ackUnenrollApiResponse.success).to.eql(true); // Checkin after unenrollment acknowledged await supertestWithoutAuth diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/delete.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/delete.ts index dc05b7a4dd79..65fbdabe8bd7 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/delete.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/delete.ts @@ -68,7 +68,6 @@ export default function ({ getService }: FtrProviderContext) { .expect(404); expect(apiResponse).not.to.eql({ - success: true, action: 'deleted', }); }); @@ -88,7 +87,6 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xx') .expect(200); expect(apiResponse).to.eql({ - success: true, action: 'deleted', }); }); diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/enroll.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/enroll.ts index 93f656ea952d..eef0d3beb69d 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/enroll.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/enroll.ts @@ -136,7 +136,6 @@ export default function (providerContext: FtrProviderContext) { }, }) .expect(200); - expect(apiResponse.success).to.eql(true); expect(apiResponse.item).to.have.keys('id', 'active', 'access_api_key', 'type', 'policy_id'); }); @@ -158,7 +157,7 @@ export default function (providerContext: FtrProviderContext) { }, }) .expect(200); - expect(apiResponse.success).to.eql(true); + const { body: privileges } = await getEsClientForAPIKey( providerContext, apiResponse.item.access_api_key diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/list.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/list.ts index 23563c6f43bb..1ee00ed72016 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/list.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/list.ts @@ -78,8 +78,7 @@ export default function ({ getService }: FtrProviderContext) { .auth(users.fleet_admin.username, users.fleet_admin.password) .expect(200); - expect(apiResponse).to.have.keys('success', 'page', 'total', 'list'); - expect(apiResponse.success).to.eql(true); + expect(apiResponse).to.have.keys('page', 'total', 'list'); expect(apiResponse.total).to.eql(4); }); it('should return the list of agents when requesting as a user with fleet read permissions', async () => { @@ -87,8 +86,7 @@ export default function ({ getService }: FtrProviderContext) { .get(`/api/ingest_manager/fleet/agents`) .auth(users.fleet_user.username, users.fleet_user.password) .expect(200); - expect(apiResponse).to.have.keys('success', 'page', 'total', 'list'); - expect(apiResponse.success).to.eql(true); + expect(apiResponse).to.have.keys('page', 'total', 'list'); expect(apiResponse.total).to.eql(4); }); it('should not return the list of agents when requesting as a user without fleet permissions', async () => { diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/unenroll.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/unenroll.ts index d1ff8731183b..d24e438fa13e 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/unenroll.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/agents/unenroll.ts @@ -65,20 +65,17 @@ export default function (providerContext: FtrProviderContext) { }); it('allow to unenroll using a list of ids', async () => { - const { body } = await supertest + await supertest .post(`/api/ingest_manager/fleet/agents/agent1/unenroll`) .set('kbn-xsrf', 'xxx') .send({ force: true, }) .expect(200); - - expect(body).to.have.keys('success'); - expect(body.success).to.be(true); }); it('should invalidate related API keys', async () => { - const { body } = await supertest + await supertest .post(`/api/ingest_manager/fleet/agents/agent1/unenroll`) .set('kbn-xsrf', 'xxx') .send({ @@ -86,9 +83,6 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); - expect(body).to.have.keys('success'); - expect(body.success).to.be(true); - const { body: { api_keys: accessAPIKeys }, } = await esClient.security.getApiKey({ id: accessAPIKeyId }); diff --git a/x-pack/test/ingest_manager_api_integration/apis/fleet/enrollment_api_keys/crud.ts b/x-pack/test/ingest_manager_api_integration/apis/fleet/enrollment_api_keys/crud.ts index 275462072919..6c5d552a51eb 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/fleet/enrollment_api_keys/crud.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/fleet/enrollment_api_keys/crud.ts @@ -67,13 +67,11 @@ export default function (providerContext: FtrProviderContext) { }); it('should invalide an existing api keys', async () => { - const { body: apiResponse } = await supertest + await supertest .delete(`/api/ingest_manager/fleet/enrollment-api-keys/${keyId}`) .set('kbn-xsrf', 'xxx') .expect(200); - expect(apiResponse.success).to.eql(true); - const { body: { api_keys: apiKeys }, } = await es.security.getApiKey({ id: esApiKeyId }); @@ -113,7 +111,6 @@ export default function (providerContext: FtrProviderContext) { }) .expect(200); - expect(apiResponse.success).to.eql(true); expect(apiResponse.item).to.have.keys('id', 'api_key', 'api_key_id', 'name', 'policy_id'); }); @@ -125,7 +122,7 @@ export default function (providerContext: FtrProviderContext) { policy_id: 'policy1', }) .expect(200); - expect(apiResponse.success).to.eql(true); + const { body: privileges } = await getEsClientForAPIKey( providerContext, apiResponse.item.api_key diff --git a/x-pack/test/ingest_manager_api_integration/apis/package_policy/create.ts b/x-pack/test/ingest_manager_api_integration/apis/package_policy/create.ts index c88f03de5961..113fbeca494d 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/package_policy/create.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; import { warnAndSkipTest } from '../../helpers'; @@ -34,7 +33,7 @@ export default function ({ getService }: FtrProviderContext) { it('should work with valid values', async function () { if (server.enabled) { - const { body: apiResponse } = await supertest + await supertest .post(`/api/ingest_manager/package_policies`) .set('kbn-xsrf', 'xxxx') .send({ @@ -52,8 +51,6 @@ export default function ({ getService }: FtrProviderContext) { }, }) .expect(200); - - expect(apiResponse.success).to.be(true); } else { warnAndSkipTest(this, log); } diff --git a/x-pack/test/ingest_manager_api_integration/apis/package_policy/get.ts b/x-pack/test/ingest_manager_api_integration/apis/package_policy/get.ts index 756eaa8ea49b..53a400d2fd9e 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/package_policy/get.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/package_policy/get.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; import { skipIfNoDockerRegistry } from '../../helpers'; @@ -75,11 +74,7 @@ export default function (providerContext: FtrProviderContext) { }); it('should succeed with a valid id', async function () { - const { body: apiResponse } = await supertest - .get(`/api/ingest_manager/package_policies/${packagePolicyId}`) - .expect(200); - - expect(apiResponse.success).to.be(true); + await supertest.get(`/api/ingest_manager/package_policies/${packagePolicyId}`).expect(200); }); it('should return a 404 with an invalid id', async function () { diff --git a/x-pack/test/ingest_manager_api_integration/apis/package_policy/update.ts b/x-pack/test/ingest_manager_api_integration/apis/package_policy/update.ts index e74d88f3538e..3c4cb93ee3ff 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/package_policy/update.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/package_policy/update.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; import { skipIfNoDockerRegistry } from '../../helpers'; @@ -77,7 +76,7 @@ export default function (providerContext: FtrProviderContext) { }); it('should work with valid values', async function () { - const { body: apiResponse } = await supertest + await supertest .put(`/api/ingest_manager/package_policies/${packagePolicyId}`) .set('kbn-xsrf', 'xxxx') .send({ @@ -95,8 +94,6 @@ export default function (providerContext: FtrProviderContext) { }, }) .expect(200); - - expect(apiResponse.success).to.be(true); }); it('should return a 500 if there is another package policy with the same name', async function () { diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts b/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts index d5106f554992..17a4182fe937 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/artifacts/index.ts @@ -54,7 +54,6 @@ export default function (providerContext: FtrProviderContext) { }, }) .expect(200); - expect(enrollmentResponse.success).to.eql(true); agentAccessAPIKey = enrollmentResponse.item.access_api_key; });