[Ingest Manager] Remove success: true as top-level API response (#73223)
* Big bang commit removing top-level success property in API response Left in check-permissions and in array of objects returned by delete package configs * Remove success property from mocks * Resolve conflict from upstream changes * Remove success property (after upstream merge) * Remove more 'success'es after merging in upstream * Remove success from some tests * Remove success from OpenAPI spec * Revert prior try/catch. Use res.ok Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
7b7b013b97
commit
71b9dedfc4
42 changed files with 58 additions and 229 deletions
|
@ -43,12 +43,9 @@
|
||||||
},
|
},
|
||||||
"perPage": {
|
"perPage": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["items", "total", "page", "perPage", "success"]
|
"required": ["items", "total", "page", "perPage"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"success": {
|
"success": {
|
||||||
|
@ -71,8 +68,7 @@
|
||||||
],
|
],
|
||||||
"total": 1,
|
"total": 1,
|
||||||
"page": 1,
|
"page": 1,
|
||||||
"perPage": 50,
|
"perPage": 50
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +103,6 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/AgentPolicy"
|
"$ref": "#/components/schemas/AgentPolicy"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,12 +152,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/AgentPolicy"
|
"$ref": "#/components/schemas/AgentPolicy"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["item", "success"]
|
"required": ["item"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"success": {
|
"success": {
|
||||||
|
@ -707,8 +697,7 @@
|
||||||
"revision": 2,
|
"revision": 2,
|
||||||
"updated_on": "2020-05-06T17:32:21.905Z",
|
"updated_on": "2020-05-06T17:32:21.905Z",
|
||||||
"updated_by": "system"
|
"updated_by": "system"
|
||||||
},
|
}
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,12 +722,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/AgentPolicy"
|
"$ref": "#/components/schemas/AgentPolicy"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["item", "success"]
|
"required": ["item"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"example-1": {
|
"example-1": {
|
||||||
|
@ -751,8 +737,7 @@
|
||||||
"updated_on": "Fri Feb 28 2020 16:22:31 GMT-0500 (Eastern Standard Time)",
|
"updated_on": "Fri Feb 28 2020 16:22:31 GMT-0500 (Eastern Standard Time)",
|
||||||
"updated_by": "elastic",
|
"updated_by": "elastic",
|
||||||
"packagePolicies": []
|
"packagePolicies": []
|
||||||
},
|
}
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -810,12 +795,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/AgentPolicy"
|
"$ref": "#/components/schemas/AgentPolicy"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["item", "success"]
|
"required": ["item"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -948,12 +930,9 @@
|
||||||
},
|
},
|
||||||
"perPage": {
|
"perPage": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["items", "success"]
|
"required": ["items"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"example-1": {
|
"example-1": {
|
||||||
|
@ -1157,8 +1136,7 @@
|
||||||
],
|
],
|
||||||
"total": 6,
|
"total": 6,
|
||||||
"page": 1,
|
"page": 1,
|
||||||
"perPage": 20,
|
"perPage": 20
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,12 +1229,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/PackagePolicy"
|
"$ref": "#/components/schemas/PackagePolicy"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["item", "success"]
|
"required": ["item"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1415,9 +1390,6 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"response": {
|
"response": {
|
||||||
"$ref": "#/components/schemas/PackageInfo"
|
"$ref": "#/components/schemas/PackageInfo"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1709,8 +1681,7 @@
|
||||||
},
|
},
|
||||||
"references": []
|
"references": []
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required-package": {
|
"required-package": {
|
||||||
|
@ -1899,8 +1870,7 @@
|
||||||
},
|
},
|
||||||
"references": []
|
"references": []
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1950,12 +1920,9 @@
|
||||||
},
|
},
|
||||||
"required": ["id", "type"]
|
"required": ["id", "type"]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["response", "success"]
|
"required": ["response"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1994,12 +1961,9 @@
|
||||||
},
|
},
|
||||||
"required": ["id", "type"]
|
"required": ["id", "type"]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["response", "success"]
|
"required": ["response"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2678,8 +2642,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"status": "not_installed"
|
"status": "not_installed"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2743,9 +2706,6 @@
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"total": {
|
"total": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
@ -2756,7 +2716,7 @@
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["list", "success", "total", "page", "perPage"]
|
"required": ["list", "total", "page", "perPage"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"example-1": {
|
"example-1": {
|
||||||
|
@ -2793,7 +2753,6 @@
|
||||||
"status": "online"
|
"status": "online"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"success": true,
|
|
||||||
"total": 1,
|
"total": 1,
|
||||||
"page": 1,
|
"page": 1,
|
||||||
"perPage": 20
|
"perPage": 20
|
||||||
|
@ -2836,12 +2795,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"item": {
|
"item": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["item", "success"]
|
"required": ["item"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2916,9 +2872,6 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["checkin"]
|
"enum": ["checkin"]
|
||||||
},
|
},
|
||||||
"success": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"actions": {
|
"actions": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
@ -2950,7 +2903,6 @@
|
||||||
"success": {
|
"success": {
|
||||||
"value": {
|
"value": {
|
||||||
"action": "checkin",
|
"action": "checkin",
|
||||||
"success": true,
|
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"agent_id": "a6f14bd2-1a2a-481c-9212-9494d064ffdf",
|
"agent_id": "a6f14bd2-1a2a-481c-9212-9494d064ffdf",
|
||||||
|
@ -3346,21 +3298,17 @@
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"action": {
|
"action": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["acks"]
|
"enum": ["acks"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["success", "action"]
|
"required": ["action"]
|
||||||
},
|
},
|
||||||
"examples": {
|
"examples": {
|
||||||
"success": {
|
"success": {
|
||||||
"value": {
|
"value": {
|
||||||
"action": "checkin",
|
"action": "checkin"
|
||||||
"success": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3417,9 +3365,6 @@
|
||||||
"action": {
|
"action": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"success": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"item": {
|
"item": {
|
||||||
"$ref": "#/components/schemas/Agent"
|
"$ref": "#/components/schemas/Agent"
|
||||||
}
|
}
|
||||||
|
@ -3429,7 +3374,6 @@
|
||||||
"success": {
|
"success": {
|
||||||
"value": {
|
"value": {
|
||||||
"action": "created",
|
"action": "created",
|
||||||
"success": true,
|
|
||||||
"item": {
|
"item": {
|
||||||
"id": "8086fb1a-72ca-4a67-8533-09300c1639fa",
|
"id": "8086fb1a-72ca-4a67-8533-09300c1639fa",
|
||||||
"active": true,
|
"active": true,
|
||||||
|
|
|
@ -28,7 +28,6 @@ export interface GetAgentsResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOneAgentRequest {
|
export interface GetOneAgentRequest {
|
||||||
|
@ -39,7 +38,6 @@ export interface GetOneAgentRequest {
|
||||||
|
|
||||||
export interface GetOneAgentResponse {
|
export interface GetOneAgentResponse {
|
||||||
item: Agent;
|
item: Agent;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostAgentCheckinRequest {
|
export interface PostAgentCheckinRequest {
|
||||||
|
@ -55,7 +53,7 @@ export interface PostAgentCheckinRequest {
|
||||||
|
|
||||||
export interface PostAgentCheckinResponse {
|
export interface PostAgentCheckinResponse {
|
||||||
action: string;
|
action: string;
|
||||||
success: boolean;
|
|
||||||
actions: AgentAction[];
|
actions: AgentAction[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +70,7 @@ export interface PostAgentEnrollRequest {
|
||||||
|
|
||||||
export interface PostAgentEnrollResponse {
|
export interface PostAgentEnrollResponse {
|
||||||
action: string;
|
action: string;
|
||||||
success: boolean;
|
|
||||||
item: Agent & { status: AgentStatus };
|
item: Agent & { status: AgentStatus };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +85,6 @@ export interface PostAgentAcksRequest {
|
||||||
|
|
||||||
export interface PostAgentAcksResponse {
|
export interface PostAgentAcksResponse {
|
||||||
action: string;
|
action: string;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostNewAgentActionRequest {
|
export interface PostNewAgentActionRequest {
|
||||||
|
@ -100,7 +97,6 @@ export interface PostNewAgentActionRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostNewAgentActionResponse {
|
export interface PostNewAgentActionResponse {
|
||||||
success: boolean;
|
|
||||||
item: AgentAction;
|
item: AgentAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,9 +106,8 @@ export interface PostAgentUnenrollRequest {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostAgentUnenrollResponse {
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
success: boolean;
|
export interface PostAgentUnenrollResponse {}
|
||||||
}
|
|
||||||
|
|
||||||
export interface PutAgentReassignRequest {
|
export interface PutAgentReassignRequest {
|
||||||
params: {
|
params: {
|
||||||
|
@ -121,9 +116,8 @@ export interface PutAgentReassignRequest {
|
||||||
body: { policy_id: string };
|
body: { policy_id: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PutAgentReassignResponse {
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
success: boolean;
|
export interface PutAgentReassignResponse {}
|
||||||
}
|
|
||||||
|
|
||||||
export interface GetOneAgentEventsRequest {
|
export interface GetOneAgentEventsRequest {
|
||||||
params: {
|
params: {
|
||||||
|
@ -141,7 +135,6 @@ export interface GetOneAgentEventsResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteAgentRequest {
|
export interface DeleteAgentRequest {
|
||||||
|
@ -166,7 +159,6 @@ export interface GetAgentStatusRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetAgentStatusResponse {
|
export interface GetAgentStatusResponse {
|
||||||
success: boolean;
|
|
||||||
results: {
|
results: {
|
||||||
events: number;
|
events: number;
|
||||||
total: number;
|
total: number;
|
||||||
|
|
|
@ -19,7 +19,6 @@ export interface GetAgentPoliciesResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOneAgentPolicyRequest {
|
export interface GetOneAgentPolicyRequest {
|
||||||
|
@ -30,7 +29,6 @@ export interface GetOneAgentPolicyRequest {
|
||||||
|
|
||||||
export interface GetOneAgentPolicyResponse {
|
export interface GetOneAgentPolicyResponse {
|
||||||
item: AgentPolicy;
|
item: AgentPolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateAgentPolicyRequest {
|
export interface CreateAgentPolicyRequest {
|
||||||
|
@ -39,7 +37,6 @@ export interface CreateAgentPolicyRequest {
|
||||||
|
|
||||||
export interface CreateAgentPolicyResponse {
|
export interface CreateAgentPolicyResponse {
|
||||||
item: AgentPolicy;
|
item: AgentPolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateAgentPolicyRequest = GetOneAgentPolicyRequest & {
|
export type UpdateAgentPolicyRequest = GetOneAgentPolicyRequest & {
|
||||||
|
@ -48,7 +45,6 @@ export type UpdateAgentPolicyRequest = GetOneAgentPolicyRequest & {
|
||||||
|
|
||||||
export interface UpdateAgentPolicyResponse {
|
export interface UpdateAgentPolicyResponse {
|
||||||
item: AgentPolicy;
|
item: AgentPolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CopyAgentPolicyRequest {
|
export interface CopyAgentPolicyRequest {
|
||||||
|
@ -57,7 +53,6 @@ export interface CopyAgentPolicyRequest {
|
||||||
|
|
||||||
export interface CopyAgentPolicyResponse {
|
export interface CopyAgentPolicyResponse {
|
||||||
item: AgentPolicy;
|
item: AgentPolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteAgentPolicyRequest {
|
export interface DeleteAgentPolicyRequest {
|
||||||
|
@ -68,7 +63,6 @@ export interface DeleteAgentPolicyRequest {
|
||||||
|
|
||||||
export interface DeleteAgentPolicyResponse {
|
export interface DeleteAgentPolicyResponse {
|
||||||
id: string;
|
id: string;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetFullAgentPolicyRequest {
|
export interface GetFullAgentPolicyRequest {
|
||||||
|
@ -79,5 +73,4 @@ export interface GetFullAgentPolicyRequest {
|
||||||
|
|
||||||
export interface GetFullAgentPolicyResponse {
|
export interface GetFullAgentPolicyResponse {
|
||||||
item: FullAgentPolicy;
|
item: FullAgentPolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ export interface GetEnrollmentAPIKeysResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOneEnrollmentAPIKeyRequest {
|
export interface GetOneEnrollmentAPIKeyRequest {
|
||||||
|
@ -30,7 +29,6 @@ export interface GetOneEnrollmentAPIKeyRequest {
|
||||||
|
|
||||||
export interface GetOneEnrollmentAPIKeyResponse {
|
export interface GetOneEnrollmentAPIKeyResponse {
|
||||||
item: EnrollmentAPIKey;
|
item: EnrollmentAPIKey;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteEnrollmentAPIKeyRequest {
|
export interface DeleteEnrollmentAPIKeyRequest {
|
||||||
|
@ -41,7 +39,6 @@ export interface DeleteEnrollmentAPIKeyRequest {
|
||||||
|
|
||||||
export interface DeleteEnrollmentAPIKeyResponse {
|
export interface DeleteEnrollmentAPIKeyResponse {
|
||||||
action: string;
|
action: string;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PostEnrollmentAPIKeyRequest {
|
export interface PostEnrollmentAPIKeyRequest {
|
||||||
|
@ -55,5 +52,4 @@ export interface PostEnrollmentAPIKeyRequest {
|
||||||
export interface PostEnrollmentAPIKeyResponse {
|
export interface PostEnrollmentAPIKeyResponse {
|
||||||
action: string;
|
action: string;
|
||||||
item: EnrollmentAPIKey;
|
item: EnrollmentAPIKey;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ export interface GetCategoriesRequest {
|
||||||
|
|
||||||
export interface GetCategoriesResponse {
|
export interface GetCategoriesResponse {
|
||||||
response: CategorySummaryList;
|
response: CategorySummaryList;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetPackagesRequest {
|
export interface GetPackagesRequest {
|
||||||
|
@ -39,12 +38,10 @@ export interface GetPackagesResponse {
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetLimitedPackagesResponse {
|
export interface GetLimitedPackagesResponse {
|
||||||
response: string[];
|
response: string[];
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetFileRequest {
|
export interface GetFileRequest {
|
||||||
|
@ -62,7 +59,6 @@ export interface GetInfoRequest {
|
||||||
|
|
||||||
export interface GetInfoResponse {
|
export interface GetInfoResponse {
|
||||||
response: PackageInfo;
|
response: PackageInfo;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InstallPackageRequest {
|
export interface InstallPackageRequest {
|
||||||
|
@ -73,7 +69,6 @@ export interface InstallPackageRequest {
|
||||||
|
|
||||||
export interface InstallPackageResponse {
|
export interface InstallPackageResponse {
|
||||||
response: AssetReference[];
|
response: AssetReference[];
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeletePackageRequest {
|
export interface DeletePackageRequest {
|
||||||
|
@ -84,5 +79,4 @@ export interface DeletePackageRequest {
|
||||||
|
|
||||||
export interface DeletePackageResponse {
|
export interface DeletePackageResponse {
|
||||||
response: AssetReference[];
|
response: AssetReference[];
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { Output } from '../models';
|
||||||
|
|
||||||
export interface GetOneOutputResponse {
|
export interface GetOneOutputResponse {
|
||||||
item: Output;
|
item: Output;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOneOutputRequest {
|
export interface GetOneOutputRequest {
|
||||||
|
@ -28,7 +27,6 @@ export interface PutOutputRequest {
|
||||||
|
|
||||||
export interface PutOutputResponse {
|
export interface PutOutputResponse {
|
||||||
item: Output;
|
item: Output;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOutputsResponse {
|
export interface GetOutputsResponse {
|
||||||
|
@ -36,5 +34,4 @@ export interface GetOutputsResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ export interface GetPackagePoliciesResponse {
|
||||||
total: number;
|
total: number;
|
||||||
page: number;
|
page: number;
|
||||||
perPage: number;
|
perPage: number;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetOnePackagePolicyRequest {
|
export interface GetOnePackagePolicyRequest {
|
||||||
|
@ -29,7 +28,6 @@ export interface GetOnePackagePolicyRequest {
|
||||||
|
|
||||||
export interface GetOnePackagePolicyResponse {
|
export interface GetOnePackagePolicyResponse {
|
||||||
item: PackagePolicy;
|
item: PackagePolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreatePackagePolicyRequest {
|
export interface CreatePackagePolicyRequest {
|
||||||
|
@ -38,7 +36,6 @@ export interface CreatePackagePolicyRequest {
|
||||||
|
|
||||||
export interface CreatePackagePolicyResponse {
|
export interface CreatePackagePolicyResponse {
|
||||||
item: PackagePolicy;
|
item: PackagePolicy;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdatePackagePolicyRequest = GetOnePackagePolicyRequest & {
|
export type UpdatePackagePolicyRequest = GetOnePackagePolicyRequest & {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { Settings } from '../models';
|
||||||
|
|
||||||
export interface GetSettingsResponse {
|
export interface GetSettingsResponse {
|
||||||
item: Settings;
|
item: Settings;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PutSettingsRequest {
|
export interface PutSettingsRequest {
|
||||||
|
@ -16,5 +15,4 @@ export interface PutSettingsRequest {
|
||||||
|
|
||||||
export interface PutSettingsResponse {
|
export interface PutSettingsResponse {
|
||||||
item: Settings;
|
item: Settings;
|
||||||
success: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const AgentPolicyCopyProvider: React.FunctionComponent<Props> = ({ childr
|
||||||
try {
|
try {
|
||||||
const { data } = await sendCopyAgentPolicy(agentPolicy!.id, newAgentPolicy!);
|
const { data } = await sendCopyAgentPolicy(agentPolicy!.id, newAgentPolicy!);
|
||||||
|
|
||||||
if (data?.success) {
|
if (data) {
|
||||||
notifications.toasts.addSuccess(
|
notifications.toasts.addSuccess(
|
||||||
i18n.translate('xpack.ingestManager.copyAgentPolicy.successNotificationTitle', {
|
i18n.translate('xpack.ingestManager.copyAgentPolicy.successNotificationTitle', {
|
||||||
defaultMessage: 'Agent policy copied',
|
defaultMessage: 'Agent policy copied',
|
||||||
|
@ -70,9 +70,7 @@ export const AgentPolicyCopyProvider: React.FunctionComponent<Props> = ({ childr
|
||||||
if (onSuccessCallback.current) {
|
if (onSuccessCallback.current) {
|
||||||
onSuccessCallback.current(data.item);
|
onSuccessCallback.current(data.item);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (!data?.success) {
|
|
||||||
notifications.toasts.addDanger(
|
notifications.toasts.addDanger(
|
||||||
i18n.translate('xpack.ingestManager.copyAgentPolicy.failureNotificationTitle', {
|
i18n.translate('xpack.ingestManager.copyAgentPolicy.failureNotificationTitle', {
|
||||||
defaultMessage: "Error copying agent policy '{id}'",
|
defaultMessage: "Error copying agent policy '{id}'",
|
||||||
|
|
|
@ -59,7 +59,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent<Props> = ({ chil
|
||||||
agentPolicyId: agentPolicy!,
|
agentPolicyId: agentPolicy!,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data?.success) {
|
if (data) {
|
||||||
notifications.toasts.addSuccess(
|
notifications.toasts.addSuccess(
|
||||||
i18n.translate('xpack.ingestManager.deleteAgentPolicy.successSingleNotificationTitle', {
|
i18n.translate('xpack.ingestManager.deleteAgentPolicy.successSingleNotificationTitle', {
|
||||||
defaultMessage: "Deleted agent policy '{id}'",
|
defaultMessage: "Deleted agent policy '{id}'",
|
||||||
|
@ -69,9 +69,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent<Props> = ({ chil
|
||||||
if (onSuccessCallback.current) {
|
if (onSuccessCallback.current) {
|
||||||
onSuccessCallback.current(agentPolicy!);
|
onSuccessCallback.current(agentPolicy!);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (!data?.success) {
|
|
||||||
notifications.toasts.addDanger(
|
notifications.toasts.addDanger(
|
||||||
i18n.translate('xpack.ingestManager.deleteAgentPolicy.failureSingleNotificationTitle', {
|
i18n.translate('xpack.ingestManager.deleteAgentPolicy.failureSingleNotificationTitle', {
|
||||||
defaultMessage: "Error deleting agent policy '{id}'",
|
defaultMessage: "Error deleting agent policy '{id}'",
|
||||||
|
|
|
@ -82,7 +82,7 @@ export const SettingsView = memo<{ agentPolicy: AgentPolicy }>(
|
||||||
namespace,
|
namespace,
|
||||||
monitoring_enabled,
|
monitoring_enabled,
|
||||||
});
|
});
|
||||||
if (data?.success) {
|
if (data) {
|
||||||
notifications.toasts.addSuccess(
|
notifications.toasts.addSuccess(
|
||||||
i18n.translate('xpack.ingestManager.editAgentPolicy.successNotificationTitle', {
|
i18n.translate('xpack.ingestManager.editAgentPolicy.successNotificationTitle', {
|
||||||
defaultMessage: "Successfully updated '{name}' settings",
|
defaultMessage: "Successfully updated '{name}' settings",
|
||||||
|
|
|
@ -116,7 +116,7 @@ export const CreateAgentPolicyFlyout: React.FunctionComponent<Props> = ({
|
||||||
try {
|
try {
|
||||||
const { data, error } = await createAgentPolicy();
|
const { data, error } = await createAgentPolicy();
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
if (data?.success) {
|
if (data) {
|
||||||
notifications.toasts.addSuccess(
|
notifications.toasts.addSuccess(
|
||||||
i18n.translate(
|
i18n.translate(
|
||||||
'xpack.ingestManager.createAgentPolicy.successNotificationTitle',
|
'xpack.ingestManager.createAgentPolicy.successNotificationTitle',
|
||||||
|
|
|
@ -122,7 +122,7 @@ async function enroll(kibanaURL: string, apiKey: string, log: ToolingLog): Promi
|
||||||
});
|
});
|
||||||
const obj: PostAgentEnrollResponse = await res.json();
|
const obj: PostAgentEnrollResponse = await res.json();
|
||||||
|
|
||||||
if (!obj.success) {
|
if (!res.ok) {
|
||||||
log.error(JSON.stringify(obj, null, 2));
|
log.error(JSON.stringify(obj, null, 2));
|
||||||
throw new Error('unable to enroll');
|
throw new Error('unable to enroll');
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@ describe('test acks handlers', () => {
|
||||||
await postAgentAcksHandler(({} as unknown) as RequestHandlerContext, mockRequest, mockResponse);
|
await postAgentAcksHandler(({} as unknown) as RequestHandlerContext, mockRequest, mockResponse);
|
||||||
expect(mockResponse.ok.mock.calls[0][0]?.body as PostAgentAcksResponse).toEqual({
|
expect(mockResponse.ok.mock.calls[0][0]?.body as PostAgentAcksResponse).toEqual({
|
||||||
action: 'acks',
|
action: 'acks',
|
||||||
success: true,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,7 +46,6 @@ export const postAgentAcksHandlerBuilder = function (
|
||||||
|
|
||||||
const body: PostAgentAcksResponse = {
|
const body: PostAgentAcksResponse = {
|
||||||
action: 'acks',
|
action: 'acks',
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
|
|
@ -97,6 +97,5 @@ describe('test actions handlers', () => {
|
||||||
?.body as unknown) as PostNewAgentActionResponse;
|
?.body as unknown) as PostNewAgentActionResponse;
|
||||||
|
|
||||||
expect(expectedAgentActionResponse.item).toEqual(agentAction);
|
expect(expectedAgentActionResponse.item).toEqual(agentAction);
|
||||||
expect(expectedAgentActionResponse.success).toEqual(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,6 @@ export const postNewAgentActionHandlerBuilder = function (
|
||||||
});
|
});
|
||||||
|
|
||||||
const body: PostNewAgentActionResponse = {
|
const body: PostNewAgentActionResponse = {
|
||||||
success: true,
|
|
||||||
item: savedAgentAction,
|
item: savedAgentAction,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ export const getAgentHandler: RequestHandler<TypeOf<
|
||||||
...agent,
|
...agent,
|
||||||
status: AgentService.getAgentStatus(agent),
|
status: AgentService.getAgentStatus(agent),
|
||||||
},
|
},
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
@ -77,7 +76,6 @@ export const getAgentEventsHandler: RequestHandler<
|
||||||
const body: GetOneAgentEventsResponse = {
|
const body: GetOneAgentEventsResponse = {
|
||||||
list: items,
|
list: items,
|
||||||
total,
|
total,
|
||||||
success: true,
|
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
};
|
};
|
||||||
|
@ -107,7 +105,6 @@ export const deleteAgentHandler: RequestHandler<TypeOf<
|
||||||
await AgentService.deleteAgent(soClient, request.params.agentId);
|
await AgentService.deleteAgent(soClient, request.params.agentId);
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
success: true,
|
|
||||||
action: 'deleted',
|
action: 'deleted',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,7 +141,6 @@ export const updateAgentHandler: RequestHandler<
|
||||||
...agent,
|
...agent,
|
||||||
status: AgentService.getAgentStatus(agent),
|
status: AgentService.getAgentStatus(agent),
|
||||||
},
|
},
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
@ -187,7 +183,6 @@ export const postAgentCheckinHandler: RequestHandler<
|
||||||
);
|
);
|
||||||
const body: PostAgentCheckinResponse = {
|
const body: PostAgentCheckinResponse = {
|
||||||
action: 'checkin',
|
action: 'checkin',
|
||||||
success: true,
|
|
||||||
actions: actions.map((a) => ({
|
actions: actions.map((a) => ({
|
||||||
agent_id: agent.id,
|
agent_id: agent.id,
|
||||||
type: a.type,
|
type: a.type,
|
||||||
|
@ -248,7 +243,6 @@ export const postAgentEnrollHandler: RequestHandler<
|
||||||
);
|
);
|
||||||
const body: PostAgentEnrollResponse = {
|
const body: PostAgentEnrollResponse = {
|
||||||
action: 'created',
|
action: 'created',
|
||||||
success: true,
|
|
||||||
item: {
|
item: {
|
||||||
...agent,
|
...agent,
|
||||||
status: AgentService.getAgentStatus(agent),
|
status: AgentService.getAgentStatus(agent),
|
||||||
|
@ -289,7 +283,6 @@ export const getAgentsHandler: RequestHandler<
|
||||||
...agent,
|
...agent,
|
||||||
status: AgentService.getAgentStatus(agent),
|
status: AgentService.getAgentStatus(agent),
|
||||||
})),
|
})),
|
||||||
success: true,
|
|
||||||
total,
|
total,
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
|
@ -312,9 +305,7 @@ export const putAgentsReassignHandler: RequestHandler<
|
||||||
try {
|
try {
|
||||||
await AgentService.reassignAgent(soClient, request.params.agentId, request.body.policy_id);
|
await AgentService.reassignAgent(soClient, request.params.agentId, request.body.policy_id);
|
||||||
|
|
||||||
const body: PutAgentReassignResponse = {
|
const body: PutAgentReassignResponse = {};
|
||||||
success: true,
|
|
||||||
};
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return response.customError({
|
return response.customError({
|
||||||
|
@ -336,7 +327,7 @@ export const getAgentStatusForAgentPolicyHandler: RequestHandler<
|
||||||
request.query.policyId
|
request.query.policyId
|
||||||
);
|
);
|
||||||
|
|
||||||
const body: GetAgentStatusResponse = { results, success: true };
|
const body: GetAgentStatusResponse = { results };
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -23,9 +23,7 @@ export const postAgentsUnenrollHandler: RequestHandler<
|
||||||
await AgentService.unenrollAgent(soClient, request.params.agentId);
|
await AgentService.unenrollAgent(soClient, request.params.agentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const body: PostAgentUnenrollResponse = {
|
const body: PostAgentUnenrollResponse = {};
|
||||||
success: true,
|
|
||||||
};
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return response.customError({
|
return response.customError({
|
||||||
|
|
|
@ -49,7 +49,6 @@ export const getAgentPoliciesHandler: RequestHandler<
|
||||||
total,
|
total,
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await bluebird.map(
|
await bluebird.map(
|
||||||
|
@ -82,7 +81,6 @@ export const getOneAgentPolicyHandler: RequestHandler<TypeOf<
|
||||||
if (agentPolicy) {
|
if (agentPolicy) {
|
||||||
const body: GetOneAgentPolicyResponse = {
|
const body: GetOneAgentPolicyResponse = {
|
||||||
item: agentPolicy,
|
item: agentPolicy,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
|
@ -141,7 +139,6 @@ export const createAgentPolicyHandler: RequestHandler<
|
||||||
|
|
||||||
const body: CreateAgentPolicyResponse = {
|
const body: CreateAgentPolicyResponse = {
|
||||||
item: agentPolicy,
|
item: agentPolicy,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({
|
return response.ok({
|
||||||
|
@ -171,7 +168,7 @@ export const updateAgentPolicyHandler: RequestHandler<
|
||||||
user: user || undefined,
|
user: user || undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const body: UpdateAgentPolicyResponse = { item: agentPolicy, success: true };
|
const body: UpdateAgentPolicyResponse = { item: agentPolicy };
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
});
|
});
|
||||||
|
@ -199,7 +196,7 @@ export const copyAgentPolicyHandler: RequestHandler<
|
||||||
user: user || undefined,
|
user: user || undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const body: CopyAgentPolicyResponse = { item: agentPolicy, success: true };
|
const body: CopyAgentPolicyResponse = { item: agentPolicy };
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
});
|
});
|
||||||
|
@ -248,7 +245,6 @@ export const getFullAgentPolicy: RequestHandler<
|
||||||
if (fullAgentPolicy) {
|
if (fullAgentPolicy) {
|
||||||
const body: GetFullAgentPolicyResponse = {
|
const body: GetFullAgentPolicyResponse = {
|
||||||
item: fullAgentPolicy,
|
item: fullAgentPolicy,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
|
|
|
@ -31,7 +31,7 @@ export const getEnrollmentApiKeysHandler: RequestHandler<
|
||||||
perPage: request.query.perPage,
|
perPage: request.query.perPage,
|
||||||
kuery: request.query.kuery,
|
kuery: request.query.kuery,
|
||||||
});
|
});
|
||||||
const body: GetEnrollmentAPIKeysResponse = { list: items, success: true, total, page, perPage };
|
const body: GetEnrollmentAPIKeysResponse = { list: items, total, page, perPage };
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -54,7 +54,7 @@ export const postEnrollmentApiKeyHandler: RequestHandler<
|
||||||
agentPolicyId: request.body.policy_id,
|
agentPolicyId: request.body.policy_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const body: PostEnrollmentAPIKeyResponse = { item: apiKey, success: true, action: 'created' };
|
const body: PostEnrollmentAPIKeyResponse = { item: apiKey, action: 'created' };
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -78,7 +78,7 @@ export const deleteEnrollmentApiKeyHandler: RequestHandler<TypeOf<
|
||||||
try {
|
try {
|
||||||
await APIKeyService.deleteEnrollmentApiKey(soClient, request.params.keyId);
|
await APIKeyService.deleteEnrollmentApiKey(soClient, request.params.keyId);
|
||||||
|
|
||||||
const body: DeleteEnrollmentAPIKeyResponse = { action: 'deleted', success: true };
|
const body: DeleteEnrollmentAPIKeyResponse = { action: 'deleted' };
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -100,7 +100,7 @@ export const getOneEnrollmentApiKeyHandler: RequestHandler<TypeOf<
|
||||||
const soClient = context.core.savedObjects.client;
|
const soClient = context.core.savedObjects.client;
|
||||||
try {
|
try {
|
||||||
const apiKey = await APIKeyService.getEnrollmentAPIKey(soClient, request.params.keyId);
|
const apiKey = await APIKeyService.getEnrollmentAPIKey(soClient, request.params.keyId);
|
||||||
const body: GetOneEnrollmentAPIKeyResponse = { item: apiKey, success: true };
|
const body: GetOneEnrollmentAPIKeyResponse = { item: apiKey };
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -43,7 +43,6 @@ export const getCategoriesHandler: RequestHandler<
|
||||||
const res = await getCategories(request.query);
|
const res = await getCategories(request.query);
|
||||||
const body: GetCategoriesResponse = {
|
const body: GetCategoriesResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -66,7 +65,6 @@ export const getListHandler: RequestHandler<
|
||||||
});
|
});
|
||||||
const body: GetPackagesResponse = {
|
const body: GetPackagesResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
|
@ -85,7 +83,6 @@ export const getLimitedListHandler: RequestHandler = async (context, request, re
|
||||||
const res = await getLimitedPackages({ savedObjectsClient });
|
const res = await getLimitedPackages({ savedObjectsClient });
|
||||||
const body: GetLimitedPackagesResponse = {
|
const body: GetLimitedPackagesResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
|
@ -136,7 +133,6 @@ export const getInfoHandler: RequestHandler<TypeOf<typeof GetInfoRequestSchema.p
|
||||||
const res = await getPackageInfo({ savedObjectsClient, pkgName, pkgVersion });
|
const res = await getPackageInfo({ savedObjectsClient, pkgName, pkgVersion });
|
||||||
const body: GetInfoResponse = {
|
const body: GetInfoResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -166,7 +162,6 @@ export const installPackageHandler: RequestHandler<
|
||||||
});
|
});
|
||||||
const body: InstallPackageResponse = {
|
const body: InstallPackageResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -206,7 +201,6 @@ export const deletePackageHandler: RequestHandler<TypeOf<
|
||||||
const res = await removeInstallation({ savedObjectsClient, pkgkey, callCluster });
|
const res = await removeInstallation({ savedObjectsClient, pkgkey, callCluster });
|
||||||
const body: DeletePackageResponse = {
|
const body: DeletePackageResponse = {
|
||||||
response: res,
|
response: res,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ export const getOutputsHandler: RequestHandler = async (context, request, respon
|
||||||
page: outputs.page,
|
page: outputs.page,
|
||||||
perPage: outputs.perPage,
|
perPage: outputs.perPage,
|
||||||
total: outputs.total,
|
total: outputs.total,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
@ -41,7 +40,6 @@ export const getOneOuputHandler: RequestHandler<TypeOf<
|
||||||
|
|
||||||
const body: GetOneOutputResponse = {
|
const body: GetOneOutputResponse = {
|
||||||
item: output,
|
item: output,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
@ -71,7 +69,6 @@ export const putOuputHandler: RequestHandler<
|
||||||
|
|
||||||
const body: GetOneOutputResponse = {
|
const body: GetOneOutputResponse = {
|
||||||
item: output,
|
item: output,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
|
|
@ -34,7 +34,6 @@ export const getPackagePoliciesHandler: RequestHandler<
|
||||||
total,
|
total,
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
success: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -59,7 +58,6 @@ export const getOnePackagePolicyHandler: RequestHandler<TypeOf<
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body: {
|
body: {
|
||||||
item: packagePolicy,
|
item: packagePolicy,
|
||||||
success: true,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,7 +113,7 @@ export const createPackagePolicyHandler: RequestHandler<
|
||||||
const packagePolicy = await packagePolicyService.create(soClient, callCluster, newData, {
|
const packagePolicy = await packagePolicyService.create(soClient, callCluster, newData, {
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
const body: CreatePackagePolicyResponse = { item: packagePolicy, success: true };
|
const body: CreatePackagePolicyResponse = { item: packagePolicy };
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body,
|
body,
|
||||||
});
|
});
|
||||||
|
@ -163,7 +161,7 @@ export const updatePackagePolicyHandler: RequestHandler<
|
||||||
{ user }
|
{ user }
|
||||||
);
|
);
|
||||||
return response.ok({
|
return response.ok({
|
||||||
body: { item: updatedPackagePolicy, success: true },
|
body: { item: updatedPackagePolicy },
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return response.customError({
|
return response.customError({
|
||||||
|
|
|
@ -16,7 +16,6 @@ export const getSettingsHandler: RequestHandler = async (context, request, respo
|
||||||
try {
|
try {
|
||||||
const settings = await settingsService.getSettings(soClient);
|
const settings = await settingsService.getSettings(soClient);
|
||||||
const body = {
|
const body = {
|
||||||
success: true,
|
|
||||||
item: settings,
|
item: settings,
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
@ -47,7 +46,6 @@ export const putSettingsHandler: RequestHandler<
|
||||||
user: user || undefined,
|
user: user || undefined,
|
||||||
});
|
});
|
||||||
const body = {
|
const body = {
|
||||||
success: true,
|
|
||||||
item: settings,
|
item: settings,
|
||||||
};
|
};
|
||||||
return response.ok({ body });
|
return response.ok({ body });
|
||||||
|
|
|
@ -380,7 +380,6 @@ class AgentPolicyService {
|
||||||
await this.triggerAgentPolicyUpdatedEvent(soClient, 'deleted', id);
|
await this.triggerAgentPolicyUpdatedEvent(soClient, 'deleted', id);
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ const endpointListApiPathHandlerMocks = ({
|
||||||
[INGEST_API_EPM_PACKAGES]: (): GetPackagesResponse => {
|
[INGEST_API_EPM_PACKAGES]: (): GetPackagesResponse => {
|
||||||
return {
|
return {
|
||||||
response: epmPackages,
|
response: epmPackages,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -114,7 +113,6 @@ const endpointListApiPathHandlerMocks = ({
|
||||||
return {
|
return {
|
||||||
items: [agentPolicy],
|
items: [agentPolicy],
|
||||||
total: 10,
|
total: 10,
|
||||||
success: true,
|
|
||||||
perPage: 10,
|
perPage: 10,
|
||||||
page: 1,
|
page: 1,
|
||||||
};
|
};
|
||||||
|
@ -132,7 +130,6 @@ const endpointListApiPathHandlerMocks = ({
|
||||||
page: 1,
|
page: 1,
|
||||||
perPage: 10,
|
perPage: 10,
|
||||||
total: endpointPackagePolicies?.length,
|
total: endpointPackagePolicies?.length,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,6 @@ export const mockPolicyResultList: (options?: {
|
||||||
total,
|
total,
|
||||||
page: requestPageIndex,
|
page: requestPageIndex,
|
||||||
perPage: requestPageSize,
|
perPage: requestPageSize,
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
return mock;
|
return mock;
|
||||||
};
|
};
|
||||||
|
@ -81,7 +80,6 @@ export const policyListApiPathHandlers = (totalPolicies: number = 1) => {
|
||||||
[INGEST_API_EPM_PACKAGES]: (): GetPackagesResponse => {
|
[INGEST_API_EPM_PACKAGES]: (): GetPackagesResponse => {
|
||||||
return {
|
return {
|
||||||
response: [generator.generateEpmPackage()],
|
response: [generator.generateEpmPackage()],
|
||||||
success: true,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
describe('ingest_manager_agent_policies', () => {
|
describe('ingest_manager_agent_policies', () => {
|
||||||
describe('POST /api/ingest_manager/agent_policies', () => {
|
describe('POST /api/ingest_manager/agent_policies', () => {
|
||||||
it('should work with valid values', async () => {
|
it('should work with valid values', async () => {
|
||||||
const { body: apiResponse } = await supertest
|
await supertest
|
||||||
.post(`/api/ingest_manager/agent_policies`)
|
.post(`/api/ingest_manager/agent_policies`)
|
||||||
.set('kbn-xsrf', 'xxxx')
|
.set('kbn-xsrf', 'xxxx')
|
||||||
.send({
|
.send({
|
||||||
|
@ -22,8 +22,6 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
namespace: 'default',
|
namespace: 'default',
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a 400 with an empty namespace', async () => {
|
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 () => {
|
it('should work with valid values', async () => {
|
||||||
const {
|
const {
|
||||||
body: { success, item },
|
body: { item },
|
||||||
} = await supertest
|
} = await supertest
|
||||||
.post(`/api/ingest_manager/agent_policies/${TEST_POLICY_ID}/copy`)
|
.post(`/api/ingest_manager/agent_policies/${TEST_POLICY_ID}/copy`)
|
||||||
.set('kbn-xsrf', 'xxxx')
|
.set('kbn-xsrf', 'xxxx')
|
||||||
|
@ -73,7 +71,6 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
const { id, updated_at, ...newPolicy } = item;
|
const { id, updated_at, ...newPolicy } = item;
|
||||||
|
|
||||||
expect(success).to.be(true);
|
|
||||||
expect(newPolicy).to.eql({
|
expect(newPolicy).to.eql({
|
||||||
name: 'Copied policy',
|
name: 'Copied policy',
|
||||||
description: 'Test',
|
description: 'Test',
|
||||||
|
|
|
@ -90,7 +90,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(apiResponse.action).to.be('acks');
|
expect(apiResponse.action).to.be('acks');
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
const { body: eventResponse } = await supertest
|
const { body: eventResponse } = await supertest
|
||||||
.get(`/api/ingest_manager/fleet/agents/agent1/events`)
|
.get(`/api/ingest_manager/fleet/agents/agent1/events`)
|
||||||
.set('kbn-xsrf', 'xx')
|
.set('kbn-xsrf', 'xx')
|
||||||
|
|
|
@ -33,7 +33,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
expect(apiResponse.item.data).to.eql({ data: 'action_data' });
|
expect(apiResponse.item.data).to.eql({ data: 'action_data' });
|
||||||
expect(apiResponse.item.sent_at).to.be('2020-03-18T19:45:02.620Z');
|
expect(apiResponse.item.sent_at).to.be('2020-03-18T19:45:02.620Z');
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,7 +102,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.action).to.be('checkin');
|
expect(apiResponse.action).to.be('checkin');
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(enrollmentResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
const agentAccessAPIKey = enrollmentResponse.item.access_api_key;
|
const agentAccessAPIKey = enrollmentResponse.item.access_api_key;
|
||||||
|
|
||||||
|
@ -76,14 +75,13 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(checkinApiResponse.success).to.eql(true);
|
|
||||||
expect(checkinApiResponse.actions).length(1);
|
expect(checkinApiResponse.actions).length(1);
|
||||||
expect(checkinApiResponse.actions[0].type).be('CONFIG_CHANGE');
|
expect(checkinApiResponse.actions[0].type).be('CONFIG_CHANGE');
|
||||||
const policyChangeAction = checkinApiResponse.actions[0];
|
const policyChangeAction = checkinApiResponse.actions[0];
|
||||||
const defaultOutputApiKey = policyChangeAction.data.config.outputs.default.api_key;
|
const defaultOutputApiKey = policyChangeAction.data.config.outputs.default.api_key;
|
||||||
|
|
||||||
// Ack actions
|
// Ack actions
|
||||||
const { body: ackApiResponse } = await supertestWithoutAuth
|
await supertestWithoutAuth
|
||||||
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`)
|
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`)
|
||||||
.set('Authorization', `ApiKey ${agentAccessAPIKey}`)
|
.set('Authorization', `ApiKey ${agentAccessAPIKey}`)
|
||||||
.set('kbn-xsrf', 'xx')
|
.set('kbn-xsrf', 'xx')
|
||||||
|
@ -102,7 +100,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(ackApiResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
// Second agent checkin
|
// Second agent checkin
|
||||||
const { body: secondCheckinApiResponse } = await supertestWithoutAuth
|
const { body: secondCheckinApiResponse } = await supertestWithoutAuth
|
||||||
|
@ -113,7 +110,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
events: [],
|
events: [],
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(secondCheckinApiResponse.success).to.eql(true);
|
|
||||||
expect(secondCheckinApiResponse.actions).length(0);
|
expect(secondCheckinApiResponse.actions).length(0);
|
||||||
|
|
||||||
// Get agent
|
// Get agent
|
||||||
|
@ -121,18 +117,16 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
.get(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}`)
|
.get(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}`)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(getAgentApiResponse.success).to.eql(true);
|
|
||||||
expect(getAgentApiResponse.item.packages).to.contain(
|
expect(getAgentApiResponse.item.packages).to.contain(
|
||||||
'system',
|
'system',
|
||||||
"Agent should run the 'system' package"
|
"Agent should run the 'system' package"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Unenroll agent
|
// Unenroll agent
|
||||||
const { body: unenrollResponse } = await supertest
|
await supertest
|
||||||
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/unenroll`)
|
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/unenroll`)
|
||||||
.set('kbn-xsrf', 'xx')
|
.set('kbn-xsrf', 'xx')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(unenrollResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
// Checkin after unenrollment
|
// Checkin after unenrollment
|
||||||
const { body: checkinAfterUnenrollResponse } = await supertestWithoutAuth
|
const { body: checkinAfterUnenrollResponse } = await supertestWithoutAuth
|
||||||
|
@ -144,13 +138,12 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(checkinAfterUnenrollResponse.success).to.eql(true);
|
|
||||||
expect(checkinAfterUnenrollResponse.actions).length(1);
|
expect(checkinAfterUnenrollResponse.actions).length(1);
|
||||||
expect(checkinAfterUnenrollResponse.actions[0].type).be('UNENROLL');
|
expect(checkinAfterUnenrollResponse.actions[0].type).be('UNENROLL');
|
||||||
const unenrollAction = checkinAfterUnenrollResponse.actions[0];
|
const unenrollAction = checkinAfterUnenrollResponse.actions[0];
|
||||||
|
|
||||||
// ack unenroll actions
|
// ack unenroll actions
|
||||||
const { body: ackUnenrollApiResponse } = await supertestWithoutAuth
|
await supertestWithoutAuth
|
||||||
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`)
|
.post(`/api/ingest_manager/fleet/agents/${enrollmentResponse.item.id}/acks`)
|
||||||
.set('Authorization', `ApiKey ${agentAccessAPIKey}`)
|
.set('Authorization', `ApiKey ${agentAccessAPIKey}`)
|
||||||
.set('kbn-xsrf', 'xx')
|
.set('kbn-xsrf', 'xx')
|
||||||
|
@ -168,7 +161,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(ackUnenrollApiResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
// Checkin after unenrollment acknowledged
|
// Checkin after unenrollment acknowledged
|
||||||
await supertestWithoutAuth
|
await supertestWithoutAuth
|
||||||
|
|
|
@ -68,7 +68,6 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
.expect(404);
|
.expect(404);
|
||||||
|
|
||||||
expect(apiResponse).not.to.eql({
|
expect(apiResponse).not.to.eql({
|
||||||
success: true,
|
|
||||||
action: 'deleted',
|
action: 'deleted',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -88,7 +87,6 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
.set('kbn-xsrf', 'xx')
|
.set('kbn-xsrf', 'xx')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(apiResponse).to.eql({
|
expect(apiResponse).to.eql({
|
||||||
success: true,
|
|
||||||
action: 'deleted',
|
action: 'deleted',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -136,7 +136,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
expect(apiResponse.item).to.have.keys('id', 'active', 'access_api_key', 'type', 'policy_id');
|
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(200);
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
const { body: privileges } = await getEsClientForAPIKey(
|
const { body: privileges } = await getEsClientForAPIKey(
|
||||||
providerContext,
|
providerContext,
|
||||||
apiResponse.item.access_api_key
|
apiResponse.item.access_api_key
|
||||||
|
|
|
@ -78,8 +78,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
.auth(users.fleet_admin.username, users.fleet_admin.password)
|
.auth(users.fleet_admin.username, users.fleet_admin.password)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse).to.have.keys('success', 'page', 'total', 'list');
|
expect(apiResponse).to.have.keys('page', 'total', 'list');
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
expect(apiResponse.total).to.eql(4);
|
expect(apiResponse.total).to.eql(4);
|
||||||
});
|
});
|
||||||
it('should return the list of agents when requesting as a user with fleet read permissions', async () => {
|
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`)
|
.get(`/api/ingest_manager/fleet/agents`)
|
||||||
.auth(users.fleet_user.username, users.fleet_user.password)
|
.auth(users.fleet_user.username, users.fleet_user.password)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(apiResponse).to.have.keys('success', 'page', 'total', 'list');
|
expect(apiResponse).to.have.keys('page', 'total', 'list');
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
expect(apiResponse.total).to.eql(4);
|
expect(apiResponse.total).to.eql(4);
|
||||||
});
|
});
|
||||||
it('should not return the list of agents when requesting as a user without fleet permissions', async () => {
|
it('should not return the list of agents when requesting as a user without fleet permissions', async () => {
|
||||||
|
|
|
@ -65,20 +65,17 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allow to unenroll using a list of ids', async () => {
|
it('allow to unenroll using a list of ids', async () => {
|
||||||
const { body } = await supertest
|
await supertest
|
||||||
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
|
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
|
||||||
.set('kbn-xsrf', 'xxx')
|
.set('kbn-xsrf', 'xxx')
|
||||||
.send({
|
.send({
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body).to.have.keys('success');
|
|
||||||
expect(body.success).to.be(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should invalidate related API keys', async () => {
|
it('should invalidate related API keys', async () => {
|
||||||
const { body } = await supertest
|
await supertest
|
||||||
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
|
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
|
||||||
.set('kbn-xsrf', 'xxx')
|
.set('kbn-xsrf', 'xxx')
|
||||||
.send({
|
.send({
|
||||||
|
@ -86,9 +83,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body).to.have.keys('success');
|
|
||||||
expect(body.success).to.be(true);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
body: { api_keys: accessAPIKeys },
|
body: { api_keys: accessAPIKeys },
|
||||||
} = await esClient.security.getApiKey({ id: accessAPIKeyId });
|
} = await esClient.security.getApiKey({ id: accessAPIKeyId });
|
||||||
|
|
|
@ -67,13 +67,11 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should invalide an existing api keys', async () => {
|
it('should invalide an existing api keys', async () => {
|
||||||
const { body: apiResponse } = await supertest
|
await supertest
|
||||||
.delete(`/api/ingest_manager/fleet/enrollment-api-keys/${keyId}`)
|
.delete(`/api/ingest_manager/fleet/enrollment-api-keys/${keyId}`)
|
||||||
.set('kbn-xsrf', 'xxx')
|
.set('kbn-xsrf', 'xxx')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
body: { api_keys: apiKeys },
|
body: { api_keys: apiKeys },
|
||||||
} = await es.security.getApiKey({ id: esApiKeyId });
|
} = await es.security.getApiKey({ id: esApiKeyId });
|
||||||
|
@ -113,7 +111,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
expect(apiResponse.item).to.have.keys('id', 'api_key', 'api_key_id', 'name', 'policy_id');
|
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',
|
policy_id: 'policy1',
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(apiResponse.success).to.eql(true);
|
|
||||||
const { body: privileges } = await getEsClientForAPIKey(
|
const { body: privileges } = await getEsClientForAPIKey(
|
||||||
providerContext,
|
providerContext,
|
||||||
apiResponse.item.api_key
|
apiResponse.item.api_key
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
|
||||||
import { warnAndSkipTest } from '../../helpers';
|
import { warnAndSkipTest } from '../../helpers';
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
|
|
||||||
it('should work with valid values', async function () {
|
it('should work with valid values', async function () {
|
||||||
if (server.enabled) {
|
if (server.enabled) {
|
||||||
const { body: apiResponse } = await supertest
|
await supertest
|
||||||
.post(`/api/ingest_manager/package_policies`)
|
.post(`/api/ingest_manager/package_policies`)
|
||||||
.set('kbn-xsrf', 'xxxx')
|
.set('kbn-xsrf', 'xxxx')
|
||||||
.send({
|
.send({
|
||||||
|
@ -52,8 +51,6 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
} else {
|
} else {
|
||||||
warnAndSkipTest(this, log);
|
warnAndSkipTest(this, log);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
|
||||||
import { skipIfNoDockerRegistry } from '../../helpers';
|
import { skipIfNoDockerRegistry } from '../../helpers';
|
||||||
|
|
||||||
|
@ -75,11 +74,7 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should succeed with a valid id', async function () {
|
it('should succeed with a valid id', async function () {
|
||||||
const { body: apiResponse } = await supertest
|
await supertest.get(`/api/ingest_manager/package_policies/${packagePolicyId}`).expect(200);
|
||||||
.get(`/api/ingest_manager/package_policies/${packagePolicyId}`)
|
|
||||||
.expect(200);
|
|
||||||
|
|
||||||
expect(apiResponse.success).to.be(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a 404 with an invalid id', async function () {
|
it('should return a 404 with an invalid id', async function () {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
|
||||||
import { skipIfNoDockerRegistry } from '../../helpers';
|
import { skipIfNoDockerRegistry } from '../../helpers';
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work with valid values', async function () {
|
it('should work with valid values', async function () {
|
||||||
const { body: apiResponse } = await supertest
|
await supertest
|
||||||
.put(`/api/ingest_manager/package_policies/${packagePolicyId}`)
|
.put(`/api/ingest_manager/package_policies/${packagePolicyId}`)
|
||||||
.set('kbn-xsrf', 'xxxx')
|
.set('kbn-xsrf', 'xxxx')
|
||||||
.send({
|
.send({
|
||||||
|
@ -95,8 +94,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expect(200);
|
.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 () {
|
it('should return a 500 if there is another package policy with the same name', async function () {
|
||||||
|
|
|
@ -54,7 +54,6 @@ export default function (providerContext: FtrProviderContext) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(enrollmentResponse.success).to.eql(true);
|
|
||||||
|
|
||||||
agentAccessAPIKey = enrollmentResponse.item.access_api_key;
|
agentAccessAPIKey = enrollmentResponse.item.access_api_key;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue