[EDR Workflows] Include Osquery openApi schemas in codegen (#170389)

This commit is contained in:
Tomasz Ciecierski 2023-11-03 16:39:05 +01:00 committed by GitHub
parent fdec4bf474
commit f7393c5480
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 800 additions and 2 deletions

View file

@ -24,4 +24,5 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/steps/checks/saved_objects_compat_changes.sh
.buildkite/scripts/steps/checks/saved_objects_definition_change.sh
.buildkite/scripts/steps/code_generation/security_solution_codegen.sh
.buildkite/scripts/steps/code_generation/osquery_codegen.sh
.buildkite/scripts/steps/checks/yarn_deduplicate.sh

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/common/util.sh
echo --- Osquery OpenAPI Code Generation
(cd x-pack/plugins/osquery && yarn openapi:generate)
check_for_changed_files "yarn openapi:generate" true

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type AssetsRequestQuery = z.infer<typeof AssetsRequestQuery>;
export const AssetsRequestQuery = z.object({});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type GetAgentDetailsRequestParams = z.infer<typeof GetAgentDetailsRequestParams>;
export const GetAgentDetailsRequestParams = z.object({});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type GetAgentPoliciesRequestParams = z.infer<typeof GetAgentPoliciesRequestParams>;
export const GetAgentPoliciesRequestParams = z.object({});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { Id } from '../model/schema/common_attributes.gen';
export type GetAgentPolicyRequestParams = z.infer<typeof GetAgentPolicyRequestParams>;
export const GetAgentPolicyRequestParams = z.object({
id: Id.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,27 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { KueryOrUndefined, Id } from '../model/schema/common_attributes.gen';
export type GetAgentStatusRequestParams = z.infer<typeof GetAgentStatusRequestParams>;
export const GetAgentStatusRequestParams = z.object({});
export type GetAgentStatusRequestQueryParams = z.infer<typeof GetAgentStatusRequestQueryParams>;
export const GetAgentStatusRequestQueryParams = z.object({
kuery: KueryOrUndefined.optional(),
policyId: Id.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type GetAgentsRequestParams = z.infer<typeof GetAgentsRequestParams>;
export const GetAgentsRequestParams = z.object({});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type GetPackagePoliciesRequestParams = z.infer<typeof GetPackagePoliciesRequestParams>;
export const GetPackagePoliciesRequestParams = z.object({});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,41 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
QueryOrUndefined,
ArrayQueries,
SavedQueryIdOrUndefined,
ECSMappingOrUndefined,
PackIdOrUndefined,
} from '../model/schema/common_attributes.gen';
export type CreateLiveQueryRequestBody = z.infer<typeof CreateLiveQueryRequestBody>;
export const CreateLiveQueryRequestBody = z.object({
agent_ids: z.array(z.string()).optional(),
agent_all: z.boolean().optional(),
agent_platforms: z.array(z.string()).optional(),
agent_policy_ids: z.array(z.string()).optional(),
query: QueryOrUndefined.optional(),
queries: ArrayQueries.optional(),
saved_query_id: SavedQueryIdOrUndefined.optional(),
ecs_mapping: ECSMappingOrUndefined.optional(),
pack_id: PackIdOrUndefined.optional(),
alert_ids: z.array(z.string()).optional(),
case_ids: z.array(z.string()).optional(),
event_ids: z.array(z.string()).optional(),
metadata: z.object({}).nullable().optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,33 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
KueryOrUndefined,
PageOrUndefined,
PageSizeOrUndefined,
SortOrUndefined,
SortOrderOrUndefined,
} from '../model/schema/common_attributes.gen';
export type FindLiveQueryRequestQuery = z.infer<typeof FindLiveQueryRequestQuery>;
export const FindLiveQueryRequestQuery = z.object({
kuery: KueryOrUndefined.optional(),
page: PageOrUndefined.optional(),
pageSize: PageSizeOrUndefined.optional(),
sort: SortOrUndefined.optional(),
sortOrder: SortOrderOrUndefined.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,16 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,40 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
KueryOrUndefined,
PageOrUndefined,
PageSizeOrUndefined,
SortOrUndefined,
SortOrderOrUndefined,
Id,
} from '../model/schema/common_attributes.gen';
export type GetLiveQueryResultsRequestQuery = z.infer<typeof GetLiveQueryResultsRequestQuery>;
export const GetLiveQueryResultsRequestQuery = z.object({
kuery: KueryOrUndefined.optional(),
page: PageOrUndefined.optional(),
pageSize: PageSizeOrUndefined.optional(),
sort: SortOrUndefined.optional(),
sortOrder: SortOrderOrUndefined.optional(),
});
export type GetLiveQueryResultsRequestParams = z.infer<typeof GetLiveQueryResultsRequestParams>;
export const GetLiveQueryResultsRequestParams = z.object({
id: Id.optional(),
actionId: Id.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,176 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
export type Id = z.infer<typeof Id>;
export const Id = z.string();
export type IdOrUndefined = z.infer<typeof IdOrUndefined>;
export const IdOrUndefined = Id.nullable();
export type AgentSelection = z.infer<typeof AgentSelection>;
export const AgentSelection = z.object({
agents: z.array(z.string()).optional(),
allAgentsSelected: z.boolean().optional(),
platformsSelected: z.array(z.string()).optional(),
policiesSelected: z.array(z.string()).optional(),
});
export type AgentSelectionOrUndefined = z.infer<typeof AgentSelectionOrUndefined>;
export const AgentSelectionOrUndefined = AgentSelection.nullable();
export type Description = z.infer<typeof Description>;
export const Description = z.string();
export type DescriptionOrUndefined = z.infer<typeof DescriptionOrUndefined>;
export const DescriptionOrUndefined = Description.nullable();
export type Platform = z.infer<typeof Platform>;
export const Platform = z.string();
export type PlatformOrUndefined = z.infer<typeof PlatformOrUndefined>;
export const PlatformOrUndefined = Platform.nullable();
export type Query = z.infer<typeof Query>;
export const Query = z.string();
export type QueryOrUndefined = z.infer<typeof QueryOrUndefined>;
export const QueryOrUndefined = Query.nullable();
export type Version = z.infer<typeof Version>;
export const Version = z.string();
export type VersionOrUndefined = z.infer<typeof VersionOrUndefined>;
export const VersionOrUndefined = Version.nullable();
export type Interval = z.infer<typeof Interval>;
export const Interval = z.string();
export type IntervalOrUndefined = z.infer<typeof IntervalOrUndefined>;
export const IntervalOrUndefined = Interval.nullable();
export type Snapshot = z.infer<typeof Snapshot>;
export const Snapshot = z.boolean();
export type SnapshotOrUndefined = z.infer<typeof SnapshotOrUndefined>;
export const SnapshotOrUndefined = Snapshot.nullable();
export type Removed = z.infer<typeof Removed>;
export const Removed = z.boolean();
export type RemovedOrUndefined = z.infer<typeof RemovedOrUndefined>;
export const RemovedOrUndefined = Removed.nullable();
export type PackName = z.infer<typeof PackName>;
export const PackName = z.string();
export type SavedQueryId = z.infer<typeof SavedQueryId>;
export const SavedQueryId = z.string();
export type SavedQueryIdOrUndefined = z.infer<typeof SavedQueryIdOrUndefined>;
export const SavedQueryIdOrUndefined = SavedQueryId.nullable();
export type PackId = z.infer<typeof PackId>;
export const PackId = z.string();
export type PackIdOrUndefined = z.infer<typeof PackIdOrUndefined>;
export const PackIdOrUndefined = PackId.nullable();
export type Enabled = z.infer<typeof Enabled>;
export const Enabled = z.boolean();
export type EnabledOrUndefined = z.infer<typeof EnabledOrUndefined>;
export const EnabledOrUndefined = Enabled.nullable();
export type PolicyIds = z.infer<typeof PolicyIds>;
export const PolicyIds = z.array(z.string());
export type PolicyIdsOrUndefined = z.infer<typeof PolicyIdsOrUndefined>;
export const PolicyIdsOrUndefined = PolicyIds.nullable();
export type ExecutionContext = z.infer<typeof ExecutionContext>;
export const ExecutionContext = z.object({
name: z.string().nullable().optional(),
url: z.string().nullable().optional(),
});
export type ExecutionContextOrUndefined = z.infer<typeof ExecutionContextOrUndefined>;
export const ExecutionContextOrUndefined = ExecutionContext.nullable();
export type ECSMappingItem = z.infer<typeof ECSMappingItem>;
export const ECSMappingItem = z.object({
field: z.string().optional(),
value: z.union([z.string(), z.array(z.string())]).optional(),
});
export type ECSMapping = z.infer<typeof ECSMapping>;
export const ECSMapping = z.object({}).catchall(ECSMappingItem);
export type ECSMappingOrUndefined = z.infer<typeof ECSMappingOrUndefined>;
export const ECSMappingOrUndefined = ECSMapping.nullable();
export type StringArrayOrUndefined = z.infer<typeof StringArrayOrUndefined>;
export const StringArrayOrUndefined = z.array(z.string().nullable());
export type ArrayQueriesItem = z.infer<typeof ArrayQueriesItem>;
export const ArrayQueriesItem = z.object({
id: Id.optional(),
query: Query.optional(),
ecs_mapping: ECSMappingOrUndefined.optional(),
version: VersionOrUndefined.optional(),
platform: PlatformOrUndefined.optional(),
removed: RemovedOrUndefined.optional(),
snapshot: SnapshotOrUndefined.optional(),
});
export type ArrayQueries = z.infer<typeof ArrayQueries>;
export const ArrayQueries = z.array(ArrayQueriesItem);
export type ObjectQueriesItem = z.infer<typeof ObjectQueriesItem>;
export const ObjectQueriesItem = z.object({
query: Query.optional(),
id: Id.optional(),
ecs_mapping: ECSMappingOrUndefined.optional(),
version: VersionOrUndefined.optional(),
platform: PlatformOrUndefined.optional(),
saved_query_id: SavedQueryIdOrUndefined.optional(),
removed: RemovedOrUndefined.optional(),
snapshot: SnapshotOrUndefined.optional(),
});
export type ObjectQueries = z.infer<typeof ObjectQueries>;
export const ObjectQueries = z.object({}).catchall(ObjectQueriesItem);
export type Queries = z.infer<typeof Queries>;
export const Queries = z.union([ArrayQueries, ObjectQueries]);
export type QueriesOrUndefined = z.infer<typeof QueriesOrUndefined>;
export const QueriesOrUndefined = Queries.nullable();
export type KueryOrUndefined = z.infer<typeof KueryOrUndefined>;
export const KueryOrUndefined = z.string().nullable();
export type PageOrUndefined = z.infer<typeof PageOrUndefined>;
export const PageOrUndefined = z.number().int().nullable();
export type PageSizeOrUndefined = z.infer<typeof PageSizeOrUndefined>;
export const PageSizeOrUndefined = z.number().int().nullable();
export type SortOrUndefined = z.infer<typeof SortOrUndefined>;
export const SortOrUndefined = z.string().nullable();
export type SortOrderOrUndefined = z.infer<typeof SortOrderOrUndefined>;
export const SortOrderOrUndefined = z.union([z.string().nullable(), z.unknown()]);
export type Shards = z.infer<typeof Shards>;
export const Shards = z.object({}).catchall(z.number());

View file

@ -0,0 +1,35 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
PackName,
DescriptionOrUndefined,
EnabledOrUndefined,
PolicyIdsOrUndefined,
Shards,
ObjectQueries,
} from '../model/schema/common_attributes.gen';
export type CreatePacksRequestBody = z.infer<typeof CreatePacksRequestBody>;
export const CreatePacksRequestBody = z.object({
name: PackName.optional(),
description: DescriptionOrUndefined.optional(),
enabled: EnabledOrUndefined.optional(),
policy_ids: PolicyIdsOrUndefined.optional(),
shards: Shards.optional(),
queries: ObjectQueries.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { PackId } from '../model/schema/common_attributes.gen';
export type DeletePacksRequestQuery = z.infer<typeof DeletePacksRequestQuery>;
export const DeletePacksRequestQuery = z.object({
id: PackId.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,31 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
PageOrUndefined,
PageSizeOrUndefined,
SortOrUndefined,
SortOrderOrUndefined,
} from '../model/schema/common_attributes.gen';
export type FindPacksRequestQuery = z.infer<typeof FindPacksRequestQuery>;
export const FindPacksRequestQuery = z.object({
page: PageOrUndefined.optional(),
pageSize: PageSizeOrUndefined.optional(),
sort: SortOrUndefined.optional(),
sortOrder: SortOrderOrUndefined.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { PackId } from '../model/schema/common_attributes.gen';
export type ReadPacksRequestQuery = z.infer<typeof ReadPacksRequestQuery>;
export const ReadPacksRequestQuery = z.object({
id: PackId.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,40 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
PackId,
DescriptionOrUndefined,
EnabledOrUndefined,
PolicyIdsOrUndefined,
Shards,
ObjectQueries,
} from '../model/schema/common_attributes.gen';
export type UpdatePacksRequestParams = z.infer<typeof UpdatePacksRequestParams>;
export const UpdatePacksRequestParams = z.object({
id: PackId.optional(),
});
export type UpdatePacksRequestBody = z.infer<typeof UpdatePacksRequestBody>;
export const UpdatePacksRequestBody = z.object({
id: PackId.optional(),
description: DescriptionOrUndefined.optional(),
enabled: EnabledOrUndefined.optional(),
policy_ids: PolicyIdsOrUndefined.optional(),
shards: Shards.optional(),
queries: ObjectQueries.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,40 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
SavedQueryId,
DescriptionOrUndefined,
QueryOrUndefined,
ECSMappingOrUndefined,
VersionOrUndefined,
Interval,
SnapshotOrUndefined,
RemovedOrUndefined,
} from '../model/schema/common_attributes.gen';
export type CreateSavedQueryRequestBody = z.infer<typeof CreateSavedQueryRequestBody>;
export const CreateSavedQueryRequestBody = z.object({
id: SavedQueryId.optional(),
description: DescriptionOrUndefined.optional(),
query: QueryOrUndefined.optional(),
ecs_mapping: ECSMappingOrUndefined.optional(),
version: VersionOrUndefined.optional(),
platform: DescriptionOrUndefined.optional(),
interval: Interval.optional(),
snapshot: SnapshotOrUndefined.optional(),
removed: RemovedOrUndefined.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { SavedQueryId } from '../model/schema/common_attributes.gen';
export type DeleteSavedQueryRequestQuery = z.infer<typeof DeleteSavedQueryRequestQuery>;
export const DeleteSavedQueryRequestQuery = z.object({
id: SavedQueryId.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,31 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
PageOrUndefined,
PageSizeOrUndefined,
SortOrUndefined,
SortOrderOrUndefined,
} from '../model/schema/common_attributes.gen';
export type FindSavedQueryRequestQuery = z.infer<typeof FindSavedQueryRequestQuery>;
export const FindSavedQueryRequestQuery = z.object({
page: PageOrUndefined.optional(),
pageSize: PageSizeOrUndefined.optional(),
sort: SortOrUndefined.optional(),
sortOrder: SortOrderOrUndefined.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,23 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import { SavedQueryId } from '../model/schema/common_attributes.gen';
export type ReadSavedQueryRequestQuery = z.infer<typeof ReadSavedQueryRequestQuery>;
export const ReadSavedQueryRequestQuery = z.object({
id: SavedQueryId.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -0,0 +1,45 @@
/*
* 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.
*/
import { z } from 'zod';
/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/
import {
SavedQueryId,
DescriptionOrUndefined,
QueryOrUndefined,
ECSMappingOrUndefined,
VersionOrUndefined,
IntervalOrUndefined,
SnapshotOrUndefined,
RemovedOrUndefined,
} from '../model/schema/common_attributes.gen';
export type UpdateSavedQueryRequestParams = z.infer<typeof UpdateSavedQueryRequestParams>;
export const UpdateSavedQueryRequestParams = z.object({
id: SavedQueryId.optional(),
});
export type UpdateSavedQueryRequestBody = z.infer<typeof UpdateSavedQueryRequestBody>;
export const UpdateSavedQueryRequestBody = z.object({
id: SavedQueryId.optional(),
description: DescriptionOrUndefined.optional(),
query: QueryOrUndefined.optional(),
ecs_mapping: ECSMappingOrUndefined.optional(),
version: VersionOrUndefined.optional(),
platform: DescriptionOrUndefined.optional(),
interval: IntervalOrUndefined.optional(),
snapshot: SnapshotOrUndefined.optional(),
removed: RemovedOrUndefined.optional(),
});
export type SuccessResponse = z.infer<typeof SuccessResponse>;
export const SuccessResponse = z.object({});

View file

@ -15,6 +15,7 @@
"cypress:serverless:run": "yarn cypress:serverless run",
"nyc": "../../../node_modules/.bin/nyc report --reporter=text-summary",
"junit:merge": "../../../node_modules/.bin/mochawesome-merge ../../../target/kibana-osquery/cypress/results/mochawesome*.json > ../../../target/kibana-osquery/cypress/results/output.json && ../../../node_modules/.bin/marge ../../../target/kibana-osquery/cypress/results/output.json --reportDir ../../../target/kibana-osquery/cypress/results && yarn junit:transform && mkdir -p ../../../target/junit && cp ../../../target/kibana-osquery/cypress/results/*.xml ../../../target/junit/",
"junit:transform": "node ../security_solution/scripts/junit_transformer --pathPattern '../../../target/kibana-osquery/cypress/results/*.xml' --rootDirectory ../../../ --reportName 'Osquery Cypress' --writeInPlace"
"junit:transform": "node ../security_solution/scripts/junit_transformer --pathPattern '../../../target/kibana-osquery/cypress/results/*.xml' --rootDirectory ../../../ --reportName 'Osquery Cypress' --writeInPlace",
"openapi:generate": "node scripts/openapi/generate"
}
}

View file

@ -0,0 +1,20 @@
/*
* 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.
*/
require('../../../../../src/setup_node_env');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { generate } = require('@kbn/openapi-generator');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { resolve } = require('path');
const OSQUERY_ROOT = resolve(__dirname, '../..');
generate({
rootDir: OSQUERY_ROOT,
sourceGlob: './**/*.schema.yaml',
templateName: 'zod_operation_schema',
});

View file

@ -73,6 +73,7 @@
"@kbn/core-saved-objects-server",
"@kbn/monaco",
"@kbn/io-ts-utils",
"@kbn/shared-ux-page-kibana-template"
"@kbn/shared-ux-page-kibana-template",
"@kbn/openapi-generator"
]
}