Skip to content

Commit

Permalink
[CI] Auto-commit changed files from 'yarn openapi:generate'
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Sep 26, 2024
1 parent e48a0b4 commit cae1206
Showing 1 changed file with 97 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,43 +51,54 @@ import {
} from '@kbn/osquery-plugin/common/api/saved_query/saved_query.gen';
import { ReadAssetsStatusRequestQueryInput } from '@kbn/osquery-plugin/common/api/asset/assets.gen';
import { UpdateAssetsStatusRequestQueryInput } from '@kbn/osquery-plugin/common/api/asset/assets.gen';
import { routeWithNamespace } from '../../common/utils/security_solution';
import { FtrProviderContext } from '../ftr_provider_context';

export function SecuritySolutionApiProvider({ getService }: FtrProviderContext) {
const supertest = getService('supertest');

return {
getAgentDetails(props: GetAgentDetailsProps) {
getAgentDetails(props: GetAgentDetailsProps, kibanaSpace: string = 'default') {
return supertest
.get(replaceParams('/internal/osquery/fleet_wrapper/agents/{id}', props.params))
.get(
routeWithNamespace(
replaceParams('/internal/osquery/fleet_wrapper/agents/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getAgentPackagePolicies() {
getAgentPackagePolicies(kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/fleet_wrapper/package_policies')
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/package_policies', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getAgentPolicies() {
getAgentPolicies(kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/fleet_wrapper/agent_policies')
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/agent_policies', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getAgentPolicy(props: GetAgentPolicyProps) {
getAgentPolicy(props: GetAgentPolicyProps, kibanaSpace: string = 'default') {
return supertest
.get(replaceParams('/internal/osquery/fleet_wrapper/agent_policies/{id}', props.params))
.get(
routeWithNamespace(
replaceParams('/internal/osquery/fleet_wrapper/agent_policies/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getAgents(props: GetAgentsProps) {
getAgents(props: GetAgentsProps, kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/fleet_wrapper/agents')
.get(routeWithNamespace('/internal/osquery/fleet_wrapper/agents', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -96,9 +107,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Create and run a live query.
*/
osqueryCreateLiveQuery(props: OsqueryCreateLiveQueryProps) {
osqueryCreateLiveQuery(props: OsqueryCreateLiveQueryProps, kibanaSpace: string = 'default') {
return supertest
.post('/api/osquery/live_queries')
.post(routeWithNamespace('/api/osquery/live_queries', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -107,9 +118,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Create a query pack.
*/
osqueryCreatePacks(props: OsqueryCreatePacksProps) {
osqueryCreatePacks(props: OsqueryCreatePacksProps, kibanaSpace: string = 'default') {
return supertest
.post('/api/osquery/packs')
.post(routeWithNamespace('/api/osquery/packs', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -118,9 +129,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Create and run a saved query.
*/
osqueryCreateSavedQuery(props: OsqueryCreateSavedQueryProps) {
osqueryCreateSavedQuery(props: OsqueryCreateSavedQueryProps, kibanaSpace: string = 'default') {
return supertest
.post('/api/osquery/saved_queries')
.post(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -129,29 +140,36 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Delete a query pack using the pack ID.
*/
osqueryDeletePacks(props: OsqueryDeletePacksProps) {
osqueryDeletePacks(props: OsqueryDeletePacksProps, kibanaSpace: string = 'default') {
return supertest
.delete(replaceParams('/api/osquery/packs/{id}', props.params))
.delete(
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
/**
* Delete a saved query using the query ID.
*/
osqueryDeleteSavedQuery(props: OsqueryDeleteSavedQueryProps) {
osqueryDeleteSavedQuery(props: OsqueryDeleteSavedQueryProps, kibanaSpace: string = 'default') {
return supertest
.delete(replaceParams('/api/osquery/saved_queries/{id}', props.params))
.delete(
routeWithNamespace(
replaceParams('/api/osquery/saved_queries/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
/**
* Get a list of all live queries.
*/
osqueryFindLiveQueries(props: OsqueryFindLiveQueriesProps) {
osqueryFindLiveQueries(props: OsqueryFindLiveQueriesProps, kibanaSpace: string = 'default') {
return supertest
.get('/api/osquery/live_queries')
.get(routeWithNamespace('/api/osquery/live_queries', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -160,9 +178,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Get a list of all query packs.
*/
osqueryFindPacks(props: OsqueryFindPacksProps) {
osqueryFindPacks(props: OsqueryFindPacksProps, kibanaSpace: string = 'default') {
return supertest
.get('/api/osquery/packs')
.get(routeWithNamespace('/api/osquery/packs', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -171,9 +189,9 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Get a list of all saved queries.
*/
osqueryFindSavedQueries(props: OsqueryFindSavedQueriesProps) {
osqueryFindSavedQueries(props: OsqueryFindSavedQueriesProps, kibanaSpace: string = 'default') {
return supertest
.get('/api/osquery/saved_queries')
.get(routeWithNamespace('/api/osquery/saved_queries', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -182,9 +200,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Get the details of a live query using the query ID.
*/
osqueryGetLiveQueryDetails(props: OsqueryGetLiveQueryDetailsProps) {
osqueryGetLiveQueryDetails(
props: OsqueryGetLiveQueryDetailsProps,
kibanaSpace: string = 'default'
) {
return supertest
.get(replaceParams('/api/osquery/live_queries/{id}', props.params))
.get(
routeWithNamespace(
replaceParams('/api/osquery/live_queries/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -193,9 +219,17 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Get the results of a live query using the query action ID.
*/
osqueryGetLiveQueryResults(props: OsqueryGetLiveQueryResultsProps) {
osqueryGetLiveQueryResults(
props: OsqueryGetLiveQueryResultsProps,
kibanaSpace: string = 'default'
) {
return supertest
.get(replaceParams('/api/osquery/live_queries/{id}/results/{actionId}', props.params))
.get(
routeWithNamespace(
replaceParams('/api/osquery/live_queries/{id}/results/{actionId}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -204,19 +238,29 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
/**
* Get the details of a query pack using the pack ID.
*/
osqueryGetPacksDetails(props: OsqueryGetPacksDetailsProps) {
osqueryGetPacksDetails(props: OsqueryGetPacksDetailsProps, kibanaSpace: string = 'default') {
return supertest
.get(replaceParams('/api/osquery/packs/{id}', props.params))
.get(
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
/**
* Get the details of a saved query using the query ID.
*/
osqueryGetSavedQueryDetails(props: OsqueryGetSavedQueryDetailsProps) {
osqueryGetSavedQueryDetails(
props: OsqueryGetSavedQueryDetailsProps,
kibanaSpace: string = 'default'
) {
return supertest
.get(replaceParams('/api/osquery/saved_queries/{id}', props.params))
.get(
routeWithNamespace(
replaceParams('/api/osquery/saved_queries/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
Expand All @@ -227,9 +271,11 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
> You cannot update a prebuilt pack.
*/
osqueryUpdatePacks(props: OsqueryUpdatePacksProps) {
osqueryUpdatePacks(props: OsqueryUpdatePacksProps, kibanaSpace: string = 'default') {
return supertest
.put(replaceParams('/api/osquery/packs/{id}', props.params))
.put(
routeWithNamespace(replaceParams('/api/osquery/packs/{id}', props.params), kibanaSpace)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand All @@ -241,39 +287,44 @@ export function SecuritySolutionApiProvider({ getService }: FtrProviderContext)
> You cannot update a prebuilt saved query.
*/
osqueryUpdateSavedQuery(props: OsqueryUpdateSavedQueryProps) {
osqueryUpdateSavedQuery(props: OsqueryUpdateSavedQueryProps, kibanaSpace: string = 'default') {
return supertest
.put(replaceParams('/api/osquery/saved_queries/{id}', props.params))
.put(
routeWithNamespace(
replaceParams('/api/osquery/saved_queries/{id}', props.params),
kibanaSpace
)
)
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.send(props.body as object);
},
readAssetsStatus(props: ReadAssetsStatusProps) {
readAssetsStatus(props: ReadAssetsStatusProps, kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/assets')
.get(routeWithNamespace('/internal/osquery/assets', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query);
},
readInstallationStatus() {
readInstallationStatus(kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/status')
.get(routeWithNamespace('/internal/osquery/status', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
readPrivilegesCheck() {
readPrivilegesCheck(kibanaSpace: string = 'default') {
return supertest
.get('/internal/osquery/privileges_check')
.get(routeWithNamespace('/internal/osquery/privileges_check', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
updateAssetsStatus(props: UpdateAssetsStatusProps) {
updateAssetsStatus(props: UpdateAssetsStatusProps, kibanaSpace: string = 'default') {
return supertest
.post('/internal/osquery/assets/update')
.post(routeWithNamespace('/internal/osquery/assets/update', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '1')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
Expand Down

0 comments on commit cae1206

Please sign in to comment.