Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
szwarckonrad committed Jul 1, 2024
1 parent c7789a4 commit 4cb5c91
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 0 deletions.
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,31 @@
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
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
@@ -0,0 +1,31 @@
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: false
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 @@ -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
@@ -0,0 +1,57 @@
/*
* 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 Protection Updates Note Schema
* version: 2023-10-31
*/

import { z } from 'zod';

import { ProtectionUpdatesNoteResponse } from '../model/schema/common.gen';

export type CreateUpdateProtectionUpdatesNoteRequestParams = z.infer<
typeof CreateUpdateProtectionUpdatesNoteRequestParams
>;
export const CreateUpdateProtectionUpdatesNoteRequestParams = z.object({
package_policy_id: z.string(),
});
export type CreateUpdateProtectionUpdatesNoteRequestParamsInput = z.input<
typeof CreateUpdateProtectionUpdatesNoteRequestParams
>;

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

export type CreateUpdateProtectionUpdatesNoteResponse = z.infer<
typeof CreateUpdateProtectionUpdatesNoteResponse
>;
export const CreateUpdateProtectionUpdatesNoteResponse = ProtectionUpdatesNoteResponse;

export type GetProtectionUpdatesNoteRequestParams = z.infer<
typeof GetProtectionUpdatesNoteRequestParams
>;
export const GetProtectionUpdatesNoteRequestParams = z.object({
package_policy_id: z.string(),
});
export type GetProtectionUpdatesNoteRequestParamsInput = z.input<
typeof GetProtectionUpdatesNoteRequestParams
>;

export type GetProtectionUpdatesNoteResponse = z.infer<typeof GetProtectionUpdatesNoteResponse>;
export const GetProtectionUpdatesNoteResponse = ProtectionUpdatesNoteResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
openapi: 3.0.0
info:
title: Endpoint Protection Updates Note Schema
version: '2023-10-31'
paths:
/api/endpoint/protection_updates_note/{package_policy_id}:
get:
summary: Get Protection Updates Note schema
operationId: GetProtectionUpdatesNote
x-codegen-enabled: true
parameters:
- name: package_policy_id
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/ProtectionUpdatesNoteResponse'
post:
summary: Create Update Protection Updates Note schema
operationId: CreateUpdateProtectionUpdatesNote
x-codegen-enabled: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
note:
type: string
parameters:
- name: package_policy_id
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/ProtectionUpdatesNoteResponse'
43 changes: 43 additions & 0 deletions x-pack/test/api_integration/services/security_solution_api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import { BulkPatchRulesRequestBodyInput } from '@kbn/security-solution-plugin/co
import { BulkUpdateRulesRequestBodyInput } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management/bulk_crud/bulk_update_rules/bulk_update_rules_route.gen';
import { CreateAlertsMigrationRequestBodyInput } from '@kbn/security-solution-plugin/common/api/detection_engine/signals_migration/create_signals_migration/create_signals_migration.gen';
import { CreateRuleRequestBodyInput } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management/crud/create_rule/create_rule_route.gen';
import {
CreateUpdateProtectionUpdatesNoteRequestParamsInput,
CreateUpdateProtectionUpdatesNoteRequestBodyInput,
} from '@kbn/security-solution-plugin/common/api/endpoint/protection_updates_note/protection_updates_note.gen';
import { DeleteRuleRequestQueryInput } from '@kbn/security-solution-plugin/common/api/detection_engine/rule_management/crud/delete_rule/delete_rule_route.gen';
import { EndpointIsolateRedirectRequestBodyInput } from '@kbn/security-solution-plugin/common/api/endpoint/actions/isolate_route.gen';
import {
ExportRulesRequestQueryInput,
ExportRulesRequestBodyInput,
Expand All @@ -40,6 +45,7 @@ import {
GetEndpointSuggestionsRequestBodyInput,
} from '@kbn/security-solution-plugin/common/api/endpoint/suggestions/get_suggestions.gen';
import { GetPolicyResponseRequestQueryInput } from '@kbn/security-solution-plugin/common/api/endpoint/policy/policy.gen';
import { GetProtectionUpdatesNoteRequestParamsInput } from '@kbn/security-solution-plugin/common/api/endpoint/protection_updates_note/protection_updates_note.gen';
import {
GetRuleExecutionEventsRequestQueryInput,
GetRuleExecutionEventsRequestParamsInput,
Expand Down Expand Up @@ -153,6 +159,16 @@ after 30 days. It also deletes other artifacts specific to the migration impleme
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
createUpdateProtectionUpdatesNote(props: CreateUpdateProtectionUpdatesNoteProps) {
return supertest
.post(
replaceParams('/api/endpoint/protection_updates_note/{package_policy_id}', props.params)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
deleteAlertsIndex() {
return supertest
.delete('/api/detection_engine/index')
Expand All @@ -171,6 +187,14 @@ after 30 days. It also deletes other artifacts specific to the migration impleme
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query);
},
endpointIsolateRedirect(props: EndpointIsolateRedirectProps) {
return supertest
.post('/api/endpoint/isolate')
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
/**
* Exports rules to an `.ndjson` file. The following configuration items are also included in the `.ndjson` file - Actions, Exception lists. Prebuilt rules cannot be exported.
*/
Expand Down Expand Up @@ -254,6 +278,15 @@ finalize it.
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getProtectionUpdatesNote(props: GetProtectionUpdatesNoteProps) {
return supertest
.get(
replaceParams('/api/endpoint/protection_updates_note/{package_policy_id}', props.params)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getRuleExecutionEvents(props: GetRuleExecutionEventsProps) {
return supertest
.put(
Expand Down Expand Up @@ -414,9 +447,16 @@ export interface CreateAlertsMigrationProps {
export interface CreateRuleProps {
body: CreateRuleRequestBodyInput;
}
export interface CreateUpdateProtectionUpdatesNoteProps {
params: CreateUpdateProtectionUpdatesNoteRequestParamsInput;
body: CreateUpdateProtectionUpdatesNoteRequestBodyInput;
}
export interface DeleteRuleProps {
query: DeleteRuleRequestQueryInput;
}
export interface EndpointIsolateRedirectProps {
body: EndpointIsolateRedirectRequestBodyInput;
}
export interface ExportRulesProps {
query: ExportRulesRequestQueryInput;
body: ExportRulesRequestBodyInput;
Expand All @@ -440,6 +480,9 @@ export interface GetEndpointSuggestionsProps {
export interface GetPolicyResponseProps {
query: GetPolicyResponseRequestQueryInput;
}
export interface GetProtectionUpdatesNoteProps {
params: GetProtectionUpdatesNoteRequestParamsInput;
}
export interface GetRuleExecutionEventsProps {
query: GetRuleExecutionEventsRequestQueryInput;
params: GetRuleExecutionEventsRequestParamsInput;
Expand Down

0 comments on commit 4cb5c91

Please sign in to comment.