Skip to content

Commit

Permalink
[EDR Workflows] Create missing OpenAPI specs for Endpoint management …
Browse files Browse the repository at this point in the history
…API (#187261)

This PR adds OpenAPI schemas for Defend Workflows API endpoints that
previously didn't have them. Here are the changes made:
1. Added a schema for `/api/endpoint/isolate`, which is deprecated and
now redirects as a `308` to the new path
(`/api/endpoint/action/isolate`). It's tagged with `x-labels` as `ess`
only.
2. Added a schema for `/api/endpoint/unisolate`, which is deprecated and
now redirects as a `308` to the new path
(`/api/endpoint/action/unisolate`). It's tagged with `x-labels` as `ess`
only.
3. Added a schema for
`/api/endpoint/protection_updates_note/{package_policy_id}`.
4. Added `x-labels` field to all existing Defend Workflows API paths for
proper tagging.

For more information on `x-labels`, please refer to
#184348
  • Loading branch information
szwarckonrad authored Jul 5, 2024
1 parent 4802a0f commit 68d5370
Show file tree
Hide file tree
Showing 23 changed files with 369 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Action State schema
operationId: EndpointGetActionsState
x-codegen-enabled: false
x-labels:
- ess
- serverless
responses:
'200':
description: OK
Expand All @@ -21,6 +24,9 @@ paths:
summary: Get Running Processes Action
operationId: EndpointGetRunningProcessesAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand All @@ -40,6 +46,9 @@ paths:
summary: Isolate host Action
operationId: EndpointIsolateHostAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand All @@ -59,6 +68,9 @@ paths:
summary: Unisolate host Action
operationId: EndpointUnisolateHostAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand All @@ -78,6 +90,9 @@ paths:
summary: Kill process Action
operationId: EndpointKillProcessAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand All @@ -98,6 +113,9 @@ paths:
summary: Suspend process Action
operationId: EndpointSuspendProcessAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Actions status schema
operationId: EndpointGetActionsStatus
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get action audit log schema
operationId: EndpointGetActionAuditLog
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Action details schema
operationId: EndpointGetActionsDetails
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Execute Action
operationId: EndpointExecuteAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: File Download schema
operationId: EndpointFileDownload
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: File Info schema
operationId: EndpointFileInfo
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Upload Action
operationId: EndpointUploadAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get File Action
operationId: EndpointGetFileAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Endpoint Isolate Schema
* version: 2023-10-31
*/

import type { z } from 'zod';

import { BaseActionSchema, SuccessResponse } from '../model/schema/common.gen';

export type EndpointIsolateRedirectRequestBody = z.infer<typeof EndpointIsolateRedirectRequestBody>;
export const EndpointIsolateRedirectRequestBody = BaseActionSchema;
export type EndpointIsolateRedirectRequestBodyInput = z.input<
typeof EndpointIsolateRedirectRequestBody
>;

export type EndpointIsolateRedirectResponse = z.infer<typeof EndpointIsolateRedirectResponse>;
export const EndpointIsolateRedirectResponse = SuccessResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
openapi: 3.0.0
info:
title: Endpoint Isolate Schema
version: '2023-10-31'
paths:
/api/endpoint/isolate:
post:
summary: Permanently redirects to a new location
operationId: EndpointIsolateRedirect
x-codegen-enabled: true
x-labels:
- ess
requestBody:
required: true
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/BaseActionSchema'
responses:
'308':
description: Permanent Redirect
headers:
Location:
description: Permanently redirects to "/api/endpoint/action/isolate"
schema:
type: string
example: "/api/endpoint/action/isolate"
'200':
description: OK
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/SuccessResponse'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Actions List schema
operationId: EndpointGetActionsList
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Scan Action
operationId: EndpointScanAction
x-codegen-enabled: false
x-labels:
- ess
- serverless
requestBody:
required: true
content:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Endpoint Unisolate Schema
* version: 2023-10-31
*/

import type { z } from 'zod';

import { BaseActionSchema, SuccessResponse } from '../model/schema/common.gen';

export type EndpointUnisolateRedirectRequestBody = z.infer<
typeof EndpointUnisolateRedirectRequestBody
>;
export const EndpointUnisolateRedirectRequestBody = BaseActionSchema;
export type EndpointUnisolateRedirectRequestBodyInput = z.input<
typeof EndpointUnisolateRedirectRequestBody
>;

export type EndpointUnisolateRedirectResponse = z.infer<typeof EndpointUnisolateRedirectResponse>;
export const EndpointUnisolateRedirectResponse = SuccessResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
openapi: 3.0.0
info:
title: Endpoint Unisolate Schema
version: '2023-10-31'
paths:
/api/endpoint/unisolate:
post:
summary: Permanently redirects to a new location
operationId: EndpointUnisolateRedirect
x-codegen-enabled: true
x-labels:
- ess
requestBody:
required: true
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/BaseActionSchema'
responses:
'308':
description: Permanent Redirect
headers:
Location:
description: Permanently redirects to "/api/endpoint/action/unisolate"
schema:
type: string
example: "/api/endpoint/action/unisolate"
'200':
description: OK
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/SuccessResponse'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Metadata List schema
operationId: GetEndpointMetadataList
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand All @@ -27,6 +30,9 @@ paths:
summary: Get Metadata Transform schema
operationId: GetEndpointMetadataTransform
x-codegen-enabled: false
x-labels:
- ess
- serverless
responses:
'200':
description: OK
Expand All @@ -40,6 +46,9 @@ paths:
summary: Get Metadata schema
operationId: GetEndpointMetadata
x-codegen-enabled: false
x-labels:
- ess
- serverless
parameters:
- name: query
in: path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,10 @@ export const ProcessActionSchemas = BaseActionSchema.merge(
})
);

export type ProtectionUpdatesNoteResponse = z.infer<typeof ProtectionUpdatesNoteResponse>;
export const ProtectionUpdatesNoteResponse = z.object({
note: z.string().optional(),
});

export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ components:
entity_id:
type: string
minLength: 1

ProtectionUpdatesNoteResponse:
type: object
properties:
note:
type: string

SuccessResponse:
type: object
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
summary: Get Agent Policy Summary schema
operationId: GetAgentPolicySummary
x-codegen-enabled: true
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand All @@ -34,6 +37,9 @@ paths:
summary: Get Policy Response schema
operationId: GetPolicyResponse
x-codegen-enabled: true
x-labels:
- ess
- serverless
parameters:
- name: query
in: query
Expand Down
Loading

0 comments on commit 68d5370

Please sign in to comment.