Skip to content

Commit

Permalink
[Ingest Manager] Remove success: true as top-level API response (#73223)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
John Schulz and elasticmachine authored Sep 2, 2020
1 parent 7b7b013 commit 71b9ded
Show file tree
Hide file tree
Showing 42 changed files with 58 additions and 229 deletions.
94 changes: 19 additions & 75 deletions x-pack/plugins/ingest_manager/common/openapi/spec_oas3.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@
},
"perPage": {
"type": "number"
},
"success": {
"type": "boolean"
}
},
"required": ["items", "total", "page", "perPage", "success"]
"required": ["items", "total", "page", "perPage"]
},
"examples": {
"success": {
Expand All @@ -71,8 +68,7 @@
],
"total": 1,
"page": 1,
"perPage": 50,
"success": true
"perPage": 50
}
}
}
Expand Down Expand Up @@ -107,9 +103,6 @@
"properties": {
"item": {
"$ref": "#/components/schemas/AgentPolicy"
},
"success": {
"type": "boolean"
}
}
}
Expand Down Expand Up @@ -159,12 +152,9 @@
"properties": {
"item": {
"$ref": "#/components/schemas/AgentPolicy"
},
"success": {
"type": "boolean"
}
},
"required": ["item", "success"]
"required": ["item"]
},
"examples": {
"success": {
Expand Down Expand Up @@ -707,8 +697,7 @@
"revision": 2,
"updated_on": "2020-05-06T17:32:21.905Z",
"updated_by": "system"
},
"success": true
}
}
}
}
Expand All @@ -733,12 +722,9 @@
"properties": {
"item": {
"$ref": "#/components/schemas/AgentPolicy"
},
"success": {
"type": "boolean"
}
},
"required": ["item", "success"]
"required": ["item"]
},
"examples": {
"example-1": {
Expand All @@ -751,8 +737,7 @@
"updated_on": "Fri Feb 28 2020 16:22:31 GMT-0500 (Eastern Standard Time)",
"updated_by": "elastic",
"packagePolicies": []
},
"success": true
}
}
}
}
Expand Down Expand Up @@ -810,12 +795,9 @@
"properties": {
"item": {
"$ref": "#/components/schemas/AgentPolicy"
},
"success": {
"type": "boolean"
}
},
"required": ["item", "success"]
"required": ["item"]
}
}
}
Expand Down Expand Up @@ -948,12 +930,9 @@
},
"perPage": {
"type": "number"
},
"success": {
"type": "boolean"
}
},
"required": ["items", "success"]
"required": ["items"]
},
"examples": {
"example-1": {
Expand Down Expand Up @@ -1157,8 +1136,7 @@
],
"total": 6,
"page": 1,
"perPage": 20,
"success": true
"perPage": 20
}
}
}
Expand Down Expand Up @@ -1251,12 +1229,9 @@
"properties": {
"item": {
"$ref": "#/components/schemas/PackagePolicy"
},
"success": {
"type": "boolean"
}
},
"required": ["item", "success"]
"required": ["item"]
}
}
}
Expand Down Expand Up @@ -1415,9 +1390,6 @@
"properties": {
"response": {
"$ref": "#/components/schemas/PackageInfo"
},
"success": {
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -1709,8 +1681,7 @@
},
"references": []
}
},
"success": true
}
}
},
"required-package": {
Expand Down Expand Up @@ -1899,8 +1870,7 @@
},
"references": []
}
},
"success": true
}
}
}
}
Expand Down Expand Up @@ -1950,12 +1920,9 @@
},
"required": ["id", "type"]
}
},
"success": {
"type": "boolean"
}
},
"required": ["response", "success"]
"required": ["response"]
}
}
}
Expand Down Expand Up @@ -1994,12 +1961,9 @@
},
"required": ["id", "type"]
}
},
"success": {
"type": "boolean"
}
},
"required": ["response", "success"]
"required": ["response"]
}
}
}
Expand Down Expand Up @@ -2678,8 +2642,7 @@
"version": "1.0.0",
"status": "not_installed"
}
],
"success": true
]
}
}
}
Expand Down Expand Up @@ -2743,9 +2706,6 @@
"type": "object"
}
},
"success": {
"type": "boolean"
},
"total": {
"type": "number"
},
Expand All @@ -2756,7 +2716,7 @@
"type": "number"
}
},
"required": ["list", "success", "total", "page", "perPage"]
"required": ["list", "total", "page", "perPage"]
},
"examples": {
"example-1": {
Expand Down Expand Up @@ -2793,7 +2753,6 @@
"status": "online"
}
],
"success": true,
"total": 1,
"page": 1,
"perPage": 20
Expand Down Expand Up @@ -2836,12 +2795,9 @@
"properties": {
"item": {
"type": "object"
},
"success": {
"type": "string"
}
},
"required": ["item", "success"]
"required": ["item"]
}
}
}
Expand Down Expand Up @@ -2916,9 +2872,6 @@
"type": "string",
"enum": ["checkin"]
},
"success": {
"type": "string"
},
"actions": {
"type": "array",
"items": {
Expand Down Expand Up @@ -2950,7 +2903,6 @@
"success": {
"value": {
"action": "checkin",
"success": true,
"actions": [
{
"agent_id": "a6f14bd2-1a2a-481c-9212-9494d064ffdf",
Expand Down Expand Up @@ -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"
}
}
}
Expand Down Expand Up @@ -3417,9 +3365,6 @@
"action": {
"type": "string"
},
"success": {
"type": "boolean"
},
"item": {
"$ref": "#/components/schemas/Agent"
}
Expand All @@ -3429,7 +3374,6 @@
"success": {
"value": {
"action": "created",
"success": true,
"item": {
"id": "8086fb1a-72ca-4a67-8533-09300c1639fa",
"active": true,
Expand Down
20 changes: 6 additions & 14 deletions x-pack/plugins/ingest_manager/common/types/rest_spec/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export interface GetAgentsResponse {
total: number;
page: number;
perPage: number;
success: boolean;
}

export interface GetOneAgentRequest {
Expand All @@ -39,7 +38,6 @@ export interface GetOneAgentRequest {

export interface GetOneAgentResponse {
item: Agent;
success: boolean;
}

export interface PostAgentCheckinRequest {
Expand All @@ -55,7 +53,7 @@ export interface PostAgentCheckinRequest {

export interface PostAgentCheckinResponse {
action: string;
success: boolean;

actions: AgentAction[];
}

Expand All @@ -72,7 +70,7 @@ export interface PostAgentEnrollRequest {

export interface PostAgentEnrollResponse {
action: string;
success: boolean;

item: Agent & { status: AgentStatus };
}

Expand All @@ -87,7 +85,6 @@ export interface PostAgentAcksRequest {

export interface PostAgentAcksResponse {
action: string;
success: boolean;
}

export interface PostNewAgentActionRequest {
Expand All @@ -100,7 +97,6 @@ export interface PostNewAgentActionRequest {
}

export interface PostNewAgentActionResponse {
success: boolean;
item: AgentAction;
}

Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -141,7 +135,6 @@ export interface GetOneAgentEventsResponse {
total: number;
page: number;
perPage: number;
success: boolean;
}

export interface DeleteAgentRequest {
Expand All @@ -166,7 +159,6 @@ export interface GetAgentStatusRequest {
}

export interface GetAgentStatusResponse {
success: boolean;
results: {
events: number;
total: number;
Expand Down
Loading

0 comments on commit 71b9ded

Please sign in to comment.