Skip to content

Commit

Permalink
[EDR Workflows] Include Osquery openApi schemas in codegen (#170389)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsonpl authored Nov 3, 2023
1 parent fdec4bf commit f7393c5
Show file tree
Hide file tree
Showing 27 changed files with 800 additions and 2 deletions.
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions .buildkite/scripts/steps/code_generation/osquery_codegen.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions x-pack/plugins/osquery/common/api/asset/assets_status.gen.ts
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
19 changes: 19 additions & 0 deletions x-pack/plugins/osquery/common/api/fleet_wrapper/get_agents.gen.ts
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Original file line number Diff line number Diff line change
@@ -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({});
Loading

0 comments on commit f7393c5

Please sign in to comment.