mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[8.x] [ES `body` removal] `@elastic/kibana-cloud-security-posture` (#204860) (#205110)
# Backport This will backport the following commits from `main` to `8.x`: - [[ES `body` removal] `@elastic/kibana-cloud-security-posture` (#204860)](https://github.com/elastic/kibana/pull/204860) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Alejandro Fernández Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2024-12-23T16:24:51Z","message":"[ES `body` removal] `@elastic/kibana-cloud-security-posture` (#204860)","sha":"795cf28f0b27509adb58037e958208fd39707a97","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor"],"title":"[ES `body` removal] `@elastic/kibana-cloud-security-posture`","number":204860,"url":"https://github.com/elastic/kibana/pull/204860","mergeCommit":{"message":"[ES `body` removal] `@elastic/kibana-cloud-security-posture` (#204860)","sha":"795cf28f0b27509adb58037e958208fd39707a97"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204860","number":204860,"mergeCommit":{"message":"[ES `body` removal] `@elastic/kibana-cloud-security-posture` (#204860)","sha":"795cf28f0b27509adb58037e958208fd39707a97"}}]}] BACKPORT--> Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
This commit is contained in:
parent
eda8fc8aab
commit
ccf8bcb420
18 changed files with 34 additions and 27 deletions
|
@ -8,7 +8,7 @@
|
|||
import { EuiBadge, EuiIcon, EuiTextColor } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
import { css } from '@emotion/react';
|
||||
import { float } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { float } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { VulnSeverity } from '@kbn/cloud-security-posture-common';
|
||||
import { getCvsScoreColor, getSeverityStatusColor } from '../utils/get_vulnerability_colors';
|
||||
|
||||
|
|
|
@ -37,8 +37,11 @@ export const useMisconfigurationFindings = (options: UseCspOptions) => {
|
|||
rawResponse: { hits, aggregations },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
params: buildMisconfigurationsFindingsQuery(options, rulesStates!),
|
||||
params: buildMisconfigurationsFindingsQuery(
|
||||
options,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
rulesStates!
|
||||
) as LatestFindingsRequest['params'],
|
||||
})
|
||||
);
|
||||
if (!aggregations && options.ignore_unavailable === false)
|
||||
|
|
|
@ -35,8 +35,11 @@ export const useMisconfigurationPreview = (options: UseCspOptions) => {
|
|||
rawResponse: { aggregations },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
params: buildMisconfigurationsFindingsQuery(options, rulesStates!),
|
||||
params: buildMisconfigurationsFindingsQuery(
|
||||
options,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
rulesStates!
|
||||
) as LatestFindingsRequest['params'],
|
||||
})
|
||||
);
|
||||
if (!aggregations && options.ignore_unavailable === false)
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
SearchResponse,
|
||||
AggregationsMultiBucketAggregateBase,
|
||||
AggregationsStringRareTermsBucketKeys,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
} from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
|
||||
|
@ -47,7 +47,7 @@ export const useVulnerabilitiesFindings = (options: UseCspOptions) => {
|
|||
rawResponse: { aggregations, hits },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
params: getVulnerabilitiesQuery(options, pageParam),
|
||||
params: getVulnerabilitiesQuery(options, pageParam) as LatestFindingsRequest['params'],
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
SearchResponse,
|
||||
AggregationsMultiBucketAggregateBase,
|
||||
AggregationsStringRareTermsBucketKeys,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
} from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
|
||||
|
@ -42,7 +42,7 @@ export const useVulnerabilitiesPreview = (options: UseCspOptions) => {
|
|||
rawResponse: { aggregations },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
params: getVulnerabilitiesQuery(options, true),
|
||||
params: getVulnerabilitiesQuery(options, true) as LatestFindingsRequest['params'],
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
|
|||
import { SharePluginStart } from '@kbn/share-plugin/public';
|
||||
import { SpacesPluginStart } from '@kbn/spaces-plugin/public';
|
||||
import { CspFinding } from '@kbn/cloud-security-posture-common';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';
|
||||
|
||||
import type { BoolQuery } from '@kbn/es-query';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
|
||||
import {
|
||||
AggregationBuckets,
|
||||
getVulnerabilitiesAggregationCount,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
|
||||
import {
|
||||
buildMutedRulesFilter,
|
||||
CDR_MISCONFIGURATIONS_INDEX_PATTERN,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';
|
||||
|
||||
export const getPackagePolicyIdRuntimeMapping = (): MappingRuntimeFields => ({
|
||||
package_policy_identifier: {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { IKibanaSearchResponse } from '@kbn/search-types';
|
||||
import { GenericBuckets, GroupingQuery, RootAggregation } from '@kbn/grouping/src';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { useInfiniteQuery } from '@tanstack/react-query';
|
|||
import { number } from 'io-ts';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
|
||||
import { buildDataTableRecord } from '@kbn/discover-utils';
|
||||
import { EsHitRecord } from '@kbn/discover-utils/types';
|
||||
import { showErrorToast } from '@kbn/cloud-security-posture';
|
||||
|
@ -150,7 +150,11 @@ export const useLatestFindings = (options: UseFindingsOptions) => {
|
|||
rawResponse: { hits, aggregations },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
params: getFindingsQuery(options, rulesStates!, pageParam), // ruleStates always exists since it under the `enabled` dependency.
|
||||
params: getFindingsQuery(
|
||||
options,
|
||||
rulesStates!,
|
||||
pageParam
|
||||
) as LatestFindingsRequest['params'], // ruleStates always exists since it under the `enabled` dependency.
|
||||
})
|
||||
);
|
||||
if (!aggregations) throw new Error('expected aggregations to be an defined');
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { IKibanaSearchResponse } from '@kbn/search-types';
|
||||
import { GenericBuckets, GroupingQuery, RootAggregation } from '@kbn/grouping/src';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
SearchResponse,
|
||||
AggregationsMultiBucketAggregateBase,
|
||||
AggregationsStringRareTermsBucketKeys,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
} from '@elastic/elasticsearch/lib/api/types';
|
||||
import { buildDataTableRecord } from '@kbn/discover-utils';
|
||||
import { EsHitRecord } from '@kbn/discover-utils/types';
|
||||
import {
|
||||
|
@ -118,7 +118,7 @@ export const useLatestVulnerabilities = (options: VulnerabilitiesQuery) => {
|
|||
rawResponse: { hits },
|
||||
} = await lastValueFrom(
|
||||
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
|
||||
params: getVulnerabilitiesQuery(options, pageParam),
|
||||
params: getVulnerabilitiesQuery(options, pageParam) as LatestFindingsRequest['params'],
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
IndicesIndexTemplateSummary,
|
||||
Metadata,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { IndicesIndexTemplateSummary, Metadata } from '@elastic/elasticsearch/lib/api/types';
|
||||
|
||||
export interface LatestIndexConfig {
|
||||
findings: IndexConfig;
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
SavedObjectsClientContract,
|
||||
} from '@kbn/core-saved-objects-api-server';
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { buildMutedRulesFilter } from '@kbn/cloud-security-posture-common';
|
||||
import type { CspBenchmarkRulesStates } from '@kbn/cloud-security-posture-common/schema/rules/latest';
|
||||
import type { CspSettings } from '@kbn/cloud-security-posture-common/schema/rules/v4';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
||||
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { ElasticsearchClient, Logger } from '@kbn/core/server';
|
||||
import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
|
||||
import type { CspBenchmarkRule } from '@kbn/cloud-security-posture-common/schema/rules/latest';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { transformError } from '@kbn/securitysolution-es-utils';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { ElasticsearchClient } from '@kbn/core/server';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue