diff --git a/.buildkite/ftr_oblt_stateful_configs.yml b/.buildkite/ftr_oblt_stateful_configs.yml index 1a2797795828e..3211c35f29e7a 100644 --- a/.buildkite/ftr_oblt_stateful_configs.yml +++ b/.buildkite/ftr_oblt_stateful_configs.yml @@ -20,7 +20,7 @@ disabled: - x-pack/solutions/observability/plugins/synthetics/e2e/synthetics/synthetics_run.ts - x-pack/solutions/observability/plugins/exploratory_view/e2e/synthetics_run.ts - x-pack/solutions/observability/plugins/ux/e2e/synthetics_run.ts - - x-pack/plugins/observability_solution/slo/e2e/synthetics_run.ts + - x-pack/solutions/observability/plugins/slo/e2e/synthetics_run.ts defaultQueue: 'n2-4-spot' enabled: diff --git a/.buildkite/pipelines/pull_request/slo_plugin_e2e.yml b/.buildkite/pipelines/pull_request/slo_plugin_e2e.yml index 2cf1126cf1f5d..8e6ad5734d703 100644 --- a/.buildkite/pipelines/pull_request/slo_plugin_e2e.yml +++ b/.buildkite/pipelines/pull_request/slo_plugin_e2e.yml @@ -14,7 +14,7 @@ steps: - check_oas_snapshot timeout_in_minutes: 30 artifact_paths: - - 'x-pack/plugins/observability_solution/slo/e2e/.journeys/**/*' + - 'x-pack/solutions/observability/plugins/slo/e2e/.journeys/**/*' retry: automatic: - exit_status: '-1' diff --git a/.buildkite/scripts/steps/functional/slo_plugin_e2e.sh b/.buildkite/scripts/steps/functional/slo_plugin_e2e.sh index 0492e41ae7041..b9cdebe6e89ab 100755 --- a/.buildkite/scripts/steps/functional/slo_plugin_e2e.sh +++ b/.buildkite/scripts/steps/functional/slo_plugin_e2e.sh @@ -14,4 +14,4 @@ echo "--- SLO @elastic/synthetics Tests" cd "$XPACK_DIR" -node plugins/observability_solution/slo/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" ${GREP:+--grep \"${GREP}\"} +node solutions/observability/plugins/slo/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" ${GREP:+--grep \"${GREP}\"} diff --git a/.eslintrc.js b/.eslintrc.js index dd397193cf425..5d9ce3eb23277 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -764,7 +764,6 @@ module.exports = { ], }, }, - /** * Jest specific rules */ @@ -918,7 +917,7 @@ module.exports = { 'x-pack/solutions/observability/plugins/observability/**/*.{js,mjs,ts,tsx}', 'x-pack/solutions/observability/plugins/exploratory_view/**/*.{js,mjs,ts,tsx}', 'x-pack/solutions/observability/plugins/ux/**/*.{js,mjs,ts,tsx}', - 'x-pack/plugins/observability_solution/slo/**/*.{js,mjs,ts,tsx}', + 'x-pack/solutions/observability/plugins/slo/**/*.{js,mjs,ts,tsx}', 'x-pack/packages/observability/**/*.{js,mjs,ts,tsx}', ], rules: { @@ -938,7 +937,7 @@ module.exports = { 'x-pack/plugins/observability_solution/apm/**/*.stories.*', 'x-pack/solutions/observability/plugins/observability/**/*.stories.*', 'x-pack/solutions/observability/plugins/exploratory_view/**/*.stories.*', - 'x-pack/plugins/observability_solution/slo/**/*.stories.*', + 'x-pack/solutions/observability/plugins/slo/**/*.stories.*', 'x-pack/packages/observability/**/*.{js,mjs,ts,tsx}', ], rules: { diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8e2c49a2cd4a4..8bd1c228ccff2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,7 +5,6 @@ ## `node scripts/generate codeowners`. #### -examples/bfetch_explorer @elastic/appex-sharedux examples/content_management_examples @elastic/appex-sharedux examples/controls_example @elastic/kibana-presentation examples/data_view_field_editor_example @elastic/kibana-data-discovery @@ -337,6 +336,7 @@ packages/kbn-es-errors @elastic/kibana-core packages/kbn-es-query @elastic/kibana-data-discovery packages/kbn-es-types @elastic/kibana-core @elastic/obs-knowledge-team packages/kbn-eslint-config @elastic/kibana-operations +packages/kbn-eslint-plugin-css @elastic/appex-sharedux packages/kbn-eslint-plugin-disable @elastic/kibana-operations packages/kbn-eslint-plugin-eslint @elastic/kibana-operations packages/kbn-eslint-plugin-i18n @elastic/obs-knowledge-team @elastic/kibana-operations @@ -938,7 +938,6 @@ x-pack/plugins/observability_solution/observability_onboarding/e2e @elastic/obs- x-pack/plugins/observability_solution/observability_shared @elastic/observability-ui x-pack/plugins/observability_solution/profiling @elastic/obs-ux-infra_services-team x-pack/plugins/observability_solution/profiling_data_access @elastic/obs-ux-infra_services-team -x-pack/plugins/observability_solution/slo @elastic/obs-ux-management-team x-pack/plugins/reporting @elastic/appex-sharedux x-pack/plugins/rule_registry @elastic/response-ops @elastic/obs-ux-management-team x-pack/plugins/saved_objects_tagging @elastic/appex-sharedux @@ -981,6 +980,7 @@ x-pack/solutions/observability/plugins/observability_ai_assistant_management @el x-pack/solutions/observability/plugins/observability_solution/entities_data_access @elastic/obs-entities x-pack/solutions/observability/plugins/observability_solution/entity_manager_app @elastic/obs-entities x-pack/solutions/observability/plugins/serverless_observability @elastic/obs-ux-management-team +x-pack/solutions/observability/plugins/slo @elastic/obs-ux-management-team x-pack/solutions/observability/plugins/streams @elastic/streams-program-team x-pack/solutions/observability/plugins/streams_app @elastic/streams-program-team x-pack/solutions/observability/plugins/synthetics @elastic/obs-ux-management-team @@ -2616,7 +2616,6 @@ x-pack/plugins/observability_solution/observability_shared/public/components/pro /test/examples/state_sync/*.ts @elastic/appex-sharedux /test/examples/error_boundary/index.ts @elastic/appex-sharedux /test/examples/content_management/*.ts @elastic/appex-sharedux -/test/examples/bfetch_explorer/*.ts @elastic/appex-sharedux /test/api_integration/apis/guided_onboarding @elastic/appex-sharedux /x-pack/test/banners_functional @elastic/appex-sharedux /x-pack/test/custom_branding @elastic/appex-sharedux @@ -2873,6 +2872,7 @@ src/platform/packages/private/shared-ux/page/kibana_no_data/types @elastic/appex src/platform/packages/private/shared-ux/prompt/no_data_views/impl @elastic/appex-sharedux src/platform/packages/private/shared-ux/prompt/no_data_views/mocks @elastic/appex-sharedux src/platform/packages/private/shared-ux/table_persist @elastic/appex-sharedux +src/platform/packages/shared/chart_expressions/common @elastic/kibana-visualizations src/platform/packages/shared/cloud @elastic/kibana-core src/platform/packages/shared/content-management/content_editor @elastic/appex-sharedux src/platform/packages/shared/content-management/content_insights/content_insights_public @elastic/appex-sharedux @@ -3055,8 +3055,6 @@ src/platform/packages/shared/shared-ux/prompt/no_data_views/types @elastic/appex src/platform/packages/shared/shared-ux/prompt/not_found @elastic/appex-sharedux src/platform/packages/shared/shared-ux/router/impl @elastic/appex-sharedux src/platform/packages/shared/shared-ux/storybook/mock @elastic/appex-sharedux -src/platform/packages/shared/Users/gsoldevila/Work/kibana-secondary/Users/gsoldevila/Work/kibana-secondary/src/core @elastic/kibana-core -src/platform/packages/shared/Users/gsoldevila/Work/kibana-secondary/Users/gsoldevila/Work/kibana-secondary/src/plugins/chart_expressions/common @elastic/kibana-visualizations src/platform/plugins/private/advanced_settings @elastic/appex-sharedux @elastic/kibana-management src/platform/plugins/private/event_annotation @elastic/kibana-visualizations src/platform/plugins/private/event_annotation_listing @elastic/kibana-visualizations diff --git a/.github/paths-labeller.yml b/.github/paths-labeller.yml index 43e9445b5767b..bc67d3a6f6d93 100644 --- a/.github/paths-labeller.yml +++ b/.github/paths-labeller.yml @@ -20,7 +20,7 @@ - 'x-pack/test/fleet_api_integration/**/*.*' - 'Team:obs-ux-management': - 'x-pack/solutions/observability/plugins/observability/**/*.*' - - 'x-pack/plugins/observability_solution/slo/**/*.*' + - 'x-pack/solutions/observability/plugins/slo/**/*.*' - 'x-pack/solutions/observability/plugins/synthetics/**/*.*' - 'x-pack/solutions/observability/plugins/exploratory_view/**/*.*' - 'Team:Obs AI Assistant': diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index c417e7c5feabd..f088c340b9d82 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -894,7 +894,7 @@ This plugin is only enabled when the application is built for serverless project |Session View is meant to provide a visualization into what is going on in a particular Linux environment where the agent is running. It looks likes a terminal emulator; however, it is a tool for introspecting process activity and understanding user and service behaviour in your Linux servers and infrastructure. It is a time-ordered series of process executions displayed in a tree over time. -|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/slo/README.md[slo] +|{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/slo/README.md[slo] |A Kibana plugin diff --git a/docs/management/cases/setup-cases.asciidoc b/docs/management/cases/setup-cases.asciidoc index b15d3c884bf79..90c6bd29be561 100644 --- a/docs/management/cases/setup-cases.asciidoc +++ b/docs/management/cases/setup-cases.asciidoc @@ -24,7 +24,7 @@ The *{connectors-feature}* feature privilege is required to create, add, delete, and modify case connectors and to send updates to external systems. By default, `All` for the *Cases* feature includes authority to delete cases -and comments and edit case settings unless you customize the sub-feature privileges. +and comments, edit case settings, add case comments and attachments, and re-open cases unless you customize the sub-feature privileges. ==== | Give assignee access to cases @@ -41,7 +41,7 @@ This privilege is also required to add <> to rul | Give view-only access to cases a| `Read` for the *Cases* feature under *Management*. -NOTE: By default, `Read` for the *Cases* feature does not include authority to delete cases and comments or edit case settings. You can grant this authority by customizing the sub-feature privileges. +NOTE: You can customize sub-feature privileges for deleting cases and comments, editing case settings, adding case comments and attachments, and re-opening cases. | Revoke all access to cases | `None` for the *Cases* feature under *Management*. diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc index 51064981fab85..e6923d95fad7f 100644 --- a/docs/setup/settings.asciidoc +++ b/docs/setup/settings.asciidoc @@ -565,7 +565,9 @@ all http requests to https over the port configured as <>). . Select *Create space* and provide a name, description, and URL identifier. + diff --git a/examples/bfetch_explorer/README.md b/examples/bfetch_explorer/README.md deleted file mode 100644 index 33723e7cabe07..0000000000000 --- a/examples/bfetch_explorer/README.md +++ /dev/null @@ -1,11 +0,0 @@ -## bfetch explorer - -bfetch is a service that allows you to batch HTTP requests and stream responses -back. - -This example app demonstrates: - - How you can create a streaming response route and consume it from the - client - - How you can create a batch processing route and consume it from the client - -To run this example, use the command `yarn start --run-examples`. diff --git a/examples/bfetch_explorer/kibana.jsonc b/examples/bfetch_explorer/kibana.jsonc deleted file mode 100644 index dbcd5c3496355..0000000000000 --- a/examples/bfetch_explorer/kibana.jsonc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "plugin", - "id": "@kbn/bfetch-explorer-plugin", - "owner": "@elastic/appex-sharedux", - "plugin": { - "id": "bfetchExplorer", - "server": true, - "browser": true, - "requiredPlugins": [ - "bfetch", - "developerExamples" - ], - "requiredBundles": [ - "kibanaReact" - ] - } -} diff --git a/examples/bfetch_explorer/public/components/count_until/index.tsx b/examples/bfetch_explorer/public/components/count_until/index.tsx deleted file mode 100644 index 3708fcc78193e..0000000000000 --- a/examples/bfetch_explorer/public/components/count_until/index.tsx +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { useState } from 'react'; -import useMountedState from 'react-use/lib/useMountedState'; -import useList from 'react-use/lib/useList'; -import { EuiForm, EuiSpacer, EuiFieldNumber, EuiFormRow, EuiButton } from '@elastic/eui'; -import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; - -export interface Props { - fetchStreaming: BfetchPublicSetup['fetchStreaming']; -} - -export const CountUntil: React.FC = ({ fetchStreaming }) => { - const isMounted = useMountedState(); - const [data, setData] = useState(5); - const [showingResults, setShowingResults] = useState(false); - const [results, { push: pushResult, clear: clearList }] = useList([]); - const [completed, setCompleted] = useState(false); - const [error, setError] = useState(null); - - const handleSubmit = () => { - setShowingResults(true); - const { stream } = fetchStreaming({ - url: '/bfetch_explorer/count', - body: JSON.stringify({ data }), - }); - stream.subscribe({ - next: (next: string) => { - if (!isMounted()) return; - pushResult(next); - }, - error: (nextError: any) => { - if (!isMounted()) return; - setError(nextError); - }, - complete: () => { - if (!isMounted()) return; - setCompleted(true); - }, - }); - }; - - const handleReset = () => { - setShowingResults(false); - clearList(); - setError(null); - setCompleted(false); - }; - - if (showingResults) { - return ( - -
{JSON.stringify(error || results, null, 4)}
- - - Reset - -
- ); - } - - return ( - - - setData(Number(e.target.value))} - /> - - - Start - - - ); -}; diff --git a/examples/bfetch_explorer/public/components/double_integers/index.tsx b/examples/bfetch_explorer/public/components/double_integers/index.tsx deleted file mode 100644 index cf71bde62f09e..0000000000000 --- a/examples/bfetch_explorer/public/components/double_integers/index.tsx +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { useState } from 'react'; -import useMountedState from 'react-use/lib/useMountedState'; -import useList from 'react-use/lib/useList'; -import useCounter from 'react-use/lib/useCounter'; -import { EuiForm, EuiSpacer, EuiTextArea, EuiFormRow, EuiButton } from '@elastic/eui'; -import { ExplorerService } from '../../plugin'; - -interface ResultItem { - num: number; - result?: { - num: number; - }; - error?: any; -} - -const defaultNumbers = [2000, 300, -1, 1000].join('\n'); - -export interface Props { - double: ExplorerService['double']; -} - -export const DoubleIntegers: React.FC = ({ double }) => { - const isMounted = useMountedState(); - const [numbers, setNumbers] = useState(defaultNumbers); - const [showingResults, setShowingResults] = useState(false); - const [numberOfResultsAwaiting, counter] = useCounter(0); - const [results, { push: pushResult, clear: clearList }] = useList([]); - - const handleSubmit = () => { - setShowingResults(true); - const nums = numbers - .split('\n') - .map((num) => num.trim()) - .filter(Boolean) - .map(Number); - counter.set(nums.length); - nums.forEach((num) => { - double({ num }).then( - (result) => { - if (!isMounted()) return; - counter.dec(); - pushResult({ num, result }); - }, - (error) => { - if (!isMounted()) return; - counter.dec(); - pushResult({ num, error }); - } - ); - }); - }; - - const handleReset = () => { - setShowingResults(false); - counter.reset(); - clearList(); - }; - - if (showingResults) { - return ( - -
{JSON.stringify(results, null, 4)}
- - - Reset - -
- ); - } - - return ( - - - setNumbers(e.target.value)} - /> - - - Send - - - ); -}; diff --git a/examples/bfetch_explorer/public/components/page/index.tsx b/examples/bfetch_explorer/public/components/page/index.tsx deleted file mode 100644 index 2d17f9ba23dae..0000000000000 --- a/examples/bfetch_explorer/public/components/page/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React, { FC, PropsWithChildren } from 'react'; -import { EuiPageTemplate, EuiPageSection, EuiPageHeader } from '@elastic/eui'; - -export interface PageProps { - title?: React.ReactNode; - sidebar?: React.ReactNode; -} - -export const Page: FC> = ({ - title = 'Untitled', - sidebar, - children, -}) => { - return ( - - {sidebar} - - - - - {children} - - - ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/index.tsx b/examples/bfetch_explorer/public/containers/app/index.tsx deleted file mode 100644 index 9ddd1b44e4354..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/index.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { Redirect } from 'react-router-dom'; -import { BrowserRouter as Router, Route, Routes } from '@kbn/shared-ux-router'; -import { EuiPage } from '@elastic/eui'; -import { useDeps } from '../../hooks/use_deps'; -import { routes } from '../../routes'; - -export const App: React.FC = () => { - const { appBasePath } = useDeps(); - - const routeElements: React.ReactElement[] = []; - for (const { items } of routes) { - for (const { id, component } of items) { - routeElements.push( component} />); - } - } - - return ( - - - - {routeElements} - - - - - ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx b/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx deleted file mode 100644 index fdd5de83bf058..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/pages/page_count_until/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { EuiPanel, EuiText } from '@elastic/eui'; -import { CountUntil } from '../../../../components/count_until'; -import { Page } from '../../../../components/page'; -import { useDeps } from '../../../../hooks/use_deps'; -import { Sidebar } from '../../sidebar'; - -export const PageCountUntil = () => { - const { plugins } = useDeps(); - - return ( - }> - - This demo sends a single number N using fetchStreaming to the server. The - server will stream back N number of messages with 1 second delay each containing a number - from 1 to N, after which it will close the stream. - -
- - - -
- ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx b/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx deleted file mode 100644 index 4e6b1864c638d..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/pages/page_double_integers/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { EuiPanel, EuiText } from '@elastic/eui'; -import { DoubleIntegers } from '../../../../components/double_integers'; -import { Page } from '../../../../components/page'; -import { useDeps } from '../../../../hooks/use_deps'; -import { Sidebar } from '../../sidebar'; - -export const PageDoubleIntegers = () => { - const { explorer } = useDeps(); - - return ( - }> - - Below is a list of numbers in milliseconds. They are sent as a batch to the server. For each - number server waits given number of milliseconds then doubles the number and streams it - back. - -
- - - -
- ); -}; diff --git a/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx b/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx deleted file mode 100644 index 784c8b5a7b1fa..0000000000000 --- a/examples/bfetch_explorer/public/containers/app/sidebar/index.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { EuiSideNav } from '@elastic/eui'; -import { useHistory } from 'react-router-dom'; -import { routes } from '../../../routes'; - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -interface SidebarProps {} - -export const Sidebar: React.FC = () => { - const history = useHistory(); - - return ( - ({ - id, - name: title, - isSelected: true, - items: items.map((route) => ({ - id: route.id, - name: route.title, - onClick: () => history.push(`/${route.id}`), - 'data-test-subj': route.id, - })), - })), - }, - ]} - /> - ); -}; diff --git a/examples/bfetch_explorer/public/hooks/use_deps.ts b/examples/bfetch_explorer/public/hooks/use_deps.ts deleted file mode 100644 index a212525d00eff..0000000000000 --- a/examples/bfetch_explorer/public/hooks/use_deps.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { BfetchDeps } from '../mount'; - -export const useDeps = () => useKibana().services as unknown as BfetchDeps; diff --git a/examples/bfetch_explorer/public/mount.tsx b/examples/bfetch_explorer/public/mount.tsx deleted file mode 100644 index 525f7b21078f0..0000000000000 --- a/examples/bfetch_explorer/public/mount.tsx +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import * as React from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { CoreSetup, CoreStart, AppMountParameters } from '@kbn/core/public'; -import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; -import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; -import { BfetchExplorerStartPlugins, ExplorerService } from './plugin'; -import { App } from './containers/app'; - -export interface BfetchDeps { - appBasePath: string; - core: CoreStart; - plugins: BfetchExplorerStartPlugins; - explorer: ExplorerService; -} - -export const mount = - (coreSetup: CoreSetup, explorer: ExplorerService) => - async ({ appBasePath, element }: AppMountParameters) => { - const [core, plugins] = await coreSetup.getStartServices(); - const deps: BfetchDeps = { appBasePath, core, plugins, explorer }; - const reactElement = ( - - - - - - ); - render(reactElement, element); - return () => unmountComponentAtNode(element); - }; diff --git a/examples/bfetch_explorer/public/plugin.tsx b/examples/bfetch_explorer/public/plugin.tsx deleted file mode 100644 index 2840f016b5d2b..0000000000000 --- a/examples/bfetch_explorer/public/plugin.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { Plugin, CoreSetup } from '@kbn/core/public'; -import { BfetchPublicSetup, BfetchPublicStart } from '@kbn/bfetch-plugin/public'; -import { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public'; -import { mount } from './mount'; - -export interface ExplorerService { - double: (number: { num: number }) => Promise<{ num: number }>; -} - -export interface BfetchExplorerSetupPlugins { - bfetch: BfetchPublicSetup; - developerExamples: DeveloperExamplesSetup; -} - -export interface BfetchExplorerStartPlugins { - bfetch: BfetchPublicStart; -} - -export class BfetchExplorerPlugin implements Plugin { - public setup( - core: CoreSetup, - { bfetch, developerExamples }: BfetchExplorerSetupPlugins - ) { - const double = bfetch.batchedFunction<{ num: number }, { num: number }>({ - url: '/bfetch_explorer/double', - }); - - const explorer: ExplorerService = { - double, - }; - - core.application.register({ - id: 'bfetch-explorer', - title: 'bfetch explorer', - visibleIn: [], - mount: mount(core, explorer), - }); - - developerExamples.register({ - appId: 'bfetch-explorer', - title: 'bfetch', - description: - 'bfetch is a service that allows to batch HTTP requests and streams responses back.', - links: [ - { - label: 'README', - href: 'https://github.com/elastic/kibana/blob/main/src/plugins/bfetch/README.md', - iconType: 'logoGithub', - size: 's', - target: '_blank', - }, - ], - }); - } - - public start() {} - public stop() {} -} diff --git a/examples/bfetch_explorer/public/routes.tsx b/examples/bfetch_explorer/public/routes.tsx deleted file mode 100644 index 69ae6a8e94bbb..0000000000000 --- a/examples/bfetch_explorer/public/routes.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import React from 'react'; -import { PageDoubleIntegers } from './containers/app/pages/page_double_integers'; -import { PageCountUntil } from './containers/app/pages/page_count_until'; - -interface RouteSectionDef { - title: string; - id: string; - items: RouteDef[]; -} - -interface RouteDef { - title: string; - id: string; - component: React.ReactNode; -} - -export const routes: RouteSectionDef[] = [ - { - title: 'fetchStreaming', - id: 'fetchStreaming', - items: [ - { - title: 'Count until', - id: 'count-until', - component: , - }, - ], - }, - { - title: 'batchedFunction', - id: 'batchedFunction', - items: [ - { - title: 'Double integers', - id: 'double-integers', - component: , - }, - ], - }, -]; diff --git a/examples/bfetch_explorer/server/plugin.ts b/examples/bfetch_explorer/server/plugin.ts deleted file mode 100644 index 41dd5ab4f4601..0000000000000 --- a/examples/bfetch_explorer/server/plugin.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { Subject } from 'rxjs'; -import { Plugin, CoreSetup, CoreStart } from '@kbn/core/server'; -import { BfetchServerSetup, BfetchServerStart } from '@kbn/bfetch-plugin/server'; - -export interface BfetchExplorerSetupPlugins { - bfetch: BfetchServerSetup; -} - -export interface BfetchExplorerStartPlugins { - bfetch: BfetchServerStart; -} - -export class BfetchExplorerPlugin implements Plugin { - public setup(core: CoreSetup, plugins: BfetchExplorerSetupPlugins) { - plugins.bfetch.addStreamingResponseRoute('/bfetch_explorer/count', () => ({ - getResponseStream: ({ data }: any) => { - const subject = new Subject(); - const countTo = Number(data); - for (let cnt = 1; cnt <= countTo; cnt++) { - setTimeout(() => { - subject.next(String(cnt)); - }, cnt * 1000); - } - setTimeout(() => { - subject.complete(); - }, countTo * 1000); - return subject; - }, - })); - - plugins.bfetch.addBatchProcessingRoute<{ num: number }, { num: number }>( - '/bfetch_explorer/double', - () => ({ - onBatchItem: async ({ num }) => { - // Validate inputs. - if (num < 0) throw new Error('Invalid number'); - // Wait number of specified milliseconds. - await new Promise((r) => setTimeout(r, num)); - // Double the number and send it back. - return { num: 2 * num }; - }, - }) - ); - } - - public start(core: CoreStart, plugins: BfetchExplorerStartPlugins) {} - - public stop() {} -} diff --git a/examples/bfetch_explorer/tsconfig.json b/examples/bfetch_explorer/tsconfig.json deleted file mode 100644 index c8417c734f58d..0000000000000 --- a/examples/bfetch_explorer/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "target/types", - }, - "include": [ - "index.ts", - "public/**/*.ts", - "public/**/*.tsx", - "server/**/*.ts", - "../../typings/**/*", - ], - "exclude": [ - "target/**/*", - ], - "kbn_references": [ - "@kbn/core", - "@kbn/developer-examples-plugin", - "@kbn/bfetch-plugin", - "@kbn/kibana-react-plugin", - "@kbn/shared-ux-router", - "@kbn/react-kibana-context-render", - ] -} diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 9945bce1322a3..f12014443bb0b 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -4521,724 +4521,6 @@ paths: summary: Get information about rules tags: - alerting - /api/alerts/alert/{alertId}: - delete: - deprecated: true - description: | - Deprecated in 7.13.0. Use the delete rule API instead. WARNING: After you delete an alert, you cannot recover it. - operationId: legaryDeleteAlert - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Delete an alert - tags: - - alerting - get: - deprecated: true - description: Deprecated in 7.13.0. Use the get rule API instead. - operationId: legacyGetAlert - parameters: - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_alert_response_properties' - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Get an alert by identifier - tags: - - alerting - post: - deprecated: true - description: Deprecated in 7.13.0. Use the create rule API instead. - operationId: legacyCreateAlert - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - requestBody: - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - title: Legacy create alert request properties - type: object - properties: - actions: - items: - type: object - properties: - actionTypeId: - description: The identifier for the action type. - type: string - group: - description: | - Grouping actions is recommended for escalations for different types of alert instances. If you don't need this functionality, set it to `default`. - type: string - id: - description: The ID of the action saved object. - type: string - params: - description: | - The map to the `params` that the action type will receive. `params` are handled as Mustache templates and passed a default set of context. - type: object - required: - - actionTypeId - - group - - id - - params - type: array - alertTypeId: - description: The ID of the alert type that you want to call when the alert is scheduled to run. - type: string - consumer: - description: The name of the application that owns the alert. This name has to match the Kibana feature name, as that dictates the required role-based access control privileges. - type: string - enabled: - description: Indicates if you want to run the alert on an interval basis after it is created. - type: boolean - name: - description: A name to reference and search. - type: string - notifyWhen: - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - type: string - params: - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - type: object - schedule: - description: | - The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - type: object - properties: - interval: - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: 10s - type: string - tags: - description: A list of keywords to reference and search. - items: - type: string - type: array - throttle: - description: | - How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - type: string - required: - - alertTypeId - - consumer - - name - - notifyWhen - - params - - schedule - required: true - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_alert_response_properties' - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Create an alert - tags: - - alerting - put: - deprecated: true - description: Deprecated in 7.13.0. Use the update rule API instead. - operationId: legacyUpdateAlert - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - requestBody: - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - title: Legacy update alert request properties - type: object - properties: - actions: - items: - type: object - properties: - actionTypeId: - description: The identifier for the action type. - type: string - group: - description: | - Grouping actions is recommended for escalations for different types of alert instances. If you don't need this functionality, set it to `default`. - type: string - id: - description: The ID of the action saved object. - type: string - params: - description: | - The map to the `params` that the action type will receive. `params` are handled as Mustache templates and passed a default set of context. - type: object - required: - - actionTypeId - - group - - id - - params - type: array - name: - description: A name to reference and search. - type: string - notifyWhen: - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - type: string - params: - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - type: object - schedule: - description: | - The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - type: object - properties: - interval: - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: 1d - type: string - tags: - description: A list of keywords to reference and search. - items: - type: string - type: array - throttle: - description: | - How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - type: string - required: - - name - - notifyWhen - - params - - schedule - required: true - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_alert_response_properties' - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Update an alert - tags: - - alerting - /api/alerts/alert/{alertId}/_disable: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the disable rule API instead. - operationId: legacyDisableAlert - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Disable an alert - tags: - - alerting - /api/alerts/alert/{alertId}/_enable: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the enable rule API instead. - operationId: legacyEnableAlert - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Enable an alert - tags: - - alerting - /api/alerts/alert/{alertId}/_mute_all: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the mute all alerts API instead. - operationId: legacyMuteAllAlertInstances - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Mute all alert instances - tags: - - alerting - /api/alerts/alert/{alertId}/_unmute_all: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the unmute all alerts API instead. - operationId: legacyUnmuteAllAlertInstances - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: The identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Unmute all alert instances - tags: - - alerting - /api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the mute alert API instead. - operationId: legacyMuteAlertInstance - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: An identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - - description: An identifier for the alert instance. - in: path - name: alertInstanceId - required: true - schema: - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Mute an alert instance - tags: - - alerting - /api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute: - post: - deprecated: true - description: Deprecated in 7.13.0. Use the unmute alert API instead. - operationId: legacyUnmuteAlertInstance - parameters: - - $ref: '#/components/parameters/Alerting_kbn_xsrf' - - description: An identifier for the alert. - in: path - name: alertId - required: true - schema: - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - type: string - - description: An identifier for the alert instance. - in: path - name: alertInstanceId - required: true - schema: - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - type: string - responses: - '204': - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Unmute an alert instance - tags: - - alerting - /api/alerts/alerts/_find: - get: - deprecated: true - description: | - Deprecated in 7.13.0. Use the find rules API instead. NOTE: Alert `params` are stored as a flattened field type and analyzed as keywords. As alerts change in Kibana, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data. - operationId: legacyFindAlerts - parameters: - - description: The default operator to use for the `simple_query_string`. - example: OR - in: query - name: default_search_operator - schema: - default: OR - type: string - - description: The fields to return in the `attributes` key of the response. - in: query - name: fields - schema: - items: - type: string - type: array - - description: | - A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: "myTitle"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`. - in: query - name: filter - schema: - type: string - - description: Filters the rules that have a relation with the reference objects with a specific type and identifier. - in: query - name: has_reference - schema: - type: object - properties: - id: - type: string - type: - type: string - - description: The page number to return. - example: 1 - in: query - name: page - schema: - default: 1 - type: integer - - description: The number of alerts to return per page. - example: 20 - in: query - name: per_page - schema: - default: 20 - type: integer - - description: An Elasticsearch `simple_query_string` query that filters the alerts in the response. - in: query - name: search - schema: - type: string - - description: The fields to perform the `simple_query_string` parsed query against. - in: query - name: search_fields - schema: - oneOf: - - type: string - - items: - type: string - type: array - - description: | - Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. - in: query - name: sort_field - schema: - type: string - - description: Determines the sort order. - example: asc - in: query - name: sort_order - schema: - default: desc - enum: - - asc - - desc - type: string - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - type: object - properties: - data: - items: - $ref: '#/components/schemas/Alerting_alert_response_properties' - type: array - page: - type: integer - perPage: - type: integer - total: - type: integer - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Get a paginated set of alerts - tags: - - alerting - /api/alerts/alerts/_health: - get: - deprecated: true - description: Deprecated in 7.13.0. Use the get alerting framework health API instead. - operationId: legacyGetAlertingHealth - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - type: object - properties: - alertingFrameworkHealth: - description: | - Three substates identify the health of the alerting framework: `decryptionHealth`, `executionHealth`, and `readHealth`. - type: object - properties: - decryptionHealth: - description: The timestamp and status of the alert decryption. - type: object - properties: - status: - enum: - - error - - ok - - warn - example: ok - type: string - timestamp: - example: '2023-01-13T01:28:00.280Z' - format: date-time - type: string - executionHealth: - description: The timestamp and status of the alert execution. - type: object - properties: - status: - enum: - - error - - ok - - warn - example: ok - type: string - timestamp: - example: '2023-01-13T01:28:00.280Z' - format: date-time - type: string - readHealth: - description: The timestamp and status of the alert reading events. - type: object - properties: - status: - enum: - - error - - ok - - warn - example: ok - type: string - timestamp: - example: '2023-01-13T01:28:00.280Z' - format: date-time - type: string - hasPermanentEncryptionKey: - description: If `false`, the encrypted saved object plugin does not have a permanent encryption key. - example: true - type: boolean - isSufficientlySecure: - description: If `false`, security is enabled but TLS is not. - example: true - type: boolean - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Get the alerting framework health - tags: - - alerting - /api/alerts/alerts/list_alert_types: - get: - deprecated: true - description: Deprecated in 7.13.0. Use the get rule types API instead. - operationId: legacyGetAlertTypes - responses: - '200': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - items: - type: object - properties: - actionGroups: - description: | - An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid. - items: - type: object - properties: - id: - type: string - name: - type: string - type: array - actionVariables: - description: | - A list of action variables that the alert type makes available via context and state in action parameter templates, and a short human readable description. The Alert UI will use this information to prompt users for these variables in action parameter editors. - type: object - properties: - context: - items: - type: object - properties: - description: - type: string - name: - type: string - type: array - params: - items: - type: object - properties: - description: - type: string - name: - type: string - type: array - state: - items: - type: object - properties: - description: - type: string - name: - type: string - type: array - authorizedConsumers: - description: The list of the plugins IDs that have access to the alert type. - type: object - defaultActionGroupId: - description: The default identifier for the alert type group. - type: string - enabledInLicense: - description: Indicates whether the rule type is enabled based on the subscription. - type: boolean - id: - description: The unique identifier for the alert type. - type: string - isExportable: - description: Indicates whether the alert type is exportable in Saved Objects Management UI. - type: boolean - minimumLicenseRequired: - description: The subscriptions required to use the alert type. - type: string - name: - description: The descriptive name of the alert type. - type: string - producer: - description: An identifier for the application that produces this alert type. - type: string - recoveryActionGroup: - description: | - An action group to use when an alert instance goes from an active state to an inactive one. If it is not specified, the default recovered action group is used. - type: object - properties: - id: - type: string - name: - type: string - type: array - description: Indicates a successful call. - '401': - content: - application/json; Elastic-Api-Version=2023-10-31: - schema: - $ref: '#/components/schemas/Alerting_401_response' - description: Authorization information is missing or invalid. - summary: Get the alert types - tags: - - alerting /api/apm/agent_keys: post: description: Create a new agent key for APM. @@ -44044,13 +43326,6 @@ components: disabledFeatures: [] imageUrl: '' parameters: - Alerting_kbn_xsrf: - description: Cross-site request forgery protection - in: header - name: kbn-xsrf - required: true - schema: - type: string APM_UI_elastic_api_version: description: The version of the API to use in: header @@ -44404,89 +43679,6 @@ components: type: integer title: Unsuccessful rule API response type: object - Alerting_alert_response_properties: - title: Legacy alert response properties - type: object - properties: - actions: - items: - type: object - type: array - alertTypeId: - example: .index-threshold - type: string - apiKeyOwner: - example: elastic - nullable: true - type: string - createdAt: - description: The date and time that the alert was created. - example: '2022-12-05T23:36:58.284Z' - format: date-time - type: string - createdBy: - description: The identifier for the user that created the alert. - example: elastic - type: string - enabled: - description: Indicates whether the alert is currently enabled. - example: true - type: boolean - executionStatus: - type: object - properties: - lastExecutionDate: - example: '2022-12-06T00:13:43.890Z' - format: date-time - type: string - status: - example: ok - type: string - id: - description: The identifier for the alert. - example: b530fed0-74f5-11ed-9801-35303b735aef - type: string - muteAll: - example: false - type: boolean - mutedInstanceIds: - items: - type: string - nullable: true - type: array - name: - description: The name of the alert. - example: my alert - type: string - notifyWhen: - example: onActionGroupChange - type: string - params: - additionalProperties: true - type: object - schedule: - type: object - properties: - interval: - type: string - scheduledTaskId: - example: b530fed0-74f5-11ed-9801-35303b735aef - type: string - tags: - items: - type: string - type: array - throttle: - nullable: true - type: string - updatedAt: - example: '2022-12-05T23:36:58.284Z' - type: string - updatedBy: - description: The identifier for the user that updated this alert most recently. - example: elastic - nullable: true - type: string Alerting_fieldmap_properties: title: Field map objects in the get rule types response type: object diff --git a/oas_docs/overlays/alerting.overlays.yaml b/oas_docs/overlays/alerting.overlays.yaml index f6920e662e9e3..0f579b54a5502 100644 --- a/oas_docs/overlays/alerting.overlays.yaml +++ b/oas_docs/overlays/alerting.overlays.yaml @@ -111,7 +111,7 @@ actions: # Infra metric threshold rule (metrics.alert.threshold) - $ref: '../../x-pack/plugins/observability_solution/infra/server/lib/alerting/docs/params_property_infra_metric_threshold.yaml' # SLO burn rate (slo.rules.burnRate) - - $ref: '../../x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml' + - $ref: '../../x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml' # Synthetics uptime TLS rule (xpack.uptime.alerts.tls) - $ref: '../../x-pack/solutions/observability/plugins/uptime/server/legacy_uptime/lib/alerts/docs/params_property_synthetics_uptime_tls.yaml' # Uptime monitor status rule (xpack.uptime.alerts.monitorStatus) diff --git a/oas_docs/scripts/merge_ess_oas.js b/oas_docs/scripts/merge_ess_oas.js index c44a6669ca8bc..0b6cc14a983b9 100644 --- a/oas_docs/scripts/merge_ess_oas.js +++ b/oas_docs/scripts/merge_ess_oas.js @@ -23,7 +23,7 @@ const { REPO_ROOT } = require('@kbn/repo-info'); // Observability Solution `${REPO_ROOT}/x-pack/plugins/observability_solution/apm/docs/openapi/apm/bundled.yaml`, - `${REPO_ROOT}/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml`, + `${REPO_ROOT}/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.yaml`, // Security solution `${REPO_ROOT}/x-pack/plugins/security_solution/docs/openapi/ess/*.schema.yaml`, diff --git a/oas_docs/scripts/merge_serverless_oas.js b/oas_docs/scripts/merge_serverless_oas.js index bc466a289bdd5..a21a4721eba92 100644 --- a/oas_docs/scripts/merge_serverless_oas.js +++ b/oas_docs/scripts/merge_serverless_oas.js @@ -21,7 +21,7 @@ const { REPO_ROOT } = require('@kbn/repo-info'); // Observability Solution `${REPO_ROOT}/x-pack/plugins/observability_solution/apm/docs/openapi/apm/bundled.yaml`, - `${REPO_ROOT}/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml`, + `${REPO_ROOT}/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.yaml`, // Security solution `${REPO_ROOT}/x-pack/plugins/security_solution/docs/openapi/serverless/*.schema.yaml`, diff --git a/package.json b/package.json index d6256b9d0895a..65f4412bb3bb3 100644 --- a/package.json +++ b/package.json @@ -197,7 +197,6 @@ "@kbn/avc-banner": "link:src/platform/packages/shared/kbn-avc-banner", "@kbn/banners-plugin": "link:x-pack/plugins/banners", "@kbn/bfetch-error": "link:packages/kbn-bfetch-error", - "@kbn/bfetch-explorer-plugin": "link:examples/bfetch_explorer", "@kbn/bfetch-plugin": "link:src/plugins/bfetch", "@kbn/calculate-auto": "link:packages/kbn-calculate-auto", "@kbn/calculate-width-from-char-count": "link:packages/kbn-calculate-width-from-char-count", @@ -929,7 +928,7 @@ "@kbn/shared-ux-tabbed-modal": "link:packages/shared-ux/modal/tabbed", "@kbn/shared-ux-table-persist": "link:packages/shared-ux/table_persist", "@kbn/shared-ux-utility": "link:packages/kbn-shared-ux-utility", - "@kbn/slo-plugin": "link:x-pack/plugins/observability_solution/slo", + "@kbn/slo-plugin": "link:x-pack/solutions/observability/plugins/slo", "@kbn/slo-schema": "link:x-pack/platform/packages/shared/kbn-slo-schema", "@kbn/snapshot-restore-plugin": "link:x-pack/platform/plugins/private/snapshot_restore", "@kbn/sort-predicates": "link:packages/kbn-sort-predicates", @@ -1451,6 +1450,7 @@ "@kbn/es": "link:packages/kbn-es", "@kbn/es-archiver": "link:packages/kbn-es-archiver", "@kbn/eslint-config": "link:packages/kbn-eslint-config", + "@kbn/eslint-plugin-css": "link:packages/kbn-eslint-plugin-css", "@kbn/eslint-plugin-disable": "link:packages/kbn-eslint-plugin-disable", "@kbn/eslint-plugin-eslint": "link:packages/kbn-eslint-plugin-eslint", "@kbn/eslint-plugin-i18n": "link:packages/kbn-eslint-plugin-i18n", @@ -1566,6 +1566,7 @@ "@types/classnames": "^2.2.9", "@types/cli-progress": "^3.11.5", "@types/color": "^3.0.3", + "@types/cssstyle": "^2.2.4", "@types/cytoscape": "^3.14.0", "@types/d3": "^3.5.43", "@types/d3-array": "^2.12.1", @@ -1714,6 +1715,7 @@ "css-loader": "^3.4.2", "cssnano": "^5.1.12", "cssnano-preset-default": "^5.2.12", + "cssstyle": "^4.1.0", "csstype": "^3.0.2", "cypress": "13.15.2", "cypress-axe": "^1.5.0", diff --git a/packages/core/http/core-http-server-internal/src/__snapshots__/http_config.test.ts.snap b/packages/core/http/core-http-server-internal/src/__snapshots__/http_config.test.ts.snap index aef7f6e70afca..71aedb914b72d 100644 --- a/packages/core/http/core-http-server-internal/src/__snapshots__/http_config.test.ts.snap +++ b/packages/core/http/core-http-server-internal/src/__snapshots__/http_config.test.ts.snap @@ -131,7 +131,6 @@ Object { "enabled": false, "keystore": Object {}, "supportedProtocols": Array [ - "TLSv1.1", "TLSv1.2", "TLSv1.3", ], diff --git a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.test.ts b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.test.ts index 440a62853c099..f72664ff0c1fa 100644 --- a/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.test.ts +++ b/packages/core/usage-data/core-usage-data-server-internal/src/core_usage_data_service.test.ts @@ -355,7 +355,6 @@ describe('CoreUsageDataService', () => { "keystoreConfigured": false, "redirectHttpFromPortConfigured": false, "supportedProtocols": Array [ - "TLSv1.1", "TLSv1.2", "TLSv1.3", ], diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index 1eaeb115ab673..d907066535cca 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -15,7 +15,7 @@ module.exports = { USES_STYLED_COMPONENTS: [ /packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/, /src[\/\\]plugins[\/\\](kibana_react)[\/\\]/, - /x-pack[\/\\]solutions[\/\\]observability[\/\\]plugins[\/\\]/, + /x-pack[\/\\]solutions[\/\\]observability[\/\\]plugins[\/\\](exploratory_view|investigate|investigate_app|observability|observability_ai_assistant_app|observability_ai_assistant_management|observability_solution|serverless_observability|streams|streams_app|synthetics|uptime|ux)[\/\\]/, /x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/, diff --git a/packages/kbn-eslint-config/.eslintrc.js b/packages/kbn-eslint-config/.eslintrc.js index e38b6cc48c443..57a116a2b9b68 100644 --- a/packages/kbn-eslint-config/.eslintrc.js +++ b/packages/kbn-eslint-config/.eslintrc.js @@ -28,6 +28,7 @@ module.exports = { '@kbn/eslint-plugin-imports', '@kbn/eslint-plugin-telemetry', '@kbn/eslint-plugin-i18n', + '@kbn/eslint-plugin-css', 'eslint-plugin-depend', 'prettier', ], @@ -332,6 +333,7 @@ module.exports = { '@kbn/imports/no_boundary_crossing': 'error', '@kbn/imports/no_group_crossing_manifests': 'error', '@kbn/imports/no_group_crossing_imports': 'error', + '@kbn/css/no_css_color': 'warn', 'no-new-func': 'error', 'no-implied-eval': 'error', 'no-prototype-builtins': 'error', diff --git a/packages/kbn-eslint-plugin-css/README.mdx b/packages/kbn-eslint-plugin-css/README.mdx new file mode 100644 index 0000000000000..1e121657bc571 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/README.mdx @@ -0,0 +1,129 @@ +--- +id: kibSharedUXEslintPluginCSS +slug: /kibana-dev-docs/shared-ux/packages/kbn-eslint-plugin-css +title: '@kbn/eslint-plugin-design-tokens' +description: Custom ESLint rules to guardrails for using eui in the Kibana repository +date: 2024-11-19 +tags: ['kibana', 'dev', 'contributor', 'shared_ux', 'eslint', 'eui'] +--- + +# Summary + +`@kbn/eslint-plugin-css` is an ESLint plugin providing custom ESLint rules to help setup guardrails for using eui in the Kibana repo especially around styling. + +The aim of this package is to help engineers to modify EUI components in a much complaint way. + +If a rule does not behave as you expect or you have an idea of how these rules can be improved, please reach out to the Shared UX team. + +# Rules + +## `@kbn/css/no_css_color` + +This rule warns engineers to not use literal css color in the codebase, particularly for CSS properties that apply color to +either the html element or text nodes, but rather urge users to defer to using the color tokens provided by EUI. + +This rule kicks in on the following JSXAttributes; `style`, `className` and `css` and supports various approaches to providing styling declarations. + +### Example + +The following code: + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + return ( + You know, for search + ) +} +``` + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + + const style = { + color: 'red' + } + + return ( + You know, for search + ) +} +``` + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + const colorValue = '#dd4040'; + + return ( + You know, for search + ) +} +``` + +will all raise an eslint report with an appropriate message of severity that matches the configuration of the rule, further more all the examples above +will also match for when the attribute in question is `css`. The `css` attribute will also raise a report the following cases below; + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { css } from '@emotion/css'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + return ( + You know, for search + ) +} +``` + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + return ( + ({ color: '#dd4040' })}>You know, for search + ) +} +``` + +A special case is also covered for the `className` attribute, where the rule will also raise a report for the following case below; + + +``` +// Filename: /x-pack/plugins/observability_solution/observability/public/my_component.tsx + +import React from 'react'; +import { css } from '@emotion/css'; +import { EuiText } from '@elastic/eui'; + +function MyComponent() { + return ( + You know, for search + ) +} +``` + +it's worth pointing out that although the examples provided are specific to EUI components, this rule applies to all JSX elements. + +## `@kbn/css/prefer_css_attributes_for_eui_components` + +This rule warns engineers to use the `css` attribute for EUI components instead of the `style` attribute. + diff --git a/examples/bfetch_explorer/server/index.ts b/packages/kbn-eslint-plugin-css/index.ts similarity index 53% rename from examples/bfetch_explorer/server/index.ts rename to packages/kbn-eslint-plugin-css/index.ts index ef09a9627b139..9ea4bcc67619f 100644 --- a/examples/bfetch_explorer/server/index.ts +++ b/packages/kbn-eslint-plugin-css/index.ts @@ -7,7 +7,14 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export const plugin = async () => { - const { BfetchExplorerPlugin } = await import('./plugin'); - return new BfetchExplorerPlugin(); +import { NoCssColor } from './src/rules/no_css_color'; +import { PreferCSSAttributeForEuiComponents } from './src/rules/prefer_css_attribute_for_eui_components'; + +/** + * Custom ESLint rules, included as `'@kbn/eslint-plugin-design-tokens'` in the kibana eslint config + * @internal + */ +export const rules = { + no_css_color: NoCssColor, + prefer_css_attributes_for_eui_components: PreferCSSAttributeForEuiComponents, }; diff --git a/examples/bfetch_explorer/public/index.ts b/packages/kbn-eslint-plugin-css/jest.config.js similarity index 79% rename from examples/bfetch_explorer/public/index.ts rename to packages/kbn-eslint-plugin-css/jest.config.js index ebc736cca673b..c8ae20237eae8 100644 --- a/examples/bfetch_explorer/public/index.ts +++ b/packages/kbn-eslint-plugin-css/jest.config.js @@ -7,6 +7,8 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { BfetchExplorerPlugin } from './plugin'; - -export const plugin = () => new BfetchExplorerPlugin(); +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-eslint-plugin-css'], +}; diff --git a/packages/kbn-eslint-plugin-css/kibana.jsonc b/packages/kbn-eslint-plugin-css/kibana.jsonc new file mode 100644 index 0000000000000..3ee8bff8736f6 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/kibana.jsonc @@ -0,0 +1,6 @@ +{ + "type": "shared-common", + "id": "@kbn/eslint-plugin-css", + "devOnly": true, + "owner": "@elastic/appex-sharedux" +} diff --git a/packages/kbn-eslint-plugin-css/package.json b/packages/kbn-eslint-plugin-css/package.json new file mode 100644 index 0000000000000..c811f06f27cb7 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/eslint-plugin-css", + "version": "1.0.0", + "private": true, + "license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0" +} diff --git a/packages/kbn-eslint-plugin-css/src/rules/no_css_color.test.ts b/packages/kbn-eslint-plugin-css/src/rules/no_css_color.test.ts new file mode 100644 index 0000000000000..e1f683b09814f --- /dev/null +++ b/packages/kbn-eslint-plugin-css/src/rules/no_css_color.test.ts @@ -0,0 +1,249 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { RuleTester } from 'eslint'; +import { NoCssColor } from './no_css_color'; + +const tsTester = [ + '@typescript-eslint/parser', + new RuleTester({ + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + ecmaFeatures: { + jsx: true, + }, + }, + }), +] as const; + +const babelTester = [ + '@babel/eslint-parser', + new RuleTester({ + parser: require.resolve('@babel/eslint-parser'), + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + requireConfigFile: false, + babelOptions: { + presets: ['@kbn/babel-preset/node_preset'], + }, + }, + }), +] as const; + +const invalid: RuleTester.InvalidTestCase[] = [ + { + name: 'Raises an error when a CSS color is used in a JSX style attribute', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColorSpecific' }], + }, + { + name: 'Raises an error when a CSS color references a string variable that is passed to style prop of a JSX element', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + const codeColor = '#dd4040'; + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCSSColorSpecificDeclaredVariable' }], + }, + { + name: 'Raises an error when a CSS color is used in an object variable that is passed to style prop of a JSX element', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + const codeStyle = { color: '#dd4040' }; + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCSSColorSpecificDeclaredVariable' }], + }, + { + name: 'Raises an error when an object property that is a literal CSS color is used for the background property in a JSX style attribute', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + const baseStyle = { background: 'rgb(255, 255, 255)' }; + + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCSSColorSpecificDeclaredVariable' }], + }, + { + name: 'Raises an error when a CSS color is used in a variable that is spread into another variable that is passed to style prop of a JSX element', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + const baseStyle = { background: 'rgb(255, 255, 255)' }; + const codeStyle = { margin: '5px', ...baseStyle }; + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCSSColorSpecificDeclaredVariable' }], + }, + { + name: 'Raises an error when a CSS color is used for the background property in a JSX style attribute', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColorSpecific' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX css attribute for EuiComponents', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColorSpecific' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in with the tagged template css function', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import { css } from '@emotion/css'; + + const codeColor = css\` color: #dd4040; \`; + `, + errors: [{ messageId: 'noCssColor' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX css attribute for EuiComponents with the css template function', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + import { css } from '@emotion/css'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColor' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX className attribute for EuiComponents with the css template function defined outside the scope of the component', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + import { css } from '@emotion/css'; + + const codeCss = css({ + color: '#dd4040', + }) + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCSSColorSpecificDeclaredVariable' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX className attribute for EuiComponents with the css template function defined outside the scope of the component', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + import { css } from '@emotion/css'; + + const codeCss = css\` color: #dd4040; \` + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColor' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX css attribute for EuiComponents with an arrow function', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + ({ color: '#dd4040' })}>This is a test + ) + }`, + errors: [{ messageId: 'noCssColorSpecific' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX css attribute for EuiComponents with a regular function', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColorSpecific' }], + }, + { + name: 'Raises an error when a CSS color for the color property is used in a JSX className attribute for EuiComponents with the css template function', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + import { css } from '@emotion/css'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [{ messageId: 'noCssColor' }], + }, +]; + +const valid: RuleTester.ValidTestCase[] = []; + +for (const [name, tester] of [tsTester, babelTester]) { + describe(name, () => { + tester.run('@kbn/no_css_color', NoCssColor, { + valid, + invalid, + }); + }); +} diff --git a/packages/kbn-eslint-plugin-css/src/rules/no_css_color.ts b/packages/kbn-eslint-plugin-css/src/rules/no_css_color.ts new file mode 100644 index 0000000000000..c453e5edfcd74 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/src/rules/no_css_color.ts @@ -0,0 +1,453 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { Rule } from 'eslint'; +import { CSSStyleDeclaration } from 'cssstyle'; +import type { TSESTree } from '@typescript-eslint/typescript-estree'; + +/** + * @description List of superset css properties that can apply color to html box element elements and text nodes, leveraging the + * css style package allows us to directly singly check for these properties even if the actual declaration was written using the shorthand form + */ +const propertiesSupportingCssColor = ['color', 'background', 'border']; + +/** + * @description Builds off the existing color definition to match css declarations that can apply color to + * html elements and text nodes for string declarations + */ +const htmlElementColorDeclarationRegex = RegExp( + String.raw`(${propertiesSupportingCssColor.join('|')})` +); + +const checkPropertySpecifiesInvalidCSSColor = ([property, value]: string[]) => { + if (!property || !value) return false; + + const style = new CSSStyleDeclaration(); + + // @ts-ignore the types for this packages specifics an index signature of number, alongside other valid CSS properties + style[property] = value; + + const anchor = propertiesSupportingCssColor.find((resolvedProperty) => + property.includes(resolvedProperty) + ); + + if (!anchor) return false; + + // build the resolved color property to check if the value is a string after parsing the style declaration + const resolvedColorProperty = anchor === 'color' ? 'color' : anchor + 'Color'; + + // in trying to keep this rule simple, it's enough if a string is used to define a color to mark it as invalid + // @ts-ignore the types for this packages specifics an index signature of number, alongside other valid CSS properties + return typeof style[resolvedColorProperty] === 'string'; +}; + +const resolveMemberExpressionRoot = (node: TSESTree.MemberExpression): TSESTree.Identifier => { + if (node.object.type === 'MemberExpression') { + return resolveMemberExpressionRoot(node.object); + } + + return node.object as TSESTree.Identifier; +}; + +/** + * @description method to inspect values of interest found on an object + */ +const raiseReportIfPropertyHasInvalidCssColor = ( + context: Rule.RuleContext, + propertyNode: TSESTree.Property, + messageToReport: Rule.ReportDescriptor +) => { + let didReport = false; + + if ( + propertyNode.key.type === 'Identifier' && + !htmlElementColorDeclarationRegex.test(propertyNode.key.name) + ) { + return didReport; + } + + if (propertyNode.value.type === 'Literal') { + if ( + (didReport = checkPropertySpecifiesInvalidCSSColor([ + // @ts-expect-error the key name is present in this scenario + propertyNode.key.name, + propertyNode.value.value, + ])) + ) { + context.report(messageToReport); + } + } else if (propertyNode.value.type === 'Identifier') { + const identifierDeclaration = context.sourceCode + // @ts-expect-error + .getScope(propertyNode) + .variables.find( + (variable) => variable.name === (propertyNode.value as TSESTree.Identifier).name! + ); + + if ( + identifierDeclaration?.defs[0].node.init?.type === 'Literal' && + checkPropertySpecifiesInvalidCSSColor([ + // @ts-expect-error the key name is present in this scenario + propertyNode.key.name, + (identifierDeclaration.defs[0].node.init as TSESTree.Literal).value as string, + ]) + ) { + context.report({ + loc: propertyNode.value.loc, + messageId: 'noCSSColorSpecificDeclaredVariable', + data: { + // @ts-expect-error the key name is always present else this code will not execute + property: String(propertyNode.key.name), + line: String(propertyNode.value.loc.start.line), + variableName: propertyNode.value.name, + }, + }); + + didReport = true; + } + } else if (propertyNode.value.type === 'MemberExpression') { + // @ts-expect-error we ignore the case where this node could be a private identifier + const MemberExpressionLeafName = propertyNode.value.property.name; + const memberExpressionRootName = resolveMemberExpressionRoot(propertyNode.value).name; + + const expressionRootDeclaration = context.sourceCode + // @ts-expect-error + .getScope(propertyNode) + .variables.find((variable) => variable.name === memberExpressionRootName); + + const expressionRootDeclarationInit = expressionRootDeclaration?.defs[0].node.init; + + if (expressionRootDeclarationInit?.type === 'ObjectExpression') { + (expressionRootDeclarationInit as TSESTree.ObjectExpression).properties.forEach( + (property) => { + // This is a naive approach expecting the value to be at depth 1, we should actually be traversing the object to the same depth as the expression + if ( + property.type === 'Property' && + property.key.type === 'Identifier' && + property.key?.name === MemberExpressionLeafName + ) { + raiseReportIfPropertyHasInvalidCssColor(context, property, { + loc: propertyNode.value.loc, + messageId: 'noCSSColorSpecificDeclaredVariable', + data: { + // @ts-expect-error the key name is always present else this code will not execute + property: String(propertyNode.key.name), + line: String(propertyNode.value.loc.start.line), + variableName: memberExpressionRootName, + }, + }); + } + } + ); + } else if (expressionRootDeclarationInit?.type === 'CallExpression') { + // TODO: if this object was returned from invoking a function the best we can do is probably validate that the method invoked is one that returns an euitheme object + } + } + + return didReport; +}; + +/** + * + * @description style object declaration have a depth of 1, this function handles the properties of the object + */ +const handleObjectProperties = ( + context: Rule.RuleContext, + propertyParentNode: TSESTree.JSXAttribute, + property: TSESTree.ObjectLiteralElement, + reportMessage: Rule.ReportDescriptor +) => { + if (property.type === 'Property') { + raiseReportIfPropertyHasInvalidCssColor(context, property, reportMessage); + } else if (property.type === 'SpreadElement') { + const spreadElementIdentifierName = (property.argument as TSESTree.Identifier).name; + + const spreadElementDeclaration = context.sourceCode + // @ts-expect-error + .getScope(propertyParentNode!.value.expression!) + .references.find((ref) => ref.identifier.name === spreadElementIdentifierName)?.resolved; + + if (!spreadElementDeclaration) { + return; + } + + reportMessage = { + loc: propertyParentNode.loc, + messageId: 'noCSSColorSpecificDeclaredVariable', + data: { + // @ts-expect-error the key name is always present else this code will not execute + property: String(property.argument.name), + variableName: spreadElementIdentifierName, + line: String(property.loc.start.line), + }, + }; + + const spreadElementDeclarationNode = spreadElementDeclaration.defs[0].node.init; + + // evaluate only statically defined declarations, other possibilities like callExpressions in this context complicate things + if (spreadElementDeclarationNode?.type === 'ObjectExpression') { + (spreadElementDeclarationNode as TSESTree.ObjectExpression).properties.forEach( + (spreadProperty) => { + handleObjectProperties(context, propertyParentNode, spreadProperty, reportMessage); + } + ); + } + } +}; + +export const NoCssColor: Rule.RuleModule = { + meta: { + type: 'suggestion', + docs: { + description: 'Use color definitions from eui theme as opposed to CSS color values', + category: 'Best Practices', + recommended: true, + url: 'https://eui.elastic.co/#/theming/colors/values', + }, + messages: { + noCSSColorSpecificDeclaredVariable: + 'Avoid using a literal CSS color value for "{{property}}", use an EUI theme color instead in declared variable {{variableName}} on line {{line}}', + noCssColorSpecific: + 'Avoid using a literal CSS color value for "{{property}}", use an EUI theme color instead', + noCssColor: 'Avoid using a literal CSS color value, use an EUI theme color instead', + }, + schema: [], + }, + create(context) { + return { + // accounts for instances where declarations are created using the template tagged css function + TaggedTemplateExpression(node) { + if ( + node.tag.type !== 'Identifier' || + (node.tag.type === 'Identifier' && node.tag.name !== 'css') + ) { + return; + } + + for (let i = 0; i < node.quasi.quasis.length; i++) { + const declarationTemplateNode = node.quasi.quasis[i]; + + if (htmlElementColorDeclarationRegex.test(declarationTemplateNode.value.raw)) { + const cssText = declarationTemplateNode.value.raw.replace(/(\{|\}|\\n)/g, '').trim(); + + cssText.split(';').forEach((declaration) => { + if ( + declaration.length > 0 && + checkPropertySpecifiesInvalidCSSColor(declaration.split(':')) + ) { + context.report({ + node: declarationTemplateNode, + messageId: 'noCssColor', + }); + } + }); + } + } + }, + JSXAttribute(node: TSESTree.JSXAttribute) { + if (!(node.name.name === 'style' || node.name.name === 'css')) { + return; + } + + /** + * @description Accounts for instances where a variable is used to define a style object + * + * @example + * const codeStyle = { color: '#dd4040' }; + * This is an example + * + * @example + * const codeStyle = { color: '#dd4040' }; + * This is an example + * + * @example + * const codeStyle = css({ color: '#dd4040' }); + * This is an example + */ + if ( + node.value?.type === 'JSXExpressionContainer' && + node.value.expression.type === 'Identifier' + ) { + const styleVariableName = node.value.expression.name; + + const nodeScope = context.sourceCode.getScope(node.value.expression); + + const variableDeclarationMatches = nodeScope.references.find( + (ref) => ref.identifier.name === styleVariableName + )?.resolved; + + let variableInitializationNode; + + if ((variableInitializationNode = variableDeclarationMatches?.defs?.[0]?.node?.init)) { + if (variableInitializationNode.type === 'ObjectExpression') { + // @ts-ignore + variableInitializationNode.properties.forEach((property) => { + handleObjectProperties(context, node, property, { + loc: property.loc, + messageId: 'noCSSColorSpecificDeclaredVariable', + data: { + property: + property.type === 'SpreadElement' + ? String(property.argument.name) + : String(property.key.name), + variableName: styleVariableName, + line: String(property.loc.start.line), + }, + }); + }); + } else if ( + variableInitializationNode.type === 'CallExpression' && + variableInitializationNode.callee.name === 'css' + ) { + const cssFunctionArgument = variableInitializationNode.arguments[0]; + + if (cssFunctionArgument.type === 'ObjectExpression') { + // @ts-ignore + cssFunctionArgument.properties.forEach((property) => { + handleObjectProperties(context, node, property, { + loc: node.loc, + messageId: 'noCSSColorSpecificDeclaredVariable', + data: { + property: + property.type === 'SpreadElement' + ? String(property.argument.name) + : String(property.key.name), + variableName: styleVariableName, + line: String(property.loc.start.line), + }, + }); + }); + } + } + } + + return; + } + + /** + * + * @description Accounts for instances where a style object is inlined in the JSX attribute + * + * @example + * This is an example + * + * @example + * This is an example + * + * @example + * const styleRules = { color: '#dd4040' }; + * This is an example + * + * @example + * const styleRules = { color: '#dd4040' }; + * This is an example + */ + if ( + node.value?.type === 'JSXExpressionContainer' && + node.value.expression.type === 'ObjectExpression' + ) { + const declarationPropertiesNode = node.value.expression.properties; + + declarationPropertiesNode?.forEach((property) => { + handleObjectProperties(context, node, property, { + loc: property.loc, + messageId: 'noCssColorSpecific', + data: { + property: + property.type === 'SpreadElement' + ? // @ts-expect-error the key name is always present else this code will not execute + String(property.argument.name) + : // @ts-expect-error the key name is always present else this code will not execute + String(property.key.name), + }, + }); + }); + + return; + } + + if (node.name.name === 'css' && node.value?.type === 'JSXExpressionContainer') { + /** + * @example + * This is an example + */ + if (node.value.expression.type === 'TemplateLiteral') { + for (let i = 0; i < node.value.expression.quasis.length; i++) { + const declarationTemplateNode = node.value.expression.quasis[i]; + + if (htmlElementColorDeclarationRegex.test(declarationTemplateNode.value.raw)) { + const cssText = declarationTemplateNode.value.raw + .replace(/(\{|\}|\\n)/g, '') + .trim(); + + cssText.split(';').forEach((declaration) => { + if ( + declaration.length > 0 && + checkPropertySpecifiesInvalidCSSColor(declaration.split(':')) + ) { + context.report({ + node: declarationTemplateNode, + messageId: 'noCssColor', + }); + } + }); + } + } + } + + /** + * @example + * ({ color: '#dd4040' })}>This is an example + */ + if ( + node.value.expression.type === 'FunctionExpression' || + node.value.expression.type === 'ArrowFunctionExpression' + ) { + let declarationPropertiesNode: TSESTree.Property[] = []; + + if (node.value.expression.body.type === 'ObjectExpression') { + // @ts-expect-error + declarationPropertiesNode = node.value.expression.body.properties; + } + + if (node.value.expression.body.type === 'BlockStatement') { + const functionReturnStatementNode = node.value.expression.body.body?.find((_node) => { + return _node.type === 'ReturnStatement'; + }); + + if (!functionReturnStatementNode) { + return; + } + + declarationPropertiesNode = // @ts-expect-error + (functionReturnStatementNode as TSESTree.ReturnStatement).argument?.properties; + } + + if (!declarationPropertiesNode.length) { + return; + } + + declarationPropertiesNode.forEach((property) => { + handleObjectProperties(context, node, property, { + loc: property.loc, + messageId: 'noCssColorSpecific', + data: { + // @ts-expect-error the key name is always present else this code will not execute + property: property.key.name, + }, + }); + }); + + return; + } + } + }, + }; + }, +}; diff --git a/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.test.ts b/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.test.ts new file mode 100644 index 0000000000000..f1534ec5c861f --- /dev/null +++ b/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.test.ts @@ -0,0 +1,85 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import { RuleTester } from 'eslint'; +import { PreferCSSAttributeForEuiComponents } from './prefer_css_attribute_for_eui_components'; + +const tsTester = [ + '@typescript-eslint/parser', + new RuleTester({ + parser: require.resolve('@typescript-eslint/parser'), + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + ecmaFeatures: { + jsx: true, + }, + }, + }), +] as const; + +const babelTester = [ + '@babel/eslint-parser', + new RuleTester({ + parser: require.resolve('@babel/eslint-parser'), + parserOptions: { + sourceType: 'module', + ecmaVersion: 2018, + requireConfigFile: false, + babelOptions: { + presets: ['@kbn/babel-preset/node_preset'], + }, + }, + }), +] as const; + +const invalid: RuleTester.InvalidTestCase[] = [ + { + name: 'Prefer the JSX css attribute for EUI components', + filename: '/x-pack/plugins/observability_solution/observability/public/test_component.tsx', + code: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + errors: [ + { + messageId: 'preferCSSAttributeForEuiComponents', + }, + ], + output: ` + import React from 'react'; + + function TestComponent() { + return ( + This is a test + ) + }`, + }, +]; + +const valid: RuleTester.ValidTestCase[] = [ + { + name: invalid[0].name, + filename: invalid[0].filename, + code: invalid[0].output as string, + }, +]; + +for (const [name, tester] of [tsTester, babelTester]) { + describe(name, () => { + tester.run('@kbn/prefer_css_attribute_for_eui_components', PreferCSSAttributeForEuiComponents, { + valid, + invalid, + }); + }); +} diff --git a/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.ts b/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.ts new file mode 100644 index 0000000000000..f2b8bfd7b7d74 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/src/rules/prefer_css_attribute_for_eui_components.ts @@ -0,0 +1,62 @@ +/* + * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import type { Rule } from 'eslint'; +import type { TSESTree } from '@typescript-eslint/typescript-estree'; +import type { Identifier, Node } from 'estree'; + +export const PreferCSSAttributeForEuiComponents: Rule.RuleModule = { + meta: { + type: 'suggestion', + docs: { + description: 'Prefer the JSX css attribute for EUI components', + category: 'Best Practices', + recommended: true, + }, + messages: { + preferCSSAttributeForEuiComponents: 'Prefer the css attribute for EUI components', + }, + fixable: 'code', + schema: [], + }, + create(context) { + const isNamedEuiComponentRegex = /^Eui[A-Z]*/; + + return { + JSXOpeningElement(node: TSESTree.JSXOpeningElement) { + if (isNamedEuiComponentRegex.test((node.name as unknown as Identifier).name)) { + let styleAttrNode: TSESTree.JSXAttribute | undefined; + + if ( + // @ts-expect-error the returned result is somehow typed as a union of JSXAttribute and JSXAttributeSpread + (styleAttrNode = node.attributes.find( + (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'style' + )) + ) { + context.report({ + node: styleAttrNode?.parent! as Node, + messageId: 'preferCSSAttributeForEuiComponents', + fix(fixer) { + const cssAttr = node.attributes.find( + (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'css' + ); + + if (cssAttr) { + return null; + } + + return fixer.replaceTextRange(styleAttrNode?.name?.range!, 'css'); + }, + }); + } + } + }, + }; + }, +}; diff --git a/packages/kbn-eslint-plugin-css/tsconfig.json b/packages/kbn-eslint-plugin-css/tsconfig.json new file mode 100644 index 0000000000000..a6dec1c1a62c5 --- /dev/null +++ b/packages/kbn-eslint-plugin-css/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": ["jest", "node"], + "lib": ["es2021"] + }, + "include": ["**/*.ts"], + "exclude": ["target/**/*"], + "kbn_references": [] +} diff --git a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/__fixtures__/ftr_report.xml b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/__fixtures__/ftr_report.xml index 07f1e79b0f5df..77c0d7691d22d 100644 --- a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/__fixtures__/ftr_report.xml +++ b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/__fixtures__/ftr_report.xml @@ -1,7 +1,7 @@ - + - + - + - + { ‹?xml version="1.0" encoding="utf-8"?› ‹testsuites name="ftr" timestamp="2019-06-05T23:37:10" time="903.670" tests="129" failures="5" skipped="71" command-line="node scripts/functional_tests --config=x-pack/test/api_integration/apis/status/config.ts"› ‹testsuite timestamp="2019-06-05T23:37:10" time="903.670" tests="129" failures="5" skipped="71" command-line="node scripts/functional_tests --config=x-pack/test/api_integration/apis/status/config.ts"› - ‹testcase name="maps app maps loaded from sample data ecommerce "before all" hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps/sample_data·js" time="154.378"› + ‹testcase name="maps app maps loaded from sample data ecommerce "before all" hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps/sample_data·js" time="154.378" owners="elastic/kibana-presentation"› - ‹system-out› - ‹![CDATA[[00:00:00] │ + ‹system-out›Failed Tests Reporter: @@ -88,7 +88,7 @@ it('rewrites ftr reports with minimal changes', async () => { + at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13) ‹/failure› ‹/testcase› - ‹testcase name="maps app "after all" hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179" metadata-json="{"messages":["foo"],"screenshots":[{"name":"failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]","url":"https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png"}]}"› + ‹testcase name="maps app "after all" hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179" metadata-json="{"messages":["foo"],"screenshots":[{"name":"failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]","url":"https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png"}]}" owners="elastic/kibana-presentation"› ‹system-out› - ‹![CDATA[[00:00:00] │ + [00:00:00] │ @@ -106,7 +106,7 @@ it('rewrites ftr reports with minimal changes', async () => { + at process._tickCallback (internal/process/next_tick.js:68:7) name: 'NoSuchSessionError', remoteStacktrace: '' } ‹/failure› ‹/testcase› - ‹testcase name="InfraOps app feature controls infrastructure security global infrastructure all privileges shows infrastructure navlink" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/infra/feature_controls/infrastructure_security·ts"› + ‹testcase name="InfraOps app feature controls infrastructure security global infrastructure all privileges shows infrastructure navlink" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/infra/feature_controls/infrastructure_security·ts" owners="elastic/kibana-presentation"› ‹system-out› - ‹![CDATA[[00:00:00] │ + [00:00:00] │ @@ -117,7 +117,7 @@ it('rewrites ftr reports with minimal changes', async () => { ‹/system-out› ‹skipped/› ‹/testcase› - ‹testcase name="machine learning anomaly detection saved search with lucene query job creation opens the advanced section" classname="Firefox XPack UI Functional Tests.x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job·ts" time="6.040"› + ‹testcase name="machine learning anomaly detection saved search with lucene query job creation opens the advanced section" classname="Firefox XPack UI Functional Tests.x-pack/test/functional/apps/machine_learning/anomaly_detection/saved_search_job·ts" time="6.040" owners="elastic/ml-ui"› - ‹system-out›‹![CDATA[[00:21:57] └-: machine learning...]]›‹/system-out› - ‹failure›‹![CDATA[{ NoSuchSessionError: Tried to run command without establishing a connection + ‹system-out›[00:21:57] └-: machine learning...‹/system-out› diff --git a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.test.ts b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.test.ts index b00ef8cb6bc49..52d2858232d52 100644 --- a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.test.ts +++ b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.test.ts @@ -28,6 +28,7 @@ it('discovers failures in ftr report', async () => { ", "likelyIrrelevant": false, "name": "maps app maps loaded from sample data ecommerce \\"before all\\" hook", + "owners": "elastic/kibana-presentation", "system-out": " [00:00:00] │ [00:07:04] └-: maps app @@ -49,6 +50,7 @@ it('discovers failures in ftr report', async () => { "likelyIrrelevant": true, "metadata-json": "{\\"messages\\":[\\"foo\\"],\\"screenshots\\":[{\\"name\\":\\"failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]\\",\\"url\\":\\"https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png\\"}]}", "name": "maps app \\"after all\\" hook", + "owners": "elastic/kibana-presentation", "system-out": " [00:00:00] │ [00:07:04] └-: maps app @@ -67,6 +69,7 @@ it('discovers failures in ftr report', async () => { at process._tickCallback (internal/process/next_tick.js:68:7) name: 'NoSuchSessionError', remoteStacktrace: '' }", "likelyIrrelevant": true, "name": "machine learning anomaly detection saved search with lucene query job creation opens the advanced section", + "owners": "elastic/ml-ui", "system-out": "[00:21:57] └-: machine learning...", "time": "6.040", }, @@ -87,6 +90,7 @@ it('discovers failures in jest report', async () => { ", "likelyIrrelevant": false, "name": "launcher can reconnect if process died", + "owners": undefined, "system-out": "", "time": "7.060", }, @@ -116,6 +120,7 @@ it('discovers failures in mocha report', async () => { ", "likelyIrrelevant": true, "name": "code in multiple nodes \\"before all\\" hook", + "owners": undefined, "system-out": " ", @@ -131,6 +136,7 @@ it('discovers failures in mocha report', async () => { ", "likelyIrrelevant": true, "name": "code in multiple nodes \\"after all\\" hook", + "owners": undefined, "system-out": " ", diff --git a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.ts b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.ts index dd5e846dfc01e..d65773810ddf4 100644 --- a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.ts +++ b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/get_failures.ts @@ -18,6 +18,7 @@ export type TestFailure = FailedTestCase['$'] & { githubIssue?: string; failureCount?: number; commandLine?: string; + owners?: any; }; const getText = (node?: Array) => { @@ -78,6 +79,7 @@ export function getFailures(report: TestReport) { for (const testCase of makeFailedTestCaseIter(report)) { const failure = getText(testCase.failure); const likelyIrrelevant = isLikelyIrrelevant(testCase.$.name, failure); + const owners = testCase.$.owners; const failureObj = { // unwrap xml weirdness @@ -87,6 +89,7 @@ export function getFailures(report: TestReport) { likelyIrrelevant, 'system-out': getText(testCase['system-out']), commandLine, + owners, }; // cleaning up duplicates diff --git a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/report_failures_to_file.ts b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/report_failures_to_file.ts index b1e3997ebf030..049aff3dcdef1 100644 --- a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/report_failures_to_file.ts +++ b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/report_failures_to_file.ts @@ -179,6 +179,12 @@ export async function reportFailuresToFile( ` : '' } +
+ Owners: +
${escape(
+                  failure?.owners ? (failure?.owners as string) : 'Unable to determine code owners'
+                )}
+
Failures in tracked branches: ${failure.failureCount || 0} diff --git a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/test_report.ts b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/test_report.ts index e56e4a6810efd..6467cfaab14be 100644 --- a/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/test_report.ts +++ b/packages/kbn-failed-test-reporter-cli/failed_tests_reporter/test_report.ts @@ -11,7 +11,6 @@ import Fs from 'fs'; import { promisify } from 'util'; import xml2js from 'xml2js'; - const readAsync = promisify(Fs.readFile); export type TestReport = @@ -40,6 +39,8 @@ export interface TestSuite { 'metadata-json'?: string; /* the command that ran this suite */ 'command-line'?: string; + /* the codeowners of the file */ + owners?: string; }; testcase?: TestCase[]; } @@ -56,6 +57,8 @@ export interface TestCase { 'metadata-json'?: string; /* the command that ran this suite */ 'command-line'?: string; + /* the codeowners of the file */ + owners?: string; }; /* contents of system-out elements */ 'system-out'?: Array; diff --git a/packages/kbn-health-gateway-server/src/server/server_config.test.ts b/packages/kbn-health-gateway-server/src/server/server_config.test.ts index 0ef93e6daa3cb..fd04fcc09e6f6 100644 --- a/packages/kbn-health-gateway-server/src/server/server_config.test.ts +++ b/packages/kbn-health-gateway-server/src/server/server_config.test.ts @@ -56,7 +56,6 @@ describe('server config', () => { "enabled": false, "keystore": Object {}, "supportedProtocols": Array [ - "TLSv1.1", "TLSv1.2", "TLSv1.3", ], diff --git a/packages/kbn-relocate/README.md b/packages/kbn-relocate/README.md index 899a5e9b97970..06a04067a26a2 100644 --- a/packages/kbn-relocate/README.md +++ b/packages/kbn-relocate/README.md @@ -8,12 +8,9 @@ You must have `gh` CLI tool installed. You can install it by running: ```sh brew install gh +gh auth login ``` -You must have `elastic/kibana` remote configured under the name `upstream`. - -You must have a remote named `origin` pointing to your fork of the Kibana repo. - ## Usage First of all, you need to decide whether you want to contribute to an existing PR or to create a new one. Use the `--pr` flag to specify the PR you are trying to update: diff --git a/packages/kbn-relocate/constants.ts b/packages/kbn-relocate/constants.ts index 059c32004370e..5b5f4099b782b 100644 --- a/packages/kbn-relocate/constants.ts +++ b/packages/kbn-relocate/constants.ts @@ -13,13 +13,26 @@ export const BASE_FOLDER = process.cwd() + '/'; export const BASE_FOLDER_DEPTH = process.cwd().split('/').length; export const KIBANA_FOLDER = process.cwd().split('/').pop()!; export const EXCLUDED_MODULES = ['@kbn/core']; -export const TARGET_FOLDERS = [ - 'src/platform/plugins/', - 'src/platform/packages/', - 'x-pack/platform/plugins/', - 'x-pack/platform/packages/', - 'x-pack/solutions/', -]; +export const TARGET_FOLDERS: Record = { + 'platform:private': [ + 'src/platform/packages/private/', + 'src/platform/plugins/private/', + 'x-pack/platform/packages/private/', + 'x-pack/platform/plugins/private/', + ], + 'platform:shared': [ + 'src/platform/packages/shared/', + 'src/platform/plugins/shared/', + 'x-pack/platform/packages/shared/', + 'x-pack/platform/plugins/shared/', + ], + 'observability:private': [ + 'x-pack/solutions/observability/packages/', + 'x-pack/solutions/observability/plugins/', + ], + 'search:private': ['x-pack/solutions/search/packages/', 'x-pack/solutions/search/plugins/'], + 'security:private': ['x-pack/solutions/security/packages/', 'x-pack/solutions/security/plugins/'], +}; export const EXTENSIONS = [ 'eslintignore', 'gitignore', diff --git a/packages/kbn-relocate/index.ts b/packages/kbn-relocate/index.ts index cddaa307ab7b6..12f89a29275e6 100644 --- a/packages/kbn-relocate/index.ts +++ b/packages/kbn-relocate/index.ts @@ -46,15 +46,17 @@ export const runKbnRelocateCli = () => { await findAndMoveModule(flags.moveOnly, log); } else { const { pr, team, path, include, exclude, baseBranch } = flags; - await findAndRelocateModules({ - prNumber: toOptString('prNumber', pr), - baseBranch: toOptString('baseBranch', baseBranch, 'main')!, - teams: toStringArray(team), - paths: toStringArray(path), - included: toStringArray(include), - excluded: toStringArray(exclude), - log, - }); + await findAndRelocateModules( + { + prNumber: toOptString('prNumber', pr), + baseBranch: toOptString('baseBranch', baseBranch, 'main')!, + teams: toStringArray(team), + paths: toStringArray(path), + included: toStringArray(include), + excluded: toStringArray(exclude), + }, + log + ); } }, { diff --git a/packages/kbn-relocate/relocate.ts b/packages/kbn-relocate/relocate.ts index dde0c83fc096e..fe2537ddeb040 100644 --- a/packages/kbn-relocate/relocate.ts +++ b/packages/kbn-relocate/relocate.ts @@ -16,22 +16,17 @@ import type { ToolingLog } from '@kbn/tooling-log'; import { getPackages } from '@kbn/repo-packages'; import { REPO_ROOT } from '@kbn/repo-info'; import type { Package } from './types'; -import { - DESCRIPTION, - EXCLUDED_MODULES, - KIBANA_FOLDER, - NEW_BRANCH, - TARGET_FOLDERS, -} from './constants'; +import { DESCRIPTION, EXCLUDED_MODULES, KIBANA_FOLDER, NEW_BRANCH } from './constants'; import { belongsTo, calculateModuleTargetFolder, + isInTargetFolder, replaceReferences, replaceRelativePaths, -} from './utils.relocate'; -import { safeExec } from './utils.exec'; -import { relocatePlan, relocateSummary } from './utils.logging'; -import { checkoutBranch, checkoutResetPr } from './utils.git'; +} from './utils/relocate'; +import { safeExec } from './utils/exec'; +import { relocatePlan, relocateSummary } from './utils/logging'; +import { checkoutBranch, checkoutResetPr, findGithubLogin, findRemoteName } from './utils/git'; const moveModule = async (module: Package, log: ToolingLog) => { const destination = calculateModuleTargetFolder(module); @@ -52,11 +47,6 @@ const relocateModules = async (toMove: Package[], log: ToolingLog): Promise module.directory.includes(folder))) { - log.warning(`The module ${module.id} is already in a "sustainable" folder. Skipping`); - // skip modules that are already moved - continue; - } log.info(''); log.info('--------------------------------------------------------------------------------'); log.info(`\t${module.id} (${i + 1} of ${toMove.length})`); @@ -93,10 +83,9 @@ export interface RelocateModulesParams { paths: string[]; included: string[]; excluded: string[]; - log: ToolingLog; } -const findModules = ({ teams, paths, included, excluded }: FindModulesParams) => { +const findModules = ({ teams, paths, included, excluded }: FindModulesParams, log: ToolingLog) => { // get all modules const modules = getPackages(REPO_ROOT); @@ -123,13 +112,14 @@ const findModules = ({ teams, paths, included, excluded }: FindModulesParams) => paths.some((path) => module.directory.includes(path)) ) // the module is not explicitly excluded - .filter(({ id }) => !excluded.includes(id)), - 'id' + .filter(({ id }) => !excluded.includes(id)) + // exclude modules that are in the correct folder + .filter((module) => !isInTargetFolder(module, log)) ); }; export const findAndMoveModule = async (moduleId: string, log: ToolingLog) => { - const modules = findModules({ teams: [], paths: [], included: [moduleId], excluded: [] }); + const modules = findModules({ teams: [], paths: [], included: [moduleId], excluded: [] }, log); if (!modules.length) { log.warning(`Cannot move ${moduleId}, either not found or not allowed!`); } else { @@ -137,10 +127,24 @@ export const findAndMoveModule = async (moduleId: string, log: ToolingLog) => { } }; -export const findAndRelocateModules = async (params: RelocateModulesParams) => { - const { prNumber, log, baseBranch, ...findParams } = params; +export const findAndRelocateModules = async (params: RelocateModulesParams, log: ToolingLog) => { + const upstream = await findRemoteName('elastic/kibana'); + if (!upstream) { + log.error( + 'This repository does not have a remote pointing to the elastic/kibana repository. Aborting' + ); + return; + } + + const origin = await findRemoteName(`${await findGithubLogin()}/kibana`); + if (!origin) { + log.error('This repository does not have a remote pointing to your Kibana fork. Aborting'); + return; + } + + const { prNumber, baseBranch, ...findParams } = params; - const toMove = findModules(findParams); + const toMove = findModules(findParams, log); if (!toMove.length) { log.info( `No packages match the specified filters. Please tune your '--path' and/or '--team' and/or '--include' flags` @@ -164,7 +168,7 @@ export const findAndRelocateModules = async (params: RelocateModulesParams) => { await safeExec(`git restore --staged .`); await safeExec(`git restore .`); await safeExec(`git clean -f -d`); - await safeExec(`git checkout ${baseBranch} && git pull upstream ${baseBranch}`); + await safeExec(`git checkout ${baseBranch} && git pull ${upstream} ${baseBranch}`); if (prNumber) { // checkout existing PR, reset all commits, rebase from baseBranch @@ -204,7 +208,7 @@ export const findAndRelocateModules = async (params: RelocateModulesParams) => { const pushCmd = prNumber ? `git push --force-with-lease` - : `git push --set-upstream origin ${NEW_BRANCH}`; + : `git push --set-upstream ${origin} ${NEW_BRANCH}`; if (!res2.pushBranch) { log.info(`Remember to push changes with "${pushCmd}"`); diff --git a/packages/kbn-relocate/utils.exec.ts b/packages/kbn-relocate/utils/exec.ts similarity index 100% rename from packages/kbn-relocate/utils.exec.ts rename to packages/kbn-relocate/utils/exec.ts diff --git a/packages/kbn-relocate/utils.git.ts b/packages/kbn-relocate/utils/git.ts similarity index 81% rename from packages/kbn-relocate/utils.git.ts rename to packages/kbn-relocate/utils/git.ts index 4f002772528fd..f2e529bee6d0f 100644 --- a/packages/kbn-relocate/utils.git.ts +++ b/packages/kbn-relocate/utils/git.ts @@ -8,8 +8,26 @@ */ import inquirer from 'inquirer'; -import type { Commit, PullRequest } from './types'; -import { safeExec } from './utils.exec'; +import type { Commit, PullRequest } from '../types'; +import { safeExec } from './exec'; + +export const findRemoteName = async (repo: string) => { + const res = await safeExec('git remote -v'); + const remotes = res.stdout.split('\n').map((line) => line.split(/\t| /).filter(Boolean)); + return remotes.find(([_, url]) => url.includes(`github.com/${repo}`))?.[0]; +}; + +export const findGithubLogin = async () => { + const res = await safeExec('gh auth status'); + // e.g. ✓ Logged in to github.com account gsoldevila (/Users/gsoldevila/.config/gh/hosts.yml) + const loginLine = res.stdout + .split('\n') + .find((line) => line.includes('Logged in')) + ?.split(/\t| /) + .filter(Boolean); + + return loginLine?.[loginLine?.findIndex((fragment) => fragment === 'account') + 1]; +}; export const findPr = async (number: string): Promise => { const res = await safeExec(`gh pr view ${number} --json commits,headRefName`); diff --git a/packages/kbn-relocate/utils.logging.ts b/packages/kbn-relocate/utils/logging.ts similarity index 96% rename from packages/kbn-relocate/utils.logging.ts rename to packages/kbn-relocate/utils/logging.ts index 5b290292dd75e..742610dfe1de6 100644 --- a/packages/kbn-relocate/utils.logging.ts +++ b/packages/kbn-relocate/utils/logging.ts @@ -10,8 +10,8 @@ import type { ToolingLog } from '@kbn/tooling-log'; import { appendFileSync, writeFileSync } from 'fs'; import dedent from 'dedent'; -import type { Package } from './types'; -import { calculateModuleTargetFolder } from './utils.relocate'; +import type { Package } from '../types'; +import { calculateModuleTargetFolder } from './relocate'; import { BASE_FOLDER, DESCRIPTION, @@ -19,7 +19,7 @@ import { SCRIPT_ERRORS, UPDATED_REFERENCES, UPDATED_RELATIVE_PATHS, -} from './constants'; +} from '../constants'; export const relocatePlan = (modules: Package[], log: ToolingLog) => { const plugins = modules.filter((module) => module.manifest.type === 'plugin'); diff --git a/packages/kbn-relocate/utils.relocate.ts b/packages/kbn-relocate/utils/relocate.ts similarity index 84% rename from packages/kbn-relocate/utils.relocate.ts rename to packages/kbn-relocate/utils/relocate.ts index 15121fefd344a..2f2b6a78379e6 100644 --- a/packages/kbn-relocate/utils.relocate.ts +++ b/packages/kbn-relocate/utils/relocate.ts @@ -10,7 +10,7 @@ import { join } from 'path'; import type { ToolingLog } from '@kbn/tooling-log'; import { orderBy } from 'lodash'; -import type { Package } from './types'; +import type { Package } from '../types'; import { applyTransforms } from './transforms'; import { BASE_FOLDER, @@ -22,8 +22,8 @@ import { TARGET_FOLDERS, UPDATED_REFERENCES, UPDATED_RELATIVE_PATHS, -} from './constants'; -import { quietExec, safeExec } from './utils.exec'; +} from '../constants'; +import { quietExec, safeExec } from './exec'; export const belongsTo = (module: Package, owner: string): boolean => { return Array.from(module.manifest.owner)[0] === owner; @@ -40,11 +40,18 @@ export const calculateModuleTargetFolder = (module: Package): string => { const isPlugin = module.manifest.type === 'plugin'; const fullPath = join(BASE_FOLDER, module.directory); let moduleDelimiter = isPlugin ? '/plugins/' : '/packages/'; - if (TARGET_FOLDERS.some((folder) => module.directory.includes(folder)) && group === 'platform') { - // if a platform module has already been relocated, strip the /private/ or /shared/ part too - moduleDelimiter += `${module.visibility}/`; + + // for platform modules that are in a sustainable folder, strip the /private/ or /shared/ part too + if (module.directory.includes(`${moduleDelimiter}private/`)) { + moduleDelimiter += 'private/'; + } else if (module.directory.includes(`${moduleDelimiter}shared/`)) { + moduleDelimiter += 'shared/'; } - const moduleFolder = fullPath.split(moduleDelimiter).pop()!; + + const chunks = fullPath.split(moduleDelimiter); + chunks.shift(); // remove the base path up to '/packages/' or '/plugins/' + const moduleFolder = chunks.join(moduleDelimiter); // in case there's an extra /packages/ or /plugins/ folder + let path: string; if (group === 'platform') { @@ -79,6 +86,26 @@ export const calculateModuleTargetFolder = (module: Package): string => { return applyTransforms(module, path); }; +export const isInTargetFolder = (module: Package, log: ToolingLog): boolean => { + if (!module.group || !module.visibility) { + log.warning(`The module '${module.id}' is missing the group/visibility information`); + return true; + } + + const baseTargetFolders = TARGET_FOLDERS[`${module.group}:${module.visibility}`]; + const baseTargetFolder = baseTargetFolders.find((candidate) => { + return module.directory.includes(candidate); + }); + if (baseTargetFolder) { + log.info( + `The module ${module.id} is already in the correct folder: '${baseTargetFolder}'. Skipping` + ); + return true; + } + + return false; +}; + export const replaceReferences = async (module: Package, destination: string, log: ToolingLog) => { const dir = module.directory; const source = diff --git a/packages/kbn-relocate/transforms.ts b/packages/kbn-relocate/utils/transforms.ts similarity index 97% rename from packages/kbn-relocate/transforms.ts rename to packages/kbn-relocate/utils/transforms.ts index 72f57a24daa00..ed584abeb55ab 100644 --- a/packages/kbn-relocate/transforms.ts +++ b/packages/kbn-relocate/utils/transforms.ts @@ -7,7 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import type { Package } from './types'; +import type { Package } from '../types'; type TransformFunction = (param: string) => string; const TRANSFORMS: Record = { diff --git a/packages/kbn-server-http-tools/src/ssl/ssl_config.ts b/packages/kbn-server-http-tools/src/ssl/ssl_config.ts index 4385f954c3306..bf184f4075625 100644 --- a/packages/kbn-server-http-tools/src/ssl/ssl_config.ts +++ b/packages/kbn-server-http-tools/src/ssl/ssl_config.ts @@ -52,7 +52,7 @@ export const sslSchema = schema.object( schema.literal(TLS_V1_2), schema.literal(TLS_V1_3), ]), - { defaultValue: [TLS_V1_1, TLS_V1_2, TLS_V1_3], minSize: 1 } + { defaultValue: [TLS_V1_2, TLS_V1_3], minSize: 1 } ), clientAuthentication: schema.oneOf( [schema.literal('none'), schema.literal('optional'), schema.literal('required')], diff --git a/packages/kbn-test/src/jest/setup/react_testing_library.js b/packages/kbn-test/src/jest/setup/react_testing_library.js index d8994fdbe00e4..7b184485df1cb 100644 --- a/packages/kbn-test/src/jest/setup/react_testing_library.js +++ b/packages/kbn-test/src/jest/setup/react_testing_library.js @@ -36,6 +36,11 @@ jest.mock('@testing-library/react', () => { }; }); +const consoleFilters = [ + /^The above error occurred in the <.*?> component:/, // error boundary output + /^Error: Uncaught .+/, // jsdom output +]; + // This is a workaround to run tests with React 17 and the latest @testing-library/react // And prevent the act warnings that were supposed to be muted by @testing-library // The testing library mutes the act warnings in some cases by setting IS_REACT_ACT_ENVIRONMENT which is React@18 feature https://github.com/testing-library/react-testing-library/pull/1137/ @@ -44,14 +49,27 @@ jest.mock('@testing-library/react', () => { // NOTE: we're not muting all the act warnings but only those that testing-library wanted to mute const originalConsoleError = console.error; console.error = (...args) => { + const message = args[0]?.toString(); + if (global.IS_REACT_ACT_ENVIRONMENT === false) { - if ( - args[0].toString().includes('Warning: An update to %s inside a test was not wrapped in act') - ) { + if (message.includes('Warning: An update to %s inside a test was not wrapped in act')) { return; } } + // Additionally this is a restoration of the original console.error suppression + // expected by the usage of renderHook from react-hooks-testing-library + // which has been moved into latest react-testing-library but the suppression + // of the console.error was not moved with it. + // + // So adding by example from the original implementation: + // https://github.com/testing-library/react-hooks-testing-library/blob/1e01273374af4e48a0feb1f2233bf6c76d742167/src/core/console.ts + // with a slight modification to catch non-string errors as well + + if (message && consoleFilters.some((filter) => filter.test(message))) { + return; + } + originalConsoleError(...args); }; diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 2875d8312cc8e..2f48edce25487 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -59,7 +59,7 @@ export const storybookAliases = { 'x-pack/solutions/observability/plugins/observability_ai_assistant_app/.storybook', observability_inventory: 'x-pack/plugins/observability_solution/inventory/.storybook', observability_shared: 'x-pack/plugins/observability_solution/observability_shared/.storybook', - observability_slo: 'x-pack/plugins/observability_solution/slo/.storybook', + observability_slo: 'x-pack/solutions/observability/plugins/slo/.storybook', presentation: 'src/plugins/presentation_util/storybook', random_sampling: 'x-pack/packages/kbn-random-sampling/.storybook', esql_editor: 'src/platform/packages/private/kbn-esql-editor/.storybook', @@ -67,7 +67,7 @@ export const storybookAliases = { security_solution_packages: 'x-pack/solutions/security/packages/storybook/config', serverless: 'packages/serverless/storybook/config', shared_ux: 'packages/shared-ux/storybook/config', - slo: 'x-pack/plugins/observability_solution/slo/.storybook', + slo: 'x-pack/solutions/observability/plugins/slo/.storybook', threat_intelligence: 'x-pack/solutions/security/plugins/threat_intelligence/.storybook', triggers_actions_ui: 'x-pack/plugins/triggers_actions_ui/.storybook', ui_actions_enhanced: 'src/plugins/ui_actions_enhanced/.storybook', diff --git a/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.test.ts index 61fdd931ca7bb..b6bab193200c5 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.test.ts @@ -224,12 +224,13 @@ describe('literal', () => { const node = Builder.expression.literal.string('abc'); const text = BasicPrettyPrinter.expression(node); - expect(text).toBe('"""abc"""'); + expect(text).toBe('"abc"'); expect(node).toMatchObject({ type: 'literal', literalType: 'keyword', - name: '"""abc"""', - value: '"""abc"""', + name: '"abc"', + value: '"abc"', + valueUnquoted: 'abc', }); }); }); @@ -260,7 +261,7 @@ describe('literal', () => { }); const text = BasicPrettyPrinter.expression(node); - expect(text).toBe('["""a""", """b""", """c"""]'); + expect(text).toBe('["a", "b", "c"]'); }); test('integer list', () => { diff --git a/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.ts b/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.ts index 44e404609ffd6..7988b0e953559 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/builder/builder.ts @@ -32,10 +32,10 @@ import { ESQLParamLiteral, ESQLFunction, ESQLAstItem, + ESQLStringLiteral, ESQLBinaryExpression, ESQLUnaryExpression, ESQLTimeInterval, - ESQLStringLiteral, ESQLBooleanLiteral, ESQLNullLiteral, } from '../types'; @@ -368,26 +368,6 @@ export namespace Builder { ) as ESQLDecimalLiteral; }; - export const string = ( - value: string, - template?: Omit, 'name' | 'literalType'>, - fromParser?: Partial - ): ESQLStringLiteral => { - // TODO: Once (https://github.com/elastic/kibana/issues/203445) do not use - // triple quotes and escape the string. - const quotedValue = '"""' + value + '"""'; - const node: ESQLStringLiteral = { - ...template, - ...Builder.parserFields(fromParser), - type: 'literal', - literalType: 'keyword', - name: quotedValue, - value: quotedValue, - }; - - return node; - }; - /** * Constructs "time interval" literal node. * @@ -407,6 +387,38 @@ export namespace Builder { }; }; + export const string = ( + valueUnquoted: string, + template?: Omit< + AstNodeTemplate, + 'name' | 'literalType' | 'value' | 'valueUnquoted' + > & + Partial>, + fromParser?: Partial + ): ESQLStringLiteral => { + const value = + '"' + + valueUnquoted + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\t/g, '\\t') + + '"'; + const name = template?.name ?? value; + const node: ESQLStringLiteral = { + ...template, + ...Builder.parserFields(fromParser), + type: 'literal', + literalType: 'keyword', + name, + value, + valueUnquoted, + }; + + return node; + }; + export const list = ( template: Omit, 'name'>, fromParser?: Partial diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/commands.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/commands.test.ts index 865d8ef64e272..9fc53e9790c36 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/commands.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/commands.test.ts @@ -286,7 +286,9 @@ describe('commands', () => { }, { type: 'literal', - value: '"b"', + literalType: 'keyword', + name: '"b"', + valueUnquoted: 'b', }, { type: 'option', @@ -294,7 +296,9 @@ describe('commands', () => { args: [ { type: 'literal', - value: '"c"', + literalType: 'keyword', + name: '"c"', + valueUnquoted: 'c', }, ], }, @@ -303,6 +307,31 @@ describe('commands', () => { ]); }); + it('DISSECT (no options)', () => { + const query = 'FROM index | DISSECT a "b"'; + const { ast } = parse(query); + + expect(ast).toMatchObject([ + {}, + { + type: 'command', + name: 'dissect', + args: [ + { + type: 'column', + name: 'a', + }, + { + type: 'literal', + literalType: 'keyword', + name: '"b"', + valueUnquoted: 'b', + }, + ], + }, + ]); + }); + it('GROK', () => { const query = 'FROM index | GROK a "b"'; const { ast } = parse(query); @@ -319,7 +348,9 @@ describe('commands', () => { }, { type: 'literal', - value: '"b"', + literalType: 'keyword', + name: '"b"', + valueUnquoted: 'b', }, ], }, diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/literal.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/literal.test.ts index ac2914a55422e..71ae3603c9c20 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/literal.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/__tests__/literal.test.ts @@ -26,8 +26,8 @@ describe('literal expression', () => { it('numeric expression captures "value", and "name" fields', () => { const text = 'ROW 1'; - const { ast } = parse(text); - const literal = ast[0].args[0] as ESQLLiteral; + const { root } = parse(text); + const literal = root.commands[0].args[0] as ESQLLiteral; expect(literal).toMatchObject({ type: 'literal', @@ -39,9 +39,9 @@ describe('literal expression', () => { it('doubles vs integers', () => { const text = 'ROW a(1.0, 1)'; - const { ast } = parse(text); + const { root } = parse(text); - expect(ast[0]).toMatchObject({ + expect(root.commands[0]).toMatchObject({ type: 'command', args: [ { @@ -61,54 +61,117 @@ describe('literal expression', () => { }); }); - // TODO: Un-skip once string parsing fixed: https://github.com/elastic/kibana/issues/203445 - it.skip('single-quoted string', () => { - const text = 'ROW "abc"'; - const { root } = parse(text); + describe('string', () => { + describe('single quoted', () => { + it('empty string', () => { + const text = 'ROW "", 1'; + const { root } = parse(text); - expect(root.commands[0]).toMatchObject({ - type: 'command', - args: [ - { - type: 'literal', - literalType: 'keyword', - value: 'abc', - }, - ], - }); - }); + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '""', + valueUnquoted: '', + }, + {}, + ], + }); + }); - // TODO: Un-skip once string parsing fixed: https://github.com/elastic/kibana/issues/203445 - it.skip('unescapes characters', () => { - const text = 'ROW "a\\nbc"'; - const { root } = parse(text); + it('short string', () => { + const text = 'ROW "abc", 1'; + const { root } = parse(text); - expect(root.commands[0]).toMatchObject({ - type: 'command', - args: [ - { - type: 'literal', - literalType: 'keyword', - value: 'a\nbc', - }, - ], + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '"abc"', + valueUnquoted: 'abc', + }, + {}, + ], + }); + }); + + it('escaped characters', () => { + const text = 'ROW "a\\nb\\tc\\rd\\\\e\\"f", 1'; + const { root } = parse(text); + + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '"a\\nb\\tc\\rd\\\\e\\"f"', + valueUnquoted: 'a\nb\tc\rd\\e"f', + }, + {}, + ], + }); + }); }); - }); - // TODO: Un-skip once string parsing fixed: https://github.com/elastic/kibana/issues/203445 - it.skip('triple-quoted string', () => { - const text = 'ROW """abc"""'; - const { root } = parse(text); + describe('triple quoted', () => { + it('empty string', () => { + const text = 'ROW """""", 1'; + const { root } = parse(text); - expect(root.commands[0]).toMatchObject({ - type: 'command', - args: [ - { - type: 'literal', - literalType: 'keyword', - value: 'abc', - }, - ], + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '""""""', + valueUnquoted: '', + }, + {}, + ], + }); + }); + + it('short string', () => { + const text = 'ROW """abc""", 1'; + const { root } = parse(text); + + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '"""abc"""', + valueUnquoted: 'abc', + }, + {}, + ], + }); + }); + + it('characters are not escaped', () => { + const text = 'ROW """a\\nb\\c\\"d""", 1'; + const { root } = parse(text); + + expect(root.commands[0]).toMatchObject({ + type: 'command', + args: [ + { + type: 'literal', + literalType: 'keyword', + name: '"""a\\nb\\c\\"d"""', + valueUnquoted: 'a\\nb\\c\\"d', + }, + {}, + ], + }); + }); }); }); }); diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/esql_ast_builder_listener.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/esql_ast_builder_listener.ts index e167a55f1b682..ea9201b800721 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/parser/esql_ast_builder_listener.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/esql_ast_builder_listener.ts @@ -50,8 +50,6 @@ import { visitByOption, collectAllColumnIdentifiers, visitRenameClauses, - visitDissect, - visitGrok, collectBooleanExpression, visitOrderExpressions, getPolicyName, @@ -60,6 +58,8 @@ import { } from './walkers'; import type { ESQLAst, ESQLAstMetricsCommand } from '../types'; import { createJoinCommand } from './factories/join'; +import { createDissectCommand } from './factories/dissect'; +import { createGrokCommand } from './factories/grok'; export class ESQLAstBuilderListener implements ESQLParserListener { private ast: ESQLAst = []; @@ -262,9 +262,9 @@ export class ESQLAstBuilderListener implements ESQLParserListener { * @param ctx the parse tree */ exitDissectCommand(ctx: DissectCommandContext) { - const command = createCommand('dissect', ctx); + const command = createDissectCommand(ctx); + this.ast.push(command); - command.args.push(...visitDissect(ctx)); } /** @@ -272,9 +272,9 @@ export class ESQLAstBuilderListener implements ESQLParserListener { * @param ctx the parse tree */ exitGrokCommand(ctx: GrokCommandContext) { - const command = createCommand('grok', ctx); + const command = createGrokCommand(ctx); + this.ast.push(command); - command.args.push(...visitGrok(ctx)); } /** diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/factories.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/factories.ts index df30e596993ea..0db09c0f9dfa7 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/parser/factories.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/factories.ts @@ -32,6 +32,7 @@ import { InputParamContext, InputNamedOrPositionalParamContext, IdentifierOrParameterContext, + StringContext, } from '../antlr/esql_parser'; import { DOUBLE_TICKS_REGEX, SINGLE_BACKTICK, TICKS_REGEX } from './constants'; import type { @@ -119,6 +120,29 @@ export function createFakeMultiplyLiteral( }; } +export function createLiteralString(ctx: StringContext): ESQLLiteral { + const quotedString = ctx.QUOTED_STRING()?.getText() ?? '""'; + const isTripleQuoted = quotedString.startsWith('"""') && quotedString.endsWith('"""'); + let valueUnquoted = isTripleQuoted ? quotedString.slice(3, -3) : quotedString.slice(1, -1); + + if (!isTripleQuoted) { + valueUnquoted = valueUnquoted + .replace(/\\\\/g, '\\') + .replace(/\\"/g, '"') + .replace(/\\r/g, '\r') + .replace(/\\n/g, '\n') + .replace(/\\t/g, '\t'); + } + + return Builder.expression.literal.string( + valueUnquoted, + { + name: quotedString, + }, + createParserFields(ctx) + ); +} + function isMissingText(text: string) { return / { + if (!ctx) { + return []; + } + + const options: ESQLCommandOption[] = []; + + for (const optionCtx of ctx.commandOption_list()) { + const option = createOption( + sanitizeIdentifierString(optionCtx.identifier()).toLowerCase(), + optionCtx + ); + options.push(option); + // it can throw while accessing constant for incomplete commands, so try catch it + try { + const optionValue = getConstant(optionCtx.constant()); + if (optionValue != null) { + option.args.push(optionValue); + } + } catch (e) { + // do nothing here + } + } + + return options; +}; + +export const createDissectCommand = (ctx: DissectCommandContext): ESQLCommand => { + const command = createCommand('dissect', ctx); + const primaryExpression = visitPrimaryExpression(ctx.primaryExpression()); + const stringContext = ctx.string_(); + const pattern = stringContext.getToken(esql_parser.QUOTED_STRING, 0); + const doParseStringAndOptions = pattern && textExistsAndIsValid(pattern.getText()); + + command.args.push(primaryExpression); + + if (doParseStringAndOptions) { + const stringNode = createLiteralString(stringContext); + + command.args.push(stringNode); + command.args.push(...createDissectOptions(ctx.commandOptions())); + } + + return command; +}; diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/factories/grok.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/factories/grok.ts new file mode 100644 index 0000000000000..01464641657e6 --- /dev/null +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/factories/grok.ts @@ -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", the "GNU Affero General Public License v3.0 only", and the "Server Side + * Public License v 1"; you may not use this file except in compliance with, at + * your election, the "Elastic License 2.0", the "GNU Affero General Public + * License v3.0 only", or the "Server Side Public License, v 1". + */ + +import esql_parser, { GrokCommandContext } from '../../antlr/esql_parser'; +import { ESQLCommand } from '../../types'; +import { createCommand, createLiteralString, textExistsAndIsValid } from '../factories'; +import { visitPrimaryExpression } from '../walkers'; + +export const createGrokCommand = (ctx: GrokCommandContext): ESQLCommand => { + const command = createCommand('grok', ctx); + const primaryExpression = visitPrimaryExpression(ctx.primaryExpression()); + const stringContext = ctx.string_(); + const pattern = stringContext.getToken(esql_parser.QUOTED_STRING, 0); + const doParseStringAndOptions = pattern && textExistsAndIsValid(pattern.getText()); + + command.args.push(primaryExpression); + + if (doParseStringAndOptions) { + const stringNode = createLiteralString(stringContext); + + command.args.push(stringNode); + } + + return command; +}; diff --git a/src/platform/packages/shared/kbn-esql-ast/src/parser/walkers.ts b/src/platform/packages/shared/kbn-esql-ast/src/parser/walkers.ts index 60dfafa6e3c89..a9f3ac7157a1f 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/parser/walkers.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/parser/walkers.ts @@ -18,14 +18,12 @@ import { BooleanLiteralContext, InputParameterContext, BooleanValueContext, - type CommandOptionsContext, ComparisonContext, type ComparisonOperatorContext, type ConstantContext, ConstantDefaultContext, DecimalLiteralContext, DereferenceContext, - type DissectCommandContext, type DropCommandContext, type EnrichCommandContext, type FieldContext, @@ -33,7 +31,6 @@ import { type AggFieldsContext, type FromCommandContext, FunctionContext, - type GrokCommandContext, IntegerLiteralContext, IsNullContext, type KeepCommandContext, @@ -74,7 +71,6 @@ import { createFakeMultiplyLiteral, createList, createNumericLiteral, - sanitizeIdentifierString, computeLocationExtends, createColumnStar, wrapIdentifierAsArray, @@ -86,6 +82,7 @@ import { createOrderExpression, createFunctionCall, createParam, + createLiteralString, } from './factories'; import { @@ -331,7 +328,7 @@ function getBooleanValue(ctx: BooleanLiteralContext | BooleanValueContext) { return createLiteral('boolean', booleanTerminalNode!); } -function getConstant(ctx: ConstantContext): ESQLAstItem { +export function getConstant(ctx: ConstantContext): ESQLAstItem { if (ctx instanceof NullLiteralContext) { return createLiteral('null', ctx.NULL()); } @@ -354,8 +351,7 @@ function getConstant(ctx: ConstantContext): ESQLAstItem { return getBooleanValue(ctx); } if (ctx instanceof StringLiteralContext) { - // String literal covers multiple ES|QL types: text and keyword types - return createLiteral('keyword', ctx.string_().QUOTED_STRING()); + return createLiteralString(ctx.string_()); } if ( ctx instanceof NumericArrayLiteralContext || @@ -374,11 +370,9 @@ function getConstant(ctx: ConstantContext): ESQLAstItem { values.push(getBooleanValue(booleanValue)!); } for (const string of ctx.getTypedRuleContexts(StringContext)) { - // String literal covers multiple ES|QL types: text and keyword types - const literal = createLiteral('keyword', string.QUOTED_STRING()); - if (literal) { - values.push(literal); - } + const literal = createLiteralString(string); + + values.push(literal); } return createList(ctx, values); } @@ -484,10 +478,10 @@ function collectRegexExpression(ctx: BooleanExpressionContext): ESQLFunction[] { const arg = visitValueExpression(regex.valueExpression()); if (arg) { fn.args.push(arg); - const literal = createLiteral('keyword', regex._pattern.QUOTED_STRING()); - if (literal) { - fn.args.push(literal); - } + + const literal = createLiteralString(regex._pattern); + + fn.args.push(literal); } return fn; }) @@ -631,47 +625,3 @@ export function visitOrderExpressions( return ast; } - -export function visitDissect(ctx: DissectCommandContext) { - const pattern = ctx.string_().getToken(esql_parser.QUOTED_STRING, 0); - return [ - visitPrimaryExpression(ctx.primaryExpression()), - ...(pattern && textExistsAndIsValid(pattern.getText()) - ? [createLiteral('keyword', pattern), ...visitDissectOptions(ctx.commandOptions())] - : []), - ].filter(nonNullable); -} - -export function visitGrok(ctx: GrokCommandContext) { - const pattern = ctx.string_().getToken(esql_parser.QUOTED_STRING, 0); - return [ - visitPrimaryExpression(ctx.primaryExpression()), - ...(pattern && textExistsAndIsValid(pattern.getText()) - ? [createLiteral('keyword', pattern)] - : []), - ].filter(nonNullable); -} - -function visitDissectOptions(ctx: CommandOptionsContext | undefined) { - if (!ctx) { - return []; - } - const options: ESQLCommandOption[] = []; - for (const optionCtx of ctx.commandOption_list()) { - const option = createOption( - sanitizeIdentifierString(optionCtx.identifier()).toLowerCase(), - optionCtx - ); - options.push(option); - // it can throw while accessing constant for incomplete commands, so try catch it - try { - const optionValue = getConstant(optionCtx.constant()); - if (optionValue != null) { - option.args.push(optionValue); - } - } catch (e) { - // do nothing here - } - } - return options; -} diff --git a/src/platform/packages/shared/kbn-esql-ast/src/pretty_print/leaf_printer.ts b/src/platform/packages/shared/kbn-esql-ast/src/pretty_print/leaf_printer.ts index 5432fd815ba52..76e6536070b71 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/pretty_print/leaf_printer.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/pretty_print/leaf_printer.ts @@ -16,6 +16,7 @@ import { ESQLParamLiteral, ESQLProperNode, ESQLSource, + ESQLStringLiteral, ESQLTimeInterval, } from '../types'; @@ -81,6 +82,21 @@ export const LeafPrinter = { return formatted; }, + string: (node: ESQLStringLiteral) => { + const str = node.valueUnquoted; + const strFormatted = + '"' + + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\t/g, '\\t') + + '"'; + + return strFormatted; + }, + literal: (node: ESQLLiteral) => { switch (node.literalType) { case 'null': { @@ -93,7 +109,7 @@ export const LeafPrinter = { return LeafPrinter.param(node); } case 'keyword': { - return String(node.value); + return LeafPrinter.string(node); } case 'double': { const isRounded = node.value % 1 === 0; diff --git a/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/cmd.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/cmd.test.ts index 1158c2bf838e0..fdf8477a3bc3b 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/cmd.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/cmd.test.ts @@ -46,5 +46,5 @@ test('can compose expressions into commands', () => { const text2 = BasicPrettyPrinter.command(cmd2); expect(text1).toBe('WHERE a.b.c == "asdf"'); - expect(text2).toBe('DISSECT a.b.c """%{date}"""'); + expect(text2).toBe('DISSECT a.b.c "%{date}"'); }); diff --git a/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/expr_function.test.ts b/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/expr_function.test.ts index a859fbc2c0d3d..0295f6f11fa30 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/expr_function.test.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/synth/__tests__/expr_function.test.ts @@ -57,7 +57,7 @@ test('can generate a function call expression', () => { { type: 'literal', literalType: 'keyword', - value: '"test"', + valueUnquoted: 'test', }, ], }); diff --git a/src/platform/packages/shared/kbn-esql-ast/src/types.ts b/src/platform/packages/shared/kbn-esql-ast/src/types.ts index d2e2bb8ae775c..9adb7cbe36c5c 100644 --- a/src/platform/packages/shared/kbn-esql-ast/src/types.ts +++ b/src/platform/packages/shared/kbn-esql-ast/src/types.ts @@ -369,6 +369,7 @@ export interface ESQLStringLiteral extends ESQLAstBaseItem { literalType: 'keyword'; value: string; + valueUnquoted: string; } // @internal diff --git a/src/plugins/dashboard/public/dashboard_api/get_dashboard_api.ts b/src/plugins/dashboard/public/dashboard_api/get_dashboard_api.ts index 8b29ed8b1d9f0..5fcb6522b0152 100644 --- a/src/plugins/dashboard/public/dashboard_api/get_dashboard_api.ts +++ b/src/plugins/dashboard/public/dashboard_api/get_dashboard_api.ts @@ -87,18 +87,15 @@ export function getDashboardApi({ controlGroupApi$, panelsManager.api.children$ ); + const settingsManager = initializeSettingsManager(initialState); const unifiedSearchManager = initializeUnifiedSearchManager( initialState, controlGroupApi$, + settingsManager.api.timeRestore$, dataLoadingManager.internalApi.waitForPanelsToLoad$, () => unsavedChangesManager.internalApi.getLastSavedState(), creationOptions ); - const settingsManager = initializeSettingsManager({ - initialState, - setTimeRestore: unifiedSearchManager.internalApi.setTimeRestore, - timeRestore$: unifiedSearchManager.internalApi.timeRestore$, - }); const unsavedChangesManager = initializeUnsavedChangesManager({ creationOptions, controlGroupApi$, diff --git a/src/plugins/dashboard/public/dashboard_api/settings_manager.ts b/src/plugins/dashboard/public/dashboard_api/settings_manager.ts index 0b4903a506a90..9cb93269f4b4b 100644 --- a/src/plugins/dashboard/public/dashboard_api/settings_manager.ts +++ b/src/plugins/dashboard/public/dashboard_api/settings_manager.ts @@ -8,25 +8,12 @@ */ import fastIsEqual from 'fast-deep-equal'; -import { - PublishingSubject, - StateComparators, - initializeTitles, -} from '@kbn/presentation-publishing'; +import { StateComparators, initializeTitles } from '@kbn/presentation-publishing'; import { BehaviorSubject } from 'rxjs'; -import { DashboardState } from './types'; +import { DashboardSettings, DashboardState } from './types'; import { DEFAULT_DASHBOARD_INPUT } from '../dashboard_constants'; -import { DashboardStateFromSettingsFlyout } from '../dashboard_container/types'; -export function initializeSettingsManager({ - initialState, - setTimeRestore, - timeRestore$, -}: { - initialState?: DashboardState; - setTimeRestore: (timeRestore: boolean) => void; - timeRestore$: PublishingSubject; -}) { +export function initializeSettingsManager(initialState?: DashboardState) { const syncColors$ = new BehaviorSubject( initialState?.syncColors ?? DEFAULT_DASHBOARD_INPUT.syncColors ); @@ -50,6 +37,12 @@ export function initializeSettingsManager({ if (!fastIsEqual(tags, tags$.value)) tags$.next(tags); } const titleManager = initializeTitles(initialState ?? {}); + const timeRestore$ = new BehaviorSubject( + initialState?.timeRestore ?? DEFAULT_DASHBOARD_INPUT.timeRestore + ); + function setTimeRestore(timeRestore: boolean) { + if (timeRestore !== timeRestore$.value) timeRestore$.next(timeRestore); + } const useMargins$ = new BehaviorSubject( initialState?.useMargins ?? DEFAULT_DASHBOARD_INPUT.useMargins ); @@ -69,7 +62,7 @@ export function initializeSettingsManager({ }; } - function setSettings(settings: DashboardStateFromSettingsFlyout) { + function setSettings(settings: DashboardSettings) { setSyncColors(settings.syncColors); setSyncCursor(settings.syncCursor); setSyncTooltips(settings.syncTooltips); @@ -100,35 +93,16 @@ export function initializeSettingsManager({ syncColors: [syncColors$, setSyncColors], syncCursor: [syncCursor$, setSyncCursor], syncTooltips: [syncTooltips$, setSyncTooltips], + timeRestore: [timeRestore$, setTimeRestore], useMargins: [useMargins$, setUseMargins], - } as StateComparators< - Pick< - DashboardState, - | 'description' - | 'hidePanelTitles' - | 'syncColors' - | 'syncCursor' - | 'syncTooltips' - | 'title' - | 'useMargins' - > - >, + } as StateComparators>, internalApi: { - getState: (): Pick< - DashboardState, - | 'description' - | 'hidePanelTitles' - | 'syncColors' - | 'syncCursor' - | 'syncTooltips' - | 'tags' - | 'title' - | 'useMargins' - > => { + getState: (): DashboardSettings => { const settings = getSettings(); return { ...settings, title: settings.title ?? '', + timeRestore: settings.timeRestore ?? DEFAULT_DASHBOARD_INPUT.timeRestore, hidePanelTitles: settings.hidePanelTitles ?? DEFAULT_DASHBOARD_INPUT.hidePanelTitles, }; }, diff --git a/src/plugins/dashboard/public/dashboard_api/types.ts b/src/plugins/dashboard/public/dashboard_api/types.ts index 3805d31df1d22..54b540d575695 100644 --- a/src/plugins/dashboard/public/dashboard_api/types.ts +++ b/src/plugins/dashboard/public/dashboard_api/types.ts @@ -54,15 +54,12 @@ import { PublishesReload } from '@kbn/presentation-publishing/interfaces/fetch/p import { PublishesSearchSession } from '@kbn/presentation-publishing/interfaces/fetch/publishes_search_session'; import { LocatorPublic } from '@kbn/share-plugin/common'; import { DashboardPanelMap, DashboardPanelState } from '../../common'; -import type { DashboardOptions } from '../../server/content_management'; +import type { DashboardAttributes, DashboardOptions } from '../../server/content_management'; import { LoadDashboardReturn, SaveDashboardReturn, } from '../services/dashboard_content_management_service/types'; -import { - DashboardLocatorParams, - DashboardStateFromSettingsFlyout, -} from '../dashboard_container/types'; +import { DashboardLocatorParams } from '../dashboard_container/types'; export const DASHBOARD_API_TYPE = 'dashboard'; @@ -93,23 +90,19 @@ export interface DashboardCreationOptions { getEmbeddableAppContext?: (dashboardId?: string) => EmbeddableAppContext; } -export interface DashboardState extends DashboardOptions { - // filter context to be passed to children +export type DashboardSettings = DashboardOptions & { + description?: DashboardAttributes['description']; + tags: string[]; + timeRestore: DashboardAttributes['timeRestore']; + title: DashboardAttributes['description']; +}; + +export interface DashboardState extends DashboardSettings { query: Query; filters: Filter[]; - timeRestore: boolean; timeRange?: TimeRange; refreshInterval?: RefreshInterval; - - // dashboard meta info - title: string; - tags: string[]; viewMode: ViewMode; - description?: string; - - // settings from DashboardOptions - - // dashboard contents panels: DashboardPanelMap; /** @@ -152,7 +145,7 @@ export type DashboardApi = CanExpandPanels & fullScreenMode$: PublishingSubject; focusedPanelId$: PublishingSubject; forceRefresh: () => void; - getSettings: () => DashboardStateFromSettingsFlyout; + getSettings: () => DashboardSettings; getDashboardPanelFromId: (id: string) => DashboardPanelState; hasOverlays$: PublishingSubject; hasUnsavedChanges$: PublishingSubject; @@ -173,7 +166,7 @@ export type DashboardApi = CanExpandPanels & setPanels: (panels: DashboardPanelMap) => void; setQuery: (query?: Query | undefined) => void; setScrollToPanelId: (id: string | undefined) => void; - setSettings: (settings: DashboardStateFromSettingsFlyout) => void; + setSettings: (settings: DashboardSettings) => void; setTags: (tags: string[]) => void; setTimeRange: (timeRange?: TimeRange | undefined) => void; unifiedSearchFilters$: PublishesUnifiedSearch['filters$']; diff --git a/src/plugins/dashboard/public/dashboard_api/unified_search_manager.ts b/src/plugins/dashboard/public/dashboard_api/unified_search_manager.ts index 1310f0104a5ea..9d39961778a91 100644 --- a/src/plugins/dashboard/public/dashboard_api/unified_search_manager.ts +++ b/src/plugins/dashboard/public/dashboard_api/unified_search_manager.ts @@ -48,6 +48,7 @@ import { DEFAULT_DASHBOARD_INPUT, GLOBAL_STATE_STORAGE_KEY } from '../dashboard_ export function initializeUnifiedSearchManager( initialState: DashboardState, controlGroupApi$: PublishingSubject, + timeRestore$: PublishingSubject, waitForPanelsToLoad$: Observable, getLastSavedState: () => DashboardState | undefined, creationOptions?: DashboardCreationOptions @@ -97,12 +98,6 @@ export function initializeUnifiedSearchManager( timefilterService.setTime(timeRangeOrDefault); } } - const timeRestore$ = new BehaviorSubject( - initialState?.timeRestore ?? DEFAULT_DASHBOARD_INPUT.timeRestore - ); - function setTimeRestore(timeRestore: boolean) { - if (timeRestore !== timeRestore$.value) timeRestore$.next(timeRestore); - } const timeslice$ = new BehaviorSubject<[number, number] | undefined>(undefined); const unifiedSearchFilters$ = new BehaviorSubject(initialState.filters); // setAndSyncUnifiedSearchFilters method not needed since filters synced with 2-way data binding @@ -312,9 +307,8 @@ export function initializeUnifiedSearchManager( return true; }, ], - timeRestore: [timeRestore$, setTimeRestore], } as StateComparators< - Pick + Pick >, internalApi: { controlGroupReload$, @@ -325,7 +319,6 @@ export function initializeUnifiedSearchManager( ...lastSavedState.filters, ]); setQuery(lastSavedState.query); - setTimeRestore(lastSavedState.timeRestore); if (lastSavedState.timeRestore) { setAndSyncRefreshInterval(lastSavedState.refreshInterval); setAndSyncTimeRange(lastSavedState.timeRange); @@ -341,8 +334,6 @@ export function initializeUnifiedSearchManager( timeRange: timeRange$.value, timeRestore: timeRestore$.value ?? DEFAULT_DASHBOARD_INPUT.timeRestore, }), - setTimeRestore, - timeRestore$, }, cleanup: () => { controlGroupSubscriptions.unsubscribe(); diff --git a/src/plugins/dashboard/public/dashboard_container/component/settings/index.ts b/src/plugins/dashboard/public/dashboard_container/component/settings/index.ts index 758ea4bf2fd70..970e67e6b8289 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/settings/index.ts +++ b/src/plugins/dashboard/public/dashboard_container/component/settings/index.ts @@ -7,4 +7,4 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export { DashboardSettings } from './settings_flyout'; +export { DashboardSettingsFlyout } from './settings_flyout'; diff --git a/src/plugins/dashboard/public/dashboard_container/component/settings/settings_flyout.tsx b/src/plugins/dashboard/public/dashboard_container/component/settings/settings_flyout.tsx index 20fd2b93119de..e0de277fc3c06 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/settings/settings_flyout.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/settings/settings_flyout.tsx @@ -31,7 +31,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { DashboardContainerInput } from '../../../../common'; +import { DashboardSettings } from '../../../dashboard_api/types'; import { useDashboardApi } from '../../../dashboard_api/use_dashboard_api'; import { getDashboardContentManagementService } from '../../../services/dashboard_content_management_service'; import { savedObjectsTaggingService } from '../../../services/kibana_services'; @@ -42,7 +42,7 @@ interface DashboardSettingsProps { const DUPLICATE_TITLE_CALLOUT_ID = 'duplicateTitleCallout'; -export const DashboardSettings = ({ onClose }: DashboardSettingsProps) => { +export const DashboardSettingsFlyout = ({ onClose }: DashboardSettingsProps) => { const dashboardApi = useDashboardApi(); const [localSettings, setLocalSettings] = useState(dashboardApi.getSettings()); @@ -81,7 +81,7 @@ export const DashboardSettings = ({ onClose }: DashboardSettingsProps) => { } }; - const updateDashboardSetting = useCallback((newSettings: Partial) => { + const updateDashboardSetting = useCallback((newSettings: Partial) => { setLocalSettings((prevSettings) => { return { ...prevSettings, diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/api/open_settings_flyout.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/api/open_settings_flyout.tsx index 0f78bcc96a975..582d19af620f9 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/api/open_settings_flyout.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/api/open_settings_flyout.tsx @@ -14,14 +14,14 @@ import { toMountPoint } from '@kbn/react-kibana-mount'; import { DashboardApi } from '../../../dashboard_api/types'; import { DashboardContext } from '../../../dashboard_api/use_dashboard_api'; import { coreServices } from '../../../services/kibana_services'; -import { DashboardSettings } from '../../component/settings/settings_flyout'; +import { DashboardSettingsFlyout } from '../../component/settings/settings_flyout'; export function openSettingsFlyout(dashboardApi: DashboardApi) { dashboardApi.openOverlay( coreServices.overlays.openFlyout( toMountPoint( - { dashboardApi.clearOverlays(); }} diff --git a/src/plugins/dashboard/public/dashboard_container/types.ts b/src/plugins/dashboard/public/dashboard_container/types.ts index eac2a782f11c2..631d9f66499c7 100644 --- a/src/plugins/dashboard/public/dashboard_container/types.ts +++ b/src/plugins/dashboard/public/dashboard_container/types.ts @@ -12,7 +12,7 @@ import { SerializableRecord } from '@kbn/utility-types'; import { ControlGroupRuntimeState } from '@kbn/controls-plugin/public'; import type { DashboardContainerInput } from '../../common'; -import type { DashboardOptions, DashboardPanel } from '../../server/content_management'; +import type { DashboardPanel } from '../../server/content_management'; export interface UnsavedPanelState { [key: string]: object | undefined; @@ -23,13 +23,6 @@ export type RedirectToProps = | { destination: 'dashboard'; id?: string; useReplace?: boolean; editMode?: boolean } | { destination: 'listing'; filter?: string; useReplace?: boolean }; -export type DashboardStateFromSaveModal = Pick< - DashboardContainerInput, - 'title' | 'description' | 'tags' | 'timeRestore' ->; - -export type DashboardStateFromSettingsFlyout = DashboardStateFromSaveModal & DashboardOptions; - export type DashboardLoadType = | 'sessionFirstLoad' | 'dashboardFirstLoad' @@ -41,8 +34,6 @@ export interface DashboardRenderPerformanceStats { panelsRenderStartTime: number; } -export type DashboardContainerInputWithoutId = Omit; - export interface DashboardContainerOutput extends ContainerOutput { usedDataViewIds?: string[]; } diff --git a/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx b/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx index e434fe19d7b26..e29f93f97c17e 100644 --- a/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx +++ b/src/plugins/dashboard/public/dashboard_listing/hooks/use_dashboard_listing_table.tsx @@ -16,7 +16,6 @@ import type { SavedObjectsFindOptionsReference } from '@kbn/core/public'; import { reportPerformanceMetricEvent } from '@kbn/ebt-tools'; import { ViewMode } from '@kbn/embeddable-plugin/public'; -import { DashboardContainerInput } from '../../../common'; import type { DashboardSearchOut } from '../../../server/content_management'; import { DASHBOARD_CONTENT_ID, @@ -35,6 +34,7 @@ import { import { confirmCreateWithUnsaved } from '../confirm_overlays'; import { DashboardListingEmptyPrompt } from '../dashboard_listing_empty_prompt'; import { DashboardSavedObjectUserContent } from '../types'; +import { UpdateDashboardMetaProps } from '../../services/dashboard_content_management_service/lib/update_dashboard_meta'; type GetDetailViewLink = TableListViewTableProps['getDetailViewLink']; @@ -130,7 +130,7 @@ export const useDashboardListingTable = ({ }, [dashboardBackupService, goToDashboard, useSessionStorageIntegration]); const updateItemMeta = useCallback( - async (props: Pick) => { + async (props: UpdateDashboardMetaProps) => { await dashboardContentManagementService.updateDashboardMeta(props); setUnsavedDashboardIds(dashboardBackupService.getDashboardIdsWithUnsavedChanges()); diff --git a/src/plugins/dashboard/public/services/dashboard_content_management_service/lib/update_dashboard_meta.ts b/src/plugins/dashboard/public/services/dashboard_content_management_service/lib/update_dashboard_meta.ts index 90f31cfdc05c6..60f61b64caeec 100644 --- a/src/plugins/dashboard/public/services/dashboard_content_management_service/lib/update_dashboard_meta.ts +++ b/src/plugins/dashboard/public/services/dashboard_content_management_service/lib/update_dashboard_meta.ts @@ -7,16 +7,21 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { DashboardContainerInput } from '../../../../common'; import { DASHBOARD_CONTENT_ID } from '../../../dashboard_constants'; -import type { DashboardUpdateIn, DashboardUpdateOut } from '../../../../server/content_management'; +import type { + DashboardAttributes, + DashboardUpdateIn, + DashboardUpdateOut, +} from '../../../../server/content_management'; import { findDashboardsByIds } from './find_dashboards'; import { contentManagementService, savedObjectsTaggingService } from '../../kibana_services'; -type UpdateDashboardMetaProps = Pick< - DashboardContainerInput, - 'id' | 'title' | 'description' | 'tags' ->; +export interface UpdateDashboardMetaProps { + id: DashboardUpdateIn['id']; + title: DashboardAttributes['title']; + description?: DashboardAttributes['description']; + tags: string[]; +} export const updateDashboardMeta = async ({ id, diff --git a/src/plugins/dashboard/public/services/dashboard_content_management_service/types.ts b/src/plugins/dashboard/public/services/dashboard_content_management_service/types.ts index 1922ed3e30dac..3c0c37afc0cd6 100644 --- a/src/plugins/dashboard/public/services/dashboard_content_management_service/types.ts +++ b/src/plugins/dashboard/public/services/dashboard_content_management_service/types.ts @@ -21,6 +21,7 @@ import { SearchDashboardsResponse, } from './lib/find_dashboards'; import { DashboardState } from '../../dashboard_api/types'; +import { UpdateDashboardMetaProps } from './lib/update_dashboard_meta'; export interface DashboardContentManagementService { findDashboards: FindDashboardsService; @@ -28,9 +29,7 @@ export interface DashboardContentManagementService { loadDashboardState: (props: { id?: string }) => Promise; saveDashboardState: (props: SaveDashboardProps) => Promise; checkForDuplicateDashboardTitle: (meta: DashboardDuplicateTitleCheckProps) => Promise; - updateDashboardMeta: ( - props: Pick - ) => Promise; + updateDashboardMeta: (props: UpdateDashboardMetaProps) => Promise; } /** diff --git a/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx b/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx index a059b6f507259..ed56ee5f07c9c 100644 --- a/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx +++ b/src/plugins/discover/public/application/view_alert/view_alert_utils.tsx @@ -33,7 +33,7 @@ export interface QueryParams { to: string | null; } -const LEGACY_BASE_ALERT_API_PATH = '/api/alerts'; +const BASE_ALERTING_API_PATH = '/api/alerting'; const buildTimeRangeFilter = ( dataView: DataView, @@ -77,7 +77,7 @@ export const getAlertUtils = ( const fetchAlert = async (id: string) => { try { return await core.http.get>( - `${LEGACY_BASE_ALERT_API_PATH}/alert/${id}` + `${BASE_ALERTING_API_PATH}/rule/${id}` ); } catch (error) { const errorTitle = i18n.translate('discover.viewAlert.alertRuleFetchErrorTitle', { diff --git a/test/examples/bfetch_explorer/batched_function.ts b/test/examples/bfetch_explorer/batched_function.ts deleted file mode 100644 index 35b4123befc44..0000000000000 --- a/test/examples/bfetch_explorer/batched_function.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../functional/ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function ({ getService }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - - describe('batchedFunction', () => { - beforeEach(async () => { - await testSubjects.click('count-until'); - await testSubjects.click('double-integers'); - }); - - it('executes all requests in a batch', async () => { - const form = await testSubjects.find('DoubleIntegers'); - const btn = await form.findByCssSelector('button'); - await btn.click(); - await new Promise((r) => setTimeout(r, 4000)); - const pre = await form.findByCssSelector('pre'); - const text = await pre.getVisibleText(); - const json = JSON.parse(text); - - expect(json).to.eql([ - { - num: -1, - error: { - message: 'Invalid number', - }, - }, - { - num: 300, - result: { - num: 600, - }, - }, - { - num: 1000, - result: { - num: 2000, - }, - }, - { - num: 2000, - result: { - num: 4000, - }, - }, - ]); - }); - - it('streams results back', async () => { - const form = await testSubjects.find('DoubleIntegers'); - const btn = await form.findByCssSelector('button'); - await btn.click(); - - await new Promise((r) => setTimeout(r, 500)); - const pre = await form.findByCssSelector('pre'); - - const text1 = await pre.getVisibleText(); - const json1 = JSON.parse(text1); - - expect(json1.length > 0).to.be(true); - expect(json1.length < 4).to.be(true); - - await new Promise((r) => setTimeout(r, 3500)); - - const text2 = await pre.getVisibleText(); - const json2 = JSON.parse(text2); - - expect(json2.length).to.be(4); - }); - }); -} diff --git a/test/examples/bfetch_explorer/index.ts b/test/examples/bfetch_explorer/index.ts deleted file mode 100644 index 19e7cb6f0a0a4..0000000000000 --- a/test/examples/bfetch_explorer/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import { FtrProviderContext } from '../../functional/ftr_provider_context'; - -// eslint-disable-next-line import/no-default-export -export default function ({ getService, getPageObjects, loadTestFile }: FtrProviderContext) { - const browser = getService('browser'); - const PageObjects = getPageObjects(['common', 'header']); - - describe('bfetch explorer', function () { - before(async () => { - await browser.setWindowSize(1300, 900); - await PageObjects.common.navigateToApp('bfetch-explorer', { insertTimestamp: false }); - }); - - loadTestFile(require.resolve('./batched_function')); - }); -} diff --git a/test/examples/config.js b/test/examples/config.js index cb1dd9dc308e8..7a3f9c4dfd265 100644 --- a/test/examples/config.js +++ b/test/examples/config.js @@ -19,7 +19,6 @@ export default async function ({ readConfigFile }) { rootTags: ['runOutsideOfCiGroups'], testFiles: [ require.resolve('./hello_world'), - require.resolve('./bfetch_explorer'), require.resolve('./ui_actions'), require.resolve('./state_sync'), require.resolve('./routing'), diff --git a/tsconfig.base.json b/tsconfig.base.json index 5ec9cf10390c8..86e915581a88b 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -118,8 +118,6 @@ "@kbn/bazel-runner/*": ["packages/kbn-bazel-runner/*"], "@kbn/bfetch-error": ["packages/kbn-bfetch-error"], "@kbn/bfetch-error/*": ["packages/kbn-bfetch-error/*"], - "@kbn/bfetch-explorer-plugin": ["examples/bfetch_explorer"], - "@kbn/bfetch-explorer-plugin/*": ["examples/bfetch_explorer/*"], "@kbn/bfetch-plugin": ["src/plugins/bfetch"], "@kbn/bfetch-plugin/*": ["src/plugins/bfetch/*"], "@kbn/calculate-auto": ["packages/kbn-calculate-auto"], @@ -850,6 +848,8 @@ "@kbn/es-ui-shared-plugin/*": ["src/platform/plugins/shared/es_ui_shared/*"], "@kbn/eslint-config": ["packages/kbn-eslint-config"], "@kbn/eslint-config/*": ["packages/kbn-eslint-config/*"], + "@kbn/eslint-plugin-css": ["packages/kbn-eslint-plugin-css"], + "@kbn/eslint-plugin-css/*": ["packages/kbn-eslint-plugin-css/*"], "@kbn/eslint-plugin-disable": ["packages/kbn-eslint-plugin-disable"], "@kbn/eslint-plugin-disable/*": ["packages/kbn-eslint-plugin-disable/*"], "@kbn/eslint-plugin-eslint": ["packages/kbn-eslint-plugin-eslint"], @@ -1836,8 +1836,8 @@ "@kbn/shared-ux-table-persist/*": ["packages/shared-ux/table_persist/*"], "@kbn/shared-ux-utility": ["packages/kbn-shared-ux-utility"], "@kbn/shared-ux-utility/*": ["packages/kbn-shared-ux-utility/*"], - "@kbn/slo-plugin": ["x-pack/plugins/observability_solution/slo"], - "@kbn/slo-plugin/*": ["x-pack/plugins/observability_solution/slo/*"], + "@kbn/slo-plugin": ["x-pack/solutions/observability/plugins/slo"], + "@kbn/slo-plugin/*": ["x-pack/solutions/observability/plugins/slo/*"], "@kbn/slo-schema": ["x-pack/platform/packages/shared/kbn-slo-schema"], "@kbn/slo-schema/*": ["x-pack/platform/packages/shared/kbn-slo-schema/*"], "@kbn/snapshot-restore-plugin": ["x-pack/platform/plugins/private/snapshot_restore"], @@ -2080,9 +2080,7 @@ "@kbn/zod-helpers/*": ["packages/kbn-zod-helpers/*"], // END AUTOMATED PACKAGE LISTING // Allows for importing from `kibana` package for the exported types. - "@emotion/core": [ - "typings/@emotion" - ] + "@emotion/core": ["typings/@emotion"] }, // Support .tsx files and transform JSX into calls to React.createElement "jsx": "react", diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 4c1df87ec03fd..c485393acb423 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -153,7 +153,7 @@ "xpack.streams": [ "solutions/observability/plugins/streams_app" ], - "xpack.slo": "plugins/observability_solution/slo", + "xpack.slo": "solutions/observability/plugins/slo", "xpack.snapshotRestore": "platform/plugins/private/snapshot_restore", "xpack.spaces": "plugins/spaces", "xpack.savedObjectsTagging": [ diff --git a/x-pack/platform/plugins/shared/inference/common/tasks/nl_to_esql/ast/corrections/like.ts b/x-pack/platform/plugins/shared/inference/common/tasks/nl_to_esql/ast/corrections/like.ts index be61bd216284b..6ee068339b776 100644 --- a/x-pack/platform/plugins/shared/inference/common/tasks/nl_to_esql/ast/corrections/like.ts +++ b/x-pack/platform/plugins/shared/inference/common/tasks/nl_to_esql/ast/corrections/like.ts @@ -43,6 +43,9 @@ function checkLikeNode(node: ESQLLikeOperator): QueryCorrection[] { likeExpression.value = likeExpression.value .replaceAll(/(? 2018-12-22`.\n", - "schema": { - "type": "string" - } - }, - { - "name": "has_reference", - "in": "query", - "description": "Filters the rules that have a relation with the reference objects with a specific type and identifier.", - "schema": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - { - "name": "page", - "in": "query", - "description": "The page number to return.", - "schema": { - "type": "integer", - "default": 1 - }, - "example": 1 - }, - { - "name": "per_page", - "in": "query", - "description": "The number of alerts to return per page.", - "schema": { - "type": "integer", - "default": 20 - }, - "example": 20 - }, - { - "name": "search", - "in": "query", - "description": "An Elasticsearch `simple_query_string` query that filters the alerts in the response.", - "schema": { - "type": "string" - } - }, - { - "name": "search_fields", - "in": "query", - "description": "The fields to perform the `simple_query_string` parsed query against.", - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - } - }, - { - "name": "sort_field", - "in": "query", - "description": "Determines which field is used to sort the results. The field must exist in the `attributes` key of the response.\n", - "schema": { - "type": "string" - } - }, - { - "name": "sort_order", - "in": "query", - "description": "Determines the sort order.", - "schema": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "default": "desc" - }, - "example": "asc" - } - ], - "responses": { - "200": { - "description": "Indicates a successful call.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/alert_response_properties" - } - }, - "page": { - "type": "integer" - }, - "perPage": { - "type": "integer" - }, - "total": { - "type": "integer" - } - } - } - } - } - }, - "401": { - "description": "Authorization information is missing or invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/401_response" - } - } - } - } - } - } - }, - "/api/alerts/alerts/_health": { - "get": { - "summary": "Get the alerting framework health", - "operationId": "legacyGetAlertingHealth", - "deprecated": true, - "description": "Deprecated in 7.13.0. Use the get alerting framework health API instead.", - "tags": [ - "alerting" - ], - "responses": { - "200": { - "description": "Indicates a successful call.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "alertingFrameworkHealth": { - "type": "object", - "description": "Three substates identify the health of the alerting framework: `decryptionHealth`, `executionHealth`, and `readHealth`.\n", - "properties": { - "decryptionHealth": { - "type": "object", - "description": "The timestamp and status of the alert decryption.", - "properties": { - "status": { - "type": "string", - "example": "ok", - "enum": [ - "error", - "ok", - "warn" - ] - }, - "timestamp": { - "type": "string", - "format": "date-time", - "example": "2023-01-13T01:28:00.280Z" - } - } - }, - "executionHealth": { - "type": "object", - "description": "The timestamp and status of the alert execution.", - "properties": { - "status": { - "type": "string", - "example": "ok", - "enum": [ - "error", - "ok", - "warn" - ] - }, - "timestamp": { - "type": "string", - "format": "date-time", - "example": "2023-01-13T01:28:00.280Z" - } - } - }, - "readHealth": { - "type": "object", - "description": "The timestamp and status of the alert reading events.", - "properties": { - "status": { - "type": "string", - "example": "ok", - "enum": [ - "error", - "ok", - "warn" - ] - }, - "timestamp": { - "type": "string", - "format": "date-time", - "example": "2023-01-13T01:28:00.280Z" - } - } - } - } - }, - "hasPermanentEncryptionKey": { - "type": "boolean", - "description": "If `false`, the encrypted saved object plugin does not have a permanent encryption key.", - "example": true - }, - "isSufficientlySecure": { - "type": "boolean", - "description": "If `false`, security is enabled but TLS is not.", - "example": true - } - } - } - } - } - }, - "401": { - "description": "Authorization information is missing or invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/401_response" - } - } - } - } - } - } - }, - "/api/alerts/alerts/list_alert_types": { - "get": { - "summary": "Get the alert types", - "operationId": "legacyGetAlertTypes", - "deprecated": true, - "description": "Deprecated in 7.13.0. Use the get rule types API instead.", - "tags": [ - "alerting" - ], - "responses": { - "200": { - "description": "Indicates a successful call.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "actionGroups": { - "description": "An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid.\n", - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - }, - "actionVariables": { - "description": "A list of action variables that the alert type makes available via context and state in action parameter templates, and a short human readable description. The Alert UI will use this information to prompt users for these variables in action parameter editors.\n", - "type": "object", - "properties": { - "context": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - } - } - }, - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - }, - "state": { - "type": "array", - "items": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - }, - "authorizedConsumers": { - "description": "The list of the plugins IDs that have access to the alert type.", - "type": "object" - }, - "defaultActionGroupId": { - "description": "The default identifier for the alert type group.", - "type": "string" - }, - "enabledInLicense": { - "description": "Indicates whether the rule type is enabled based on the subscription.", - "type": "boolean" - }, - "id": { - "description": "The unique identifier for the alert type.", - "type": "string" - }, - "isExportable": { - "description": "Indicates whether the alert type is exportable in Saved Objects Management UI.", - "type": "boolean" - }, - "minimumLicenseRequired": { - "description": "The subscriptions required to use the alert type.", - "type": "string" - }, - "name": { - "description": "The descriptive name of the alert type.", - "type": "string" - }, - "producer": { - "description": "An identifier for the application that produces this alert type.", - "type": "string" - }, - "recoveryActionGroup": { - "description": "An action group to use when an alert instance goes from an active state to an inactive one. If it is not specified, the default recovered action group is used.\n", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "401": { - "description": "Authorization information is missing or invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/401_response" - } - } - } - } - } - } - }, - "/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute": { - "post": { - "summary": "Mute an alert instance", - "operationId": "legacyMuteAlertInstance", - "deprecated": true, - "description": "Deprecated in 7.13.0. Use the mute alert API instead.", - "tags": [ - "alerting" - ], - "parameters": [ - { - "$ref": "#/components/parameters/kbn_xsrf" - }, - { - "in": "path", - "name": "alertId", - "description": "An identifier for the alert.", - "required": true, - "schema": { - "type": "string", - "example": "41893910-6bca-11eb-9e0d-85d233e3ee35" - } - }, - { - "in": "path", - "name": "alertInstanceId", - "description": "An identifier for the alert instance.", - "required": true, - "schema": { - "type": "string", - "example": "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2" - } - } - ], - "responses": { - "204": { - "description": "Indicates a successful call." - }, - "401": { - "description": "Authorization information is missing or invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/401_response" - } - } - } - } - } - } - }, - "/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute": { - "post": { - "summary": "Unmute an alert instance", - "operationId": "legacyUnmuteAlertInstance", - "deprecated": true, - "description": "Deprecated in 7.13.0. Use the unmute alert API instead.", - "tags": [ - "alerting" - ], - "parameters": [ - { - "$ref": "#/components/parameters/kbn_xsrf" - }, - { - "in": "path", - "name": "alertId", - "description": "An identifier for the alert.", - "required": true, - "schema": { - "type": "string", - "example": "41893910-6bca-11eb-9e0d-85d233e3ee35" - } - }, - { - "in": "path", - "name": "alertInstanceId", - "description": "An identifier for the alert instance.", - "required": true, - "schema": { - "type": "string", - "example": "dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2" - } - } - ], - "responses": { - "204": { - "description": "Indicates a successful call." - }, - "401": { - "description": "Authorization information is missing or invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/401_response" - } - } - } - } - } - } } }, "components": { @@ -1978,129 +925,6 @@ "example": "scaled_float" } } - }, - "alert_response_properties": { - "title": "Legacy alert response properties", - "type": "object", - "properties": { - "actions": { - "type": "array", - "items": { - "type": "object" - } - }, - "alertTypeId": { - "type": "string", - "example": ".index-threshold" - }, - "apiKeyOwner": { - "type": "string", - "nullable": true, - "example": "elastic" - }, - "createdAt": { - "type": "string", - "description": "The date and time that the alert was created.", - "format": "date-time", - "example": "2022-12-05T23:36:58.284Z" - }, - "createdBy": { - "type": "string", - "description": "The identifier for the user that created the alert.", - "example": "elastic" - }, - "enabled": { - "type": "boolean", - "description": "Indicates whether the alert is currently enabled.", - "example": true - }, - "executionStatus": { - "type": "object", - "properties": { - "lastExecutionDate": { - "type": "string", - "format": "date-time", - "example": "2022-12-06T00:13:43.890Z" - }, - "status": { - "type": "string", - "example": "ok" - } - } - }, - "id": { - "type": "string", - "description": "The identifier for the alert.", - "example": "b530fed0-74f5-11ed-9801-35303b735aef" - }, - "muteAll": { - "type": "boolean", - "example": false - }, - "mutedInstanceIds": { - "type": "array", - "nullable": true, - "items": { - "type": "string" - } - }, - "name": { - "type": "string", - "description": "The name of the alert.", - "example": "my alert" - }, - "notifyWhen": { - "type": "string", - "example": "onActionGroupChange" - }, - "params": { - "type": "object", - "additionalProperties": true - }, - "schedule": { - "type": "object", - "properties": { - "interval": { - "type": "string" - } - } - }, - "scheduledTaskId": { - "type": "string", - "example": "b530fed0-74f5-11ed-9801-35303b735aef" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "throttle": { - "type": "string", - "nullable": true - }, - "updatedAt": { - "type": "string", - "example": "2022-12-05T23:36:58.284Z" - }, - "updatedBy": { - "type": "string", - "description": "The identifier for the user that updated this alert most recently.", - "nullable": true, - "example": "elastic" - } - } - } - }, - "parameters": { - "kbn_xsrf": { - "schema": { - "type": "string" - }, - "in": "header", - "name": "kbn-xsrf", - "description": "Cross-site request forgery protection", - "required": true } } } diff --git a/x-pack/plugins/alerting/docs/openapi/bundled.yaml b/x-pack/plugins/alerting/docs/openapi/bundled.yaml index 87601c463e50e..967d08eadf5fa 100644 --- a/x-pack/plugins/alerting/docs/openapi/bundled.yaml +++ b/x-pack/plugins/alerting/docs/openapi/bundled.yaml @@ -353,724 +353,6 @@ paths: application/json: schema: $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}: - delete: - summary: Delete an alert - operationId: legaryDeleteAlert - deprecated: true - description: | - Deprecated in 7.13.0. Use the delete rule API instead. WARNING: After you delete an alert, you cannot recover it. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - get: - summary: Get an alert by identifier - operationId: legacyGetAlert - deprecated: true - description: Deprecated in 7.13.0. Use the get rule API instead. - tags: - - alerting - parameters: - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '#/components/schemas/alert_response_properties' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - post: - summary: Create an alert - operationId: legacyCreateAlert - deprecated: true - description: Deprecated in 7.13.0. Use the create rule API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - requestBody: - required: true - content: - application/json: - schema: - title: Legacy create alert request properties - type: object - required: - - alertTypeId - - consumer - - name - - notifyWhen - - params - - schedule - properties: - actions: - type: array - items: - type: object - required: - - actionTypeId - - group - - id - - params - properties: - actionTypeId: - type: string - description: The identifier for the action type. - group: - type: string - description: | - Grouping actions is recommended for escalations for different types of alert instances. If you don't need this functionality, set it to `default`. - id: - type: string - description: The ID of the action saved object. - params: - type: object - description: | - The map to the `params` that the action type will receive. `params` are handled as Mustache templates and passed a default set of context. - alertTypeId: - type: string - description: The ID of the alert type that you want to call when the alert is scheduled to run. - consumer: - type: string - description: The name of the application that owns the alert. This name has to match the Kibana feature name, as that dictates the required role-based access control privileges. - enabled: - type: boolean - description: Indicates if you want to run the alert on an interval basis after it is created. - name: - type: string - description: A name to reference and search. - notifyWhen: - type: string - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - params: - type: object - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - schedule: - type: object - description: | - The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - properties: - interval: - type: string - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: 10s - tags: - type: array - items: - type: string - description: A list of keywords to reference and search. - throttle: - type: string - description: | - How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '#/components/schemas/alert_response_properties' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - put: - summary: Update an alert - operationId: legacyUpdateAlert - deprecated: true - description: Deprecated in 7.13.0. Use the update rule API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - requestBody: - required: true - content: - application/json: - schema: - title: Legacy update alert request properties - type: object - required: - - name - - notifyWhen - - params - - schedule - properties: - actions: - type: array - items: - type: object - required: - - actionTypeId - - group - - id - - params - properties: - actionTypeId: - type: string - description: The identifier for the action type. - group: - type: string - description: | - Grouping actions is recommended for escalations for different types of alert instances. If you don't need this functionality, set it to `default`. - id: - type: string - description: The ID of the action saved object. - params: - type: object - description: | - The map to the `params` that the action type will receive. `params` are handled as Mustache templates and passed a default set of context. - name: - type: string - description: A name to reference and search. - notifyWhen: - type: string - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - params: - type: object - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - schedule: - type: object - description: | - The schedule specifying when this alert should be run. A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - properties: - interval: - type: string - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: 1d - tags: - type: array - items: - type: string - description: A list of keywords to reference and search. - throttle: - type: string - description: | - How often this alert should fire the same actions. This will prevent the alert from sending out the same notification over and over. For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '#/components/schemas/alert_response_properties' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/_disable: - post: - summary: Disable an alert - operationId: legacyDisableAlert - deprecated: true - description: Deprecated in 7.13.0. Use the disable rule API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/_enable: - post: - summary: Enable an alert - operationId: legacyEnableAlert - deprecated: true - description: Deprecated in 7.13.0. Use the enable rule API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/_mute_all: - post: - summary: Mute all alert instances - operationId: legacyMuteAllAlertInstances - deprecated: true - description: Deprecated in 7.13.0. Use the mute all alerts API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/_unmute_all: - post: - summary: Unmute all alert instances - operationId: legacyUnmuteAllAlertInstances - deprecated: true - description: Deprecated in 7.13.0. Use the unmute all alerts API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alerts/_find: - get: - summary: Get a paginated set of alerts - operationId: legacyFindAlerts - deprecated: true - description: | - Deprecated in 7.13.0. Use the find rules API instead. NOTE: Alert `params` are stored as a flattened field type and analyzed as keywords. As alerts change in Kibana, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data. - tags: - - alerting - parameters: - - name: default_search_operator - in: query - description: The default operator to use for the `simple_query_string`. - schema: - type: string - default: OR - example: OR - - name: fields - in: query - description: The fields to return in the `attributes` key of the response. - schema: - type: array - items: - type: string - - name: filter - in: query - description: | - A KQL string that you filter with an attribute from your saved object. It should look like `savedObjectType.attributes.title: "myTitle"`. However, if you used a direct attribute of a saved object, such as `updatedAt`, you must define your filter, for example, `savedObjectType.updatedAt > 2018-12-22`. - schema: - type: string - - name: has_reference - in: query - description: Filters the rules that have a relation with the reference objects with a specific type and identifier. - schema: - type: object - properties: - id: - type: string - type: - type: string - - name: page - in: query - description: The page number to return. - schema: - type: integer - default: 1 - example: 1 - - name: per_page - in: query - description: The number of alerts to return per page. - schema: - type: integer - default: 20 - example: 20 - - name: search - in: query - description: An Elasticsearch `simple_query_string` query that filters the alerts in the response. - schema: - type: string - - name: search_fields - in: query - description: The fields to perform the `simple_query_string` parsed query against. - schema: - oneOf: - - type: string - - type: array - items: - type: string - - name: sort_field - in: query - description: | - Determines which field is used to sort the results. The field must exist in the `attributes` key of the response. - schema: - type: string - - name: sort_order - in: query - description: Determines the sort order. - schema: - type: string - enum: - - asc - - desc - default: desc - example: asc - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/alert_response_properties' - page: - type: integer - perPage: - type: integer - total: - type: integer - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alerts/_health: - get: - summary: Get the alerting framework health - operationId: legacyGetAlertingHealth - deprecated: true - description: Deprecated in 7.13.0. Use the get alerting framework health API instead. - tags: - - alerting - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - alertingFrameworkHealth: - type: object - description: | - Three substates identify the health of the alerting framework: `decryptionHealth`, `executionHealth`, and `readHealth`. - properties: - decryptionHealth: - type: object - description: The timestamp and status of the alert decryption. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' - executionHealth: - type: object - description: The timestamp and status of the alert execution. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' - readHealth: - type: object - description: The timestamp and status of the alert reading events. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: '2023-01-13T01:28:00.280Z' - hasPermanentEncryptionKey: - type: boolean - description: If `false`, the encrypted saved object plugin does not have a permanent encryption key. - example: true - isSufficientlySecure: - type: boolean - description: If `false`, security is enabled but TLS is not. - example: true - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alerts/list_alert_types: - get: - summary: Get the alert types - operationId: legacyGetAlertTypes - deprecated: true - description: Deprecated in 7.13.0. Use the get rule types API instead. - tags: - - alerting - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: array - items: - type: object - properties: - actionGroups: - description: | - An explicit list of groups for which the alert type can schedule actions, each with the action group's unique ID and human readable name. Alert actions validation uses this configuration to ensure that groups are valid. - type: array - items: - type: object - properties: - id: - type: string - name: - type: string - actionVariables: - description: | - A list of action variables that the alert type makes available via context and state in action parameter templates, and a short human readable description. The Alert UI will use this information to prompt users for these variables in action parameter editors. - type: object - properties: - context: - type: array - items: - type: object - properties: - name: - type: string - description: - type: string - params: - type: array - items: - type: object - properties: - description: - type: string - name: - type: string - state: - type: array - items: - type: object - properties: - description: - type: string - name: - type: string - authorizedConsumers: - description: The list of the plugins IDs that have access to the alert type. - type: object - defaultActionGroupId: - description: The default identifier for the alert type group. - type: string - enabledInLicense: - description: Indicates whether the rule type is enabled based on the subscription. - type: boolean - id: - description: The unique identifier for the alert type. - type: string - isExportable: - description: Indicates whether the alert type is exportable in Saved Objects Management UI. - type: boolean - minimumLicenseRequired: - description: The subscriptions required to use the alert type. - type: string - name: - description: The descriptive name of the alert type. - type: string - producer: - description: An identifier for the application that produces this alert type. - type: string - recoveryActionGroup: - description: | - An action group to use when an alert instance goes from an active state to an inactive one. If it is not specified, the default recovered action group is used. - type: object - properties: - id: - type: string - name: - type: string - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute: - post: - summary: Mute an alert instance - operationId: legacyMuteAlertInstance - deprecated: true - description: Deprecated in 7.13.0. Use the mute alert API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: An identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - - in: path - name: alertInstanceId - description: An identifier for the alert instance. - required: true - schema: - type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - /api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute: - post: - summary: Unmute an alert instance - operationId: legacyUnmuteAlertInstance - deprecated: true - description: Deprecated in 7.13.0. Use the unmute alert API instead. - tags: - - alerting - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - in: path - name: alertId - description: An identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - - in: path - name: alertInstanceId - description: An identifier for the alert instance. - required: true - schema: - type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' components: examples: get_health_response: @@ -1370,94 +652,3 @@ components: type: string description: Specifies the data type for the field. example: scaled_float - alert_response_properties: - title: Legacy alert response properties - type: object - properties: - actions: - type: array - items: - type: object - alertTypeId: - type: string - example: .index-threshold - apiKeyOwner: - type: string - nullable: true - example: elastic - createdAt: - type: string - description: The date and time that the alert was created. - format: date-time - example: '2022-12-05T23:36:58.284Z' - createdBy: - type: string - description: The identifier for the user that created the alert. - example: elastic - enabled: - type: boolean - description: Indicates whether the alert is currently enabled. - example: true - executionStatus: - type: object - properties: - lastExecutionDate: - type: string - format: date-time - example: '2022-12-06T00:13:43.890Z' - status: - type: string - example: ok - id: - type: string - description: The identifier for the alert. - example: b530fed0-74f5-11ed-9801-35303b735aef - muteAll: - type: boolean - example: false - mutedInstanceIds: - type: array - nullable: true - items: - type: string - name: - type: string - description: The name of the alert. - example: my alert - notifyWhen: - type: string - example: onActionGroupChange - params: - type: object - additionalProperties: true - schedule: - type: object - properties: - interval: - type: string - scheduledTaskId: - type: string - example: b530fed0-74f5-11ed-9801-35303b735aef - tags: - type: array - items: - type: string - throttle: - type: string - nullable: true - updatedAt: - type: string - example: '2022-12-05T23:36:58.284Z' - updatedBy: - type: string - description: The identifier for the user that updated this alert most recently. - nullable: true - example: elastic - parameters: - kbn_xsrf: - schema: - type: string - in: header - name: kbn-xsrf - description: Cross-site request forgery protection - required: true diff --git a/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml index 48f7efd53b839..1b169a6c4f760 100644 --- a/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml +++ b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml @@ -15,24 +15,3 @@ paths: $ref: paths/api@alerting@_health.yaml '/api/alerting/rule_types': $ref: 'paths/api@alerting@rule_types.yaml' -# Deprecated APIs - '/api/alerts/alert/{alertId}': - $ref: 'paths/api@alerts@alert@{alertid}.yaml' - '/api/alerts/alert/{alertId}/_disable': - $ref: 'paths/api@alerts@alert@{alertid}@_disable.yaml' - '/api/alerts/alert/{alertId}/_enable': - $ref: 'paths/api@alerts@alert@{alertid}@_enable.yaml' - '/api/alerts/alert/{alertId}/_mute_all': - $ref: 'paths/api@alerts@alert@{alertid}@_mute_all.yaml' - '/api/alerts/alert/{alertId}/_unmute_all': - $ref: 'paths/api@alerts@alert@{alertid}@_unmute_all.yaml' - '/api/alerts/alerts/_find': - $ref: 'paths/api@alerts@_find.yaml' - '/api/alerts/alerts/_health': - $ref: 'paths/api@alerts@_health.yaml' - '/api/alerts/alerts/list_alert_types': - $ref: 'paths/api@alerts@list_alert_types.yaml' - '/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_mute': - $ref: 'paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_mute.yaml' - '/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute': - $ref: 'paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_unmute.yaml' diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_find.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_find.yaml deleted file mode 100644 index 397653acb1c90..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_find.yaml +++ /dev/null @@ -1,115 +0,0 @@ -get: - summary: Get a paginated set of alerts - operationId: legacyFindAlerts - deprecated: true - description: > - Deprecated in 7.13.0. Use the find rules API instead. - NOTE: Alert `params` are stored as a flattened field type and analyzed as keywords. - As alerts change in Kibana, the results on each page of the response also change. - Use the find API for traditional paginated results, but avoid using it to export large amounts of data. - tags: - - alerting - parameters: - - name: default_search_operator - in: query - description: The default operator to use for the `simple_query_string`. - schema: - type: string - default: OR - example: OR - - name: fields - in: query - description: The fields to return in the `attributes` key of the response. - schema: - type: array - items: - type: string - - name: filter - in: query - description: > - A KQL string that you filter with an attribute from your saved object. - It should look like `savedObjectType.attributes.title: "myTitle"`. - However, if you used a direct attribute of a saved object, such as - `updatedAt`, you must define your filter, for example, - `savedObjectType.updatedAt > 2018-12-22`. - schema: - type: string - - name: has_reference - in: query - description: Filters the rules that have a relation with the reference objects with a specific type and identifier. - schema: - type: object - properties: - id: - type: string - type: - type: string - - name: page - in: query - description: The page number to return. - schema: - type: integer - default: 1 - example: 1 - - name: per_page - in: query - description: The number of alerts to return per page. - schema: - type: integer - default: 20 - example: 20 - - name: search - in: query - description: An Elasticsearch `simple_query_string` query that filters the alerts in the response. - schema: - type: string - - name: search_fields - in: query - description: The fields to perform the `simple_query_string` parsed query against. - schema: - oneOf: - - type: string - - type: array - items: - type: string - - name: sort_field - in: query - description: > - Determines which field is used to sort the results. The field must exist - in the `attributes` key of the response. - schema: - type: string - - name: sort_order - in: query - description: Determines the sort order. - schema: - type: string - enum: - - asc - - desc - default: desc - example: asc - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - $ref: '../components/schemas/alert_response_properties.yaml' - page: - type: integer - perPage: - type: integer - total: - type: integer - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_health.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_health.yaml deleted file mode 100644 index b8436a08abf1f..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@_health.yaml +++ /dev/null @@ -1,79 +0,0 @@ -get: - summary: Get the alerting framework health - operationId: legacyGetAlertingHealth - deprecated: true - description: Deprecated in 7.13.0. Use the get alerting framework health API instead. - tags: - - alerting - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - alertingFrameworkHealth: - type: object - description: > - Three substates identify the health of the alerting framework: `decryptionHealth`, `executionHealth`, and `readHealth`. - properties: - decryptionHealth: - type: object - description: The timestamp and status of the alert decryption. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: "2023-01-13T01:28:00.280Z" - executionHealth: - type: object - description: The timestamp and status of the alert execution. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: "2023-01-13T01:28:00.280Z" - readHealth: - type: object - description: The timestamp and status of the alert reading events. - properties: - status: - type: string - example: ok - enum: - - error - - ok - - warn - timestamp: - type: string - format: date-time - example: "2023-01-13T01:28:00.280Z" - hasPermanentEncryptionKey: - type: boolean - description: If `false`, the encrypted saved object plugin does not have a permanent encryption key. - example: true - isSufficientlySecure: - type: boolean - description: If `false`, security is enabled but TLS is not. - example: true - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}.yaml deleted file mode 100644 index bf6d69d117450..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}.yaml +++ /dev/null @@ -1,275 +0,0 @@ -delete: - summary: Delete an alert - operationId: legaryDeleteAlert - deprecated: true - description: > - Deprecated in 7.13.0. Use the delete rule API instead. - WARNING: After you delete an alert, you cannot recover it. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' - -get: - summary: Get an alert by identifier - operationId: legacyGetAlert - deprecated: true - description: Deprecated in 7.13.0. Use the get rule API instead. - tags: - - alerting - parameters: - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '../components/schemas/alert_response_properties.yaml' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' - -post: - summary: Create an alert - operationId: legacyCreateAlert - deprecated: true - description: Deprecated in 7.13.0. Use the create rule API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: An UUID v1 or v4 identifier for the alert. If this parameter is omitted, the identifier is randomly generated. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - requestBody: - required: true - content: - application/json: - schema: - title: Legacy create alert request properties - type: object - required: - - alertTypeId - - consumer - - name - - notifyWhen - - params - - schedule - properties: - actions: - type: array - items: - type: object - required: - - actionTypeId - - group - - id - - params - properties: - actionTypeId: - type: string - description: The identifier for the action type. - group: - type: string - description: > - Grouping actions is recommended for escalations for different types of alert instances. - If you don't need this functionality, set it to `default`. - id: - type: string - description: The ID of the action saved object. - params: - type: object - description: > - The map to the `params` that the action type will receive. - `params` are handled as Mustache templates and passed a default set of context. - alertTypeId: - type: string - description: The ID of the alert type that you want to call when the alert is scheduled to run. - consumer: - type: string - description: The name of the application that owns the alert. This name has to match the Kibana feature name, as that dictates the required role-based access control privileges. - enabled: - type: boolean - description: Indicates if you want to run the alert on an interval basis after it is created. - name: - type: string - description: A name to reference and search. - notifyWhen: - type: string - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - params: - type: object - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - schedule: - type: object - description: > - The schedule specifying when this alert should be run. - A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - properties: - interval: - type: string - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: "10s" - tags: - type: array - items: - type: string - description: A list of keywords to reference and search. - throttle: - type: string - description: > - How often this alert should fire the same actions. - This will prevent the alert from sending out the same notification over and over. - For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, - setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '../components/schemas/alert_response_properties.yaml' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' - -put: - summary: Update an alert - operationId: legacyUpdateAlert - deprecated: true - description: Deprecated in 7.13.0. Use the update rule API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - requestBody: - required: true - content: - application/json: - schema: - title: Legacy update alert request properties - type: object - required: - - name - - notifyWhen - - params - - schedule - properties: - actions: - type: array - items: - type: object - required: - - actionTypeId - - group - - id - - params - properties: - actionTypeId: - type: string - description: The identifier for the action type. - group: - type: string - description: > - Grouping actions is recommended for escalations for different types of alert instances. - If you don't need this functionality, set it to `default`. - id: - type: string - description: The ID of the action saved object. - params: - type: object - description: > - The map to the `params` that the action type will receive. - `params` are handled as Mustache templates and passed a default set of context. - name: - type: string - description: A name to reference and search. - notifyWhen: - type: string - description: The condition for throttling the notification. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - params: - type: object - description: The parameters to pass to the alert type executor `params` value. This will also validate against the alert type params validator, if defined. - schedule: - type: object - description: > - The schedule specifying when this alert should be run. - A schedule is structured such that the key specifies the format you wish to use and its value specifies the schedule. - properties: - interval: - type: string - description: The interval format specifies the interval in seconds, minutes, hours or days at which the alert should run. - example: "1d" - tags: - type: array - items: - type: string - description: A list of keywords to reference and search. - throttle: - type: string - description: > - How often this alert should fire the same actions. - This will prevent the alert from sending out the same notification over and over. - For example, if an alert with a schedule of 1 minute stays in a triggered state for 90 minutes, - setting a throttle of `10m` or `1h` will prevent it from sending 90 notifications during this period. - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - $ref: '../components/schemas/alert_response_properties.yaml' - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_disable.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_disable.yaml deleted file mode 100644 index 70874a8bea396..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_disable.yaml +++ /dev/null @@ -1,25 +0,0 @@ -post: - summary: Disable an alert - operationId: legacyDisableAlert - deprecated: true - description: Deprecated in 7.13.0. Use the disable rule API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_enable.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_enable.yaml deleted file mode 100644 index 3b79778c26c6c..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_enable.yaml +++ /dev/null @@ -1,25 +0,0 @@ -post: - summary: Enable an alert - operationId: legacyEnableAlert - deprecated: true - description: Deprecated in 7.13.0. Use the enable rule API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_mute_all.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_mute_all.yaml deleted file mode 100644 index 462e6994d4553..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_mute_all.yaml +++ /dev/null @@ -1,25 +0,0 @@ -post: - summary: Mute all alert instances - operationId: legacyMuteAllAlertInstances - deprecated: true - description: Deprecated in 7.13.0. Use the mute all alerts API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_unmute_all.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_unmute_all.yaml deleted file mode 100644 index bfdec84525aae..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@_unmute_all.yaml +++ /dev/null @@ -1,25 +0,0 @@ -post: - summary: Unmute all alert instances - operationId: legacyUnmuteAllAlertInstances - deprecated: true - description: Deprecated in 7.13.0. Use the unmute all alerts API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: The identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_mute.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_mute.yaml deleted file mode 100644 index 4af89ec42616c..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_mute.yaml +++ /dev/null @@ -1,32 +0,0 @@ -post: - summary: Mute an alert instance - operationId: legacyMuteAlertInstance - deprecated: true - description: Deprecated in 7.13.0. Use the mute alert API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: An identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - - in: path - name: alertInstanceId - description: An identifier for the alert instance. - required: true - schema: - type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_unmute.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_unmute.yaml deleted file mode 100644 index a939d74c3d1d0..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@alert@{alertid}@alert_instance@{alertinstanceid}@_unmute.yaml +++ /dev/null @@ -1,32 +0,0 @@ -post: - summary: Unmute an alert instance - operationId: legacyUnmuteAlertInstance - deprecated: true - description: Deprecated in 7.13.0. Use the unmute alert API instead. - tags: - - alerting - parameters: - - $ref: ../components/headers/kbn_xsrf.yaml - - in: path - name: alertId - description: An identifier for the alert. - required: true - schema: - type: string - example: 41893910-6bca-11eb-9e0d-85d233e3ee35 - - in: path - name: alertInstanceId - description: An identifier for the alert instance. - required: true - schema: - type: string - example: dceeb5d0-6b41-11eb-802b-85b0c1bc8ba2 - responses: - '204': - description: Indicates a successful call. - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@list_alert_types.yaml b/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@list_alert_types.yaml deleted file mode 100644 index 14b3cd4e07b9b..0000000000000 --- a/x-pack/plugins/alerting/docs/openapi/paths/api@alerts@list_alert_types.yaml +++ /dev/null @@ -1,107 +0,0 @@ -get: - summary: Get the alert types - operationId: legacyGetAlertTypes - deprecated: true - description: Deprecated in 7.13.0. Use the get rule types API instead. - tags: - - alerting - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: array - items: - type: object - properties: - actionGroups: - description: > - An explicit list of groups for which the alert type can - schedule actions, each with the action group's unique ID and - human readable name. Alert actions validation uses this - configuration to ensure that groups are valid. - type: array - items: - type: object - properties: - id: - type: string - name: - type: string - actionVariables: - description: > - A list of action variables that the alert type makes available - via context and state in action parameter templates, and a - short human readable description. The Alert UI will use this - information to prompt users for these variables in action - parameter editors. - type: object - properties: - context: - type: array - items: - type: object - properties: - name: - type: string - description: - type: string - params: - type: array - items: - type: object - properties: - description: - type: string - name: - type: string - state: - type: array - items: - type: object - properties: - description: - type: string - name: - type: string - authorizedConsumers: - description: The list of the plugins IDs that have access to the alert type. - type: object - defaultActionGroupId: - description: The default identifier for the alert type group. - type: string - enabledInLicense: - description: Indicates whether the rule type is enabled based on the subscription. - type: boolean - id: - description: The unique identifier for the alert type. - type: string - isExportable: - description: Indicates whether the alert type is exportable in Saved Objects Management UI. - type: boolean - minimumLicenseRequired: - description: The subscriptions required to use the alert type. - type: string - name: - description: The descriptive name of the alert type. - type: string - producer: - description: An identifier for the application that produces this alert type. - type: string - recoveryActionGroup: - description: > - An action group to use when an alert instance goes from an active state to an inactive one. - If it is not specified, the default recovered action group is used. - type: object - properties: - id: - type: string - name: - type: string - '401': - description: Authorization information is missing or invalid. - content: - application/json: - schema: - $ref: '../components/schemas/401_response.yaml' \ No newline at end of file diff --git a/x-pack/plugins/alerting/server/routes/index.ts b/x-pack/plugins/alerting/server/routes/index.ts index d9692dec9c0f8..58c6cda9f3b12 100644 --- a/x-pack/plugins/alerting/server/routes/index.ts +++ b/x-pack/plugins/alerting/server/routes/index.ts @@ -11,7 +11,6 @@ import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-p import type { ConfigSchema } from '@kbn/unified-search-plugin/server/config'; import { Observable } from 'rxjs'; import { GetAlertIndicesAlias, ILicenseState } from '../lib'; -import { defineLegacyRoutes } from './legacy'; import { AlertingRequestHandlerContext } from '../types'; import { createRuleRoute } from './rule/apis/create'; import { getRuleRoute, getInternalRuleRoute } from './rule/apis/get/get_rule_route'; @@ -94,10 +93,6 @@ export function defineRoutes(opts: RouteOptions) { getAlertIndicesAlias, } = opts; - // Legacy APIs - defineLegacyRoutes(opts); - - // Rule APIs createRuleRoute(opts); getRuleRoute(router, licenseState); getInternalRuleRoute(router, licenseState); diff --git a/x-pack/plugins/alerting/server/routes/legacy/create.test.ts b/x-pack/plugins/alerting/server/routes/legacy/create.test.ts deleted file mode 100644 index f3df843899f22..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/create.test.ts +++ /dev/null @@ -1,617 +0,0 @@ -/* - * 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 { createAlertRoute } from './create'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { Rule, RuleSystemAction } from '../../../common/rule'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('createAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - const createdAt = new Date(); - const updatedAt = new Date(); - - const mockedAlert = { - alertTypeId: '1', - consumer: 'bar', - name: 'abc', - schedule: { interval: '10s' }, - tags: ['foo'], - params: { - bar: true, - }, - throttle: '30s', - notifyWhen: 'onActionGroupChange', - actions: [ - { - group: 'default', - id: '2', - params: { - foo: true, - }, - }, - ], - }; - - const systemAction: RuleSystemAction = { - actionTypeId: 'test-2', - id: 'system_action-id', - params: { - foo: true, - }, - uuid: '123-456', - }; - - const createResult: Rule<{ bar: boolean }> = { - ...mockedAlert, - enabled: true, - muteAll: false, - createdBy: '', - updatedBy: '', - apiKey: '', - apiKeyOwner: '', - mutedInstanceIds: [], - notifyWhen: 'onActionGroupChange', - createdAt, - updatedAt, - id: '123', - actions: [ - { - ...mockedAlert.actions[0], - actionTypeId: 'test', - }, - ], - executionStatus: { - status: 'unknown', - lastExecutionDate: new Date('2020-08-20T19:23:38Z'), - }, - revision: 0, - }; - - it('creates an alert with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - expect(config.options?.access).toBe('public'); - - rulesClient.create.mockResolvedValueOnce(createResult); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - body: mockedAlert, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: createResult }); - - expect(mockUsageCounter.incrementCounter).not.toHaveBeenCalled(); - expect(rulesClient.create).toHaveBeenCalledTimes(1); - expect(rulesClient.create.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "1", - "consumer": "bar", - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "bar": true, - }, - "schedule": Object { - "interval": "10s", - }, - "tags": Array [ - "foo", - ], - "throttle": "30s", - }, - "options": Object { - "id": undefined, - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: createResult, - }); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - isServerless: true, - docLinks, - }); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - expect(config.options?.access).toBe('internal'); - }); - - it('allows providing a custom id when space is undefined', async () => { - const expectedResult = { - ...createResult, - id: 'custom-id', - }; - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - rulesClient.create.mockResolvedValueOnce(expectedResult); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: 'custom-id' }, - body: mockedAlert, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: expectedResult }); - - expect(mockUsageCounter.incrementCounter).toHaveBeenCalledTimes(1); - expect(rulesClient.create).toHaveBeenCalledTimes(1); - expect(rulesClient.create.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "1", - "consumer": "bar", - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "bar": true, - }, - "schedule": Object { - "interval": "10s", - }, - "tags": Array [ - "foo", - ], - "throttle": "30s", - }, - "options": Object { - "id": "custom-id", - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: expectedResult, - }); - }); - - it('allows providing a custom id in default space', async () => { - const expectedResult = { - ...createResult, - id: 'custom-id', - }; - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - rulesClient.create.mockResolvedValueOnce(expectedResult); - rulesClient.getSpaceId.mockReturnValueOnce('default'); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: 'custom-id' }, - body: mockedAlert, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: expectedResult }); - - expect(mockUsageCounter.incrementCounter).toHaveBeenCalledTimes(1); - expect(rulesClient.create).toHaveBeenCalledTimes(1); - expect(rulesClient.create.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "1", - "consumer": "bar", - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "bar": true, - }, - "schedule": Object { - "interval": "10s", - }, - "tags": Array [ - "foo", - ], - "throttle": "30s", - }, - "options": Object { - "id": "custom-id", - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: expectedResult, - }); - }); - - it('allows providing a custom id in non-default space', async () => { - const expectedResult = { - ...createResult, - id: 'custom-id', - }; - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - rulesClient.create.mockResolvedValueOnce(expectedResult); - rulesClient.getSpaceId.mockReturnValueOnce('another-space'); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: 'custom-id' }, - body: mockedAlert, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: expectedResult }); - - expect(mockUsageCounter.incrementCounter).toHaveBeenCalledTimes(2); - expect(rulesClient.create).toHaveBeenCalledTimes(1); - expect(rulesClient.create.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "1", - "consumer": "bar", - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "bar": true, - }, - "schedule": Object { - "interval": "10s", - }, - "tags": Array [ - "foo", - ], - "throttle": "30s", - }, - "options": Object { - "id": "custom-id", - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: expectedResult, - }); - }); - - it('ensures the license allows creating alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - - createAlertRoute({ router, licenseState, encryptedSavedObjects, docLinks }); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.create.mockResolvedValueOnce(createResult); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, {}); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents creating alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - createAlertRoute({ router, licenseState, encryptedSavedObjects, docLinks }); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.create.mockResolvedValueOnce(createResult); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, {}); - - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - - createAlertRoute({ router, licenseState, encryptedSavedObjects, docLinks }); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.create.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, {}, ['ok', 'forbidden']); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - const [, handler] = router.post.mock.calls[0]; - rulesClient.create.mockResolvedValueOnce(createResult); - const [context, req, res] = mockHandlerArguments({ rulesClient }, {}, ['ok']); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('create', mockUsageCounter); - }); - - it('does not return system actions', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id?}"`); - - rulesClient.create.mockResolvedValueOnce({ ...createResult, systemActions: [systemAction] }); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - body: mockedAlert, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: createResult }); - - expect(mockUsageCounter.incrementCounter).not.toHaveBeenCalled(); - expect(rulesClient.create).toHaveBeenCalledTimes(1); - expect(rulesClient.create.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "foo": true, - }, - }, - ], - "alertTypeId": "1", - "consumer": "bar", - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "bar": true, - }, - "schedule": Object { - "interval": "10s", - }, - "tags": Array [ - "foo", - ], - "throttle": "30s", - }, - "options": Object { - "id": undefined, - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: createResult, - }); - }); - - it('should be deprecated', () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - createAlertRoute({ - router, - licenseState, - encryptedSavedObjects, - usageCounter: mockUsageCounter, - docLinks, - }); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id?}", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/create.ts b/x-pack/plugins/alerting/server/routes/legacy/create.ts deleted file mode 100644 index 7e18897554431..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/create.ts +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { validateDurationSchema } from '../../lib'; -import { handleDisabledApiKeysError } from '../lib/error_handler'; -import { - SanitizedRule, - RuleNotifyWhenType, - RuleTypeParams, - LEGACY_BASE_ALERT_API_PATH, - validateNotifyWhenType, -} from '../../types'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { RouteOptions } from '..'; -import { countUsageOfPredefinedIds } from '../lib'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -export const bodySchema = schema.object({ - name: schema.string(), - alertTypeId: schema.string(), - enabled: schema.boolean({ defaultValue: true }), - consumer: schema.string(), - tags: schema.arrayOf(schema.string(), { defaultValue: [] }), - throttle: schema.nullable(schema.string({ validate: validateDurationSchema })), - params: schema.recordOf(schema.string(), schema.any(), { defaultValue: {} }), - schedule: schema.object({ - interval: schema.string({ validate: validateDurationSchema }), - }), - actions: schema.arrayOf( - schema.object({ - group: schema.string(), - id: schema.string(), - actionTypeId: schema.maybe(schema.string()), - params: schema.recordOf(schema.string(), schema.any(), { defaultValue: {} }), - }), - { defaultValue: [] } - ), - notifyWhen: schema.nullable(schema.string({ validate: validateNotifyWhenType })), -}); - -export const createAlertRoute = ({ - router, - licenseState, - usageCounter, - isServerless, - docLinks, -}: RouteOptions) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id?}`, - validate: { - params: schema.maybe( - schema.object({ - id: schema.maybe(schema.string()), - }) - ), - body: bodySchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Create an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id?}', - }, - }, - }, - }, - handleDisabledApiKeysError( - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const alert = req.body; - const params = req.params; - const notifyWhen = alert?.notifyWhen ? (alert.notifyWhen as RuleNotifyWhenType) : null; - - trackLegacyRouteUsage('create', usageCounter); - - countUsageOfPredefinedIds({ - predefinedId: params?.id, - spaceId: rulesClient.getSpaceId(), - usageCounter, - }); - - try { - const { systemActions, ...alertRes }: SanitizedRule = - await rulesClient.create({ - data: { ...alert, notifyWhen }, - options: { id: params?.id }, - }); - return res.ok({ - body: alertRes, - }); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/delete.test.ts b/x-pack/plugins/alerting/server/routes/legacy/delete.test.ts deleted file mode 100644 index d8fd0effc50e4..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/delete.test.ts +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { deleteAlertRoute } from './delete'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('deleteAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('deletes an alert with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - deleteAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.delete.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('public'); - - rulesClient.delete.mockResolvedValueOnce({}); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.delete).toHaveBeenCalledTimes(1); - expect(rulesClient.delete.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - deleteAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.delete.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the license allows deleting alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - deleteAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.delete.mock.calls[0]; - - rulesClient.delete.mockResolvedValueOnce({}); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - } - ); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents deleting alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - deleteAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.delete.mock.calls[0]; - - rulesClient.delete.mockResolvedValueOnce({}); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - id: '1', - } - ); - - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - deleteAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.delete.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('delete', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - deleteAlertRoute(router, licenseState, docLinks); - - const [config] = router.delete.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "DELETE", - "newApiPath": "/api/alerting/rule/{id}", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/delete.ts b/x-pack/plugins/alerting/server/routes/legacy/delete.ts deleted file mode 100644 index 6afa7474d81e6..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/delete.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const deleteAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.delete( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Delete an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'DELETE', - newApiPath: '/api/alerting/rule/{id}', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('delete', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - await rulesClient.delete({ id }); - return res.noContent(); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/disable.test.ts b/x-pack/plugins/alerting/server/routes/legacy/disable.test.ts deleted file mode 100644 index 13fec185429ed..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/disable.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { disableAlertRoute } from './disable'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('disableAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('disables an alert', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - disableAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_disable"`); - expect(config.options?.access).toBe('public'); - - rulesClient.disableRule.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.disableRule).toHaveBeenCalledTimes(1); - expect(rulesClient.disableRule.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - disableAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_disable"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - disableAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.disableRule.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - disableAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('disable', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - disableAlertRoute(router, licenseState, docLinks); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id}/_disable", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/disable.ts b/x-pack/plugins/alerting/server/routes/legacy/disable.ts deleted file mode 100644 index 77fe548d06dac..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/disable.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const disableAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_disable`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Disable an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id}/_disable', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('disable', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - try { - await rulesClient.disableRule({ id }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/enable.test.ts b/x-pack/plugins/alerting/server/routes/legacy/enable.test.ts deleted file mode 100644 index 88df304ea07c0..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/enable.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { enableAlertRoute } from './enable'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('enableAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('enables an alert', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - enableAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_enable"`); - expect(config.options?.access).toBe('public'); - - rulesClient.enableRule.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.enableRule).toHaveBeenCalledTimes(1); - expect(rulesClient.enableRule.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - enableAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_enable"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - enableAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.enableRule.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - enableAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('enable', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - enableAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id}/_enable", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/enable.ts b/x-pack/plugins/alerting/server/routes/legacy/enable.ts deleted file mode 100644 index 954c8bc727174..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/enable.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { handleDisabledApiKeysError } from '../lib/error_handler'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const enableAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_enable`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Enable an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id}/_enable', - }, - }, - }, - }, - handleDisabledApiKeysError( - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('enable', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - try { - await rulesClient.enableRule({ id }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/find.test.ts b/x-pack/plugins/alerting/server/routes/legacy/find.test.ts deleted file mode 100644 index 646f18fa072ea..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/find.test.ts +++ /dev/null @@ -1,439 +0,0 @@ -/* - * 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 { omit } from 'lodash'; -import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { findAlertRoute } from './find'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { trackLegacyTerminology } from '../lib/track_legacy_terminology'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -jest.mock('../lib/track_legacy_terminology', () => ({ - trackLegacyTerminology: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('findAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('finds alerts with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - findAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_find"`); - expect(config.options?.access).toBe('public'); - - const findResult = { - page: 1, - perPage: 1, - total: 0, - data: [], - }; - rulesClient.find.mockResolvedValueOnce(findResult); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - query: { - per_page: 1, - page: 1, - default_search_operator: 'OR', - }, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toMatchInlineSnapshot(` - Object { - "body": Object { - "data": Array [], - "page": 1, - "perPage": 1, - "total": 0, - }, - } - `); - - expect(rulesClient.find).toHaveBeenCalledTimes(1); - expect(rulesClient.find.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "excludeFromPublicApi": true, - "options": Object { - "defaultSearchOperator": "OR", - "page": 1, - "perPage": 1, - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: findResult, - }); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - findAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_find"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the license allows finding alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - findAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.get.mock.calls[0]; - - rulesClient.find.mockResolvedValueOnce({ - page: 1, - perPage: 1, - total: 0, - data: [], - }); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - query: { - per_page: 1, - page: 1, - default_search_operator: 'OR', - }, - } - ); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents finding alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - findAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - {}, - { - query: { - per_page: 1, - page: 1, - default_search_operator: 'OR', - }, - }, - ['ok'] - ); - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - findAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - const findResult = { - page: 1, - perPage: 1, - total: 0, - data: [], - }; - rulesClient.find.mockResolvedValueOnce(findResult); - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, query: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('find', mockUsageCounter); - }); - - it('should track calls with deprecated param values', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - findAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - - const findResult = { - page: 1, - perPage: 1, - total: 0, - data: [], - }; - rulesClient.find.mockResolvedValueOnce(findResult); - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: {}, - query: { - search_fields: ['alertTypeId:1', 'message:foo'], - search: 'alertTypeId:2', - sort_field: 'alertTypeId', - }, - }, - ['ok'] - ); - await handler(context, req, res); - expect(trackLegacyTerminology).toHaveBeenCalledTimes(1); - expect((trackLegacyTerminology as jest.Mock).mock.calls[0][0]).toStrictEqual([ - 'alertTypeId:2', - ['alertTypeId:1', 'message:foo'], - 'alertTypeId', - ]); - }); - - it('should track calls to deprecated functionality', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - findAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - const findResult = { - page: 1, - perPage: 1, - total: 0, - data: [], - }; - rulesClient.find.mockResolvedValueOnce(findResult); - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: {}, - query: { - fields: ['foo', 'bar'], - }, - }, - ['ok'] - ); - await handler(context, req, res); - expect(mockUsageCounter.incrementCounter).toHaveBeenCalledWith({ - counterName: `legacyAlertingFieldsUsage`, - counterType: 'alertingFieldsUsage', - incrementBy: 1, - }); - }); - - it('does not return system actions', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - findAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_find"`); - - const findResult = { - page: 1, - perPage: 1, - total: 0, - data: [ - { - id: '3d534c70-582b-11ec-8995-2b1578a3bc5d', - notifyWhen: 'onActiveAlert' as const, - alertTypeId: '.index-threshold', - name: 'stressing index-threshold 37/200', - consumer: 'alerts', - tags: [], - enabled: true, - throttle: null, - apiKey: null, - apiKeyOwner: '2889684073', - createdBy: 'elastic', - updatedBy: '2889684073', - muteAll: false, - mutedInstanceIds: [], - schedule: { - interval: '1s', - }, - actions: [ - { - actionTypeId: '.server-log', - params: { - message: 'alert 37: {{context.message}}', - }, - group: 'threshold met', - id: '3619a0d0-582b-11ec-8995-2b1578a3bc5d', - uuid: '123-456', - }, - ], - systemActions: [ - { actionTypeId: '.test', id: 'system_action-id', params: {}, uuid: '789' }, - ], - params: { x: 42 }, - updatedAt: '2024-03-21T13:15:00.498Z', - createdAt: '2024-03-21T13:15:00.498Z', - scheduledTaskId: '52125fb0-5895-11ec-ae69-bb65d1a71b72', - executionStatus: { - status: 'ok' as const, - lastExecutionDate: '2024-03-21T13:15:00.498Z', - lastDuration: 1194, - }, - revision: 0, - }, - ], - }; - - // @ts-expect-error: TS complains about dates being string and not a Date object - rulesClient.find.mockResolvedValueOnce(findResult); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - query: { - per_page: 1, - page: 1, - default_search_operator: 'OR', - }, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toMatchInlineSnapshot(` - Object { - "body": Object { - "data": Array [ - Object { - "actions": Array [ - Object { - "actionTypeId": ".server-log", - "group": "threshold met", - "id": "3619a0d0-582b-11ec-8995-2b1578a3bc5d", - "params": Object { - "message": "alert 37: {{context.message}}", - }, - "uuid": "123-456", - }, - ], - "alertTypeId": ".index-threshold", - "apiKey": null, - "apiKeyOwner": "2889684073", - "consumer": "alerts", - "createdAt": "2024-03-21T13:15:00.498Z", - "createdBy": "elastic", - "enabled": true, - "executionStatus": Object { - "lastDuration": 1194, - "lastExecutionDate": "2024-03-21T13:15:00.498Z", - "status": "ok", - }, - "id": "3d534c70-582b-11ec-8995-2b1578a3bc5d", - "muteAll": false, - "mutedInstanceIds": Array [], - "name": "stressing index-threshold 37/200", - "notifyWhen": "onActiveAlert", - "params": Object { - "x": 42, - }, - "revision": 0, - "schedule": Object { - "interval": "1s", - }, - "scheduledTaskId": "52125fb0-5895-11ec-ae69-bb65d1a71b72", - "tags": Array [], - "throttle": null, - "updatedAt": "2024-03-21T13:15:00.498Z", - "updatedBy": "2889684073", - }, - ], - "page": 1, - "perPage": 1, - "total": 0, - }, - } - `); - - expect(rulesClient.find).toHaveBeenCalledTimes(1); - expect(rulesClient.find.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "excludeFromPublicApi": true, - "options": Object { - "defaultSearchOperator": "OR", - "page": 1, - "perPage": 1, - }, - }, - ] - `); - - expect(res.ok).toHaveBeenCalledWith({ - body: omit(findResult, 'data[0].systemActions'), - }); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - findAlertRoute(router, licenseState, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "GET", - "newApiPath": "/api/alerting/rules/_find", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/find.ts b/x-pack/plugins/alerting/server/routes/legacy/find.ts deleted file mode 100644 index ece93d082f785..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/find.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { estypes } from '@elastic/elasticsearch'; -import { KueryNode } from '@kbn/es-query'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; - -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { renameKeys } from '../lib/rename_keys'; -import { IndexType } from '../../rules_client'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { trackLegacyTerminology } from '../lib/track_legacy_terminology'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -export interface FindOptions extends IndexType { - perPage?: number; - page?: number; - search?: string; - defaultSearchOperator?: 'AND' | 'OR'; - searchFields?: string[]; - sortField?: string; - sortOrder?: estypes.SortOrder; - hasReference?: { - type: string; - id: string; - }; - fields?: string[]; - filter?: string | KueryNode; - filterConsumers?: string[]; -} - -// config definition -const querySchema = schema.object({ - per_page: schema.number({ defaultValue: 10, min: 0 }), - page: schema.number({ defaultValue: 1, min: 1 }), - search: schema.maybe(schema.string()), - default_search_operator: schema.oneOf([schema.literal('OR'), schema.literal('AND')], { - defaultValue: 'OR', - }), - search_fields: schema.maybe(schema.oneOf([schema.arrayOf(schema.string()), schema.string()])), - sort_field: schema.maybe(schema.string()), - sort_order: schema.maybe(schema.oneOf([schema.literal('asc'), schema.literal('desc')])), - has_reference: schema.maybe( - // use nullable as maybe is currently broken - // in config-schema - schema.nullable( - schema.object({ - type: schema.string(), - id: schema.string(), - }) - ) - ), - fields: schema.maybe(schema.arrayOf(schema.string())), - filter: schema.maybe(schema.string()), -}); - -export const findAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.get( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/_find`, - validate: { - query: querySchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Find alerts', - tags: ['oas-tag:alerting'], - description: - 'Gets a paginated set of alerts. Alert `params` are stored as a flattened field type and analyzed as keywords. As alerts change in Kibana, the results on each page of the response also change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data.', - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'GET', - newApiPath: '/api/alerting/rules/_find', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('find', usageCounter); - trackLegacyTerminology( - [req.query.search, req.query.search_fields, req.query.sort_field].filter( - Boolean - ) as string[], - usageCounter - ); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - - const query = req.query; - const renameMap = { - default_search_operator: 'defaultSearchOperator', - fields: 'fields', - has_reference: 'hasReference', - page: 'page', - per_page: 'perPage', - search: 'search', - sort_field: 'sortField', - sort_order: 'sortOrder', - filter: 'filter', - }; - - const options = renameKeys>(renameMap, query); - - if (query.search_fields) { - options.searchFields = Array.isArray(query.search_fields) - ? query.search_fields - : [query.search_fields]; - } - - if (query.fields) { - usageCounter?.incrementCounter({ - counterName: `legacyAlertingFieldsUsage`, - counterType: 'alertingFieldsUsage', - incrementBy: 1, - }); - } - - const findResult = await rulesClient.find({ options, excludeFromPublicApi: true }); - return res.ok({ - body: { - ...findResult, - data: findResult.data.map(({ systemActions, ...rule }) => rule), - }, - }); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get.test.ts b/x-pack/plugins/alerting/server/routes/legacy/get.test.ts deleted file mode 100644 index ca8154fc7adae..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get.test.ts +++ /dev/null @@ -1,243 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { getAlertRoute } from './get'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { Rule, RuleSystemAction } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('getAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - const mockedAlert: Rule<{ - bar: true; - }> = { - id: '1', - alertTypeId: '1', - schedule: { interval: '10s' }, - params: { - bar: true, - }, - createdAt: new Date(), - updatedAt: new Date(), - actions: [ - { - group: 'default', - id: '2', - actionTypeId: 'test', - params: { - foo: true, - }, - }, - ], - consumer: 'bar', - name: 'abc', - tags: ['foo'], - enabled: true, - muteAll: false, - notifyWhen: 'onActionGroupChange', - createdBy: '', - updatedBy: '', - apiKey: '', - apiKeyOwner: '', - throttle: '30s', - mutedInstanceIds: [], - executionStatus: { - status: 'unknown', - lastExecutionDate: new Date('2020-08-20T19:23:38Z'), - }, - revision: 0, - }; - - const systemAction: RuleSystemAction = { - actionTypeId: 'test-2', - id: 'system_action-id', - params: { - foo: true, - }, - uuid: '123-456', - }; - - it('gets an alert with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertRoute(router, licenseState, docLinks); - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('public'); - - rulesClient.get.mockResolvedValueOnce(mockedAlert); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - await handler(context, req, res); - - expect(rulesClient.get).toHaveBeenCalledTimes(1); - expect(rulesClient.get.mock.calls[0][0].id).toEqual('1'); - - expect(res.ok).toHaveBeenCalledWith({ - body: mockedAlert, - }); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertRoute(router, licenseState, docLinks, undefined, true); - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the license allows getting alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.get.mock.calls[0]; - - rulesClient.get.mockResolvedValueOnce(mockedAlert); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents getting alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - getAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.get.mock.calls[0]; - - rulesClient.get.mockResolvedValueOnce(mockedAlert); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - getAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - - rulesClient.get.mockResolvedValueOnce(mockedAlert); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('get', mockUsageCounter); - }); - - it('does not return system actions', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertRoute(router, licenseState, docLinks); - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - - rulesClient.get.mockResolvedValueOnce({ ...mockedAlert, systemActions: [systemAction] }); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - await handler(context, req, res); - - expect(rulesClient.get).toHaveBeenCalledTimes(1); - expect(rulesClient.get.mock.calls[0][0].id).toEqual('1'); - - expect(res.ok).toHaveBeenCalledWith({ - body: mockedAlert, - }); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertRoute(router, licenseState, docLinks); - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "GET", - "newApiPath": "/api/alerting/rule/{id}", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/get.ts b/x-pack/plugins/alerting/server/routes/legacy/get.ts deleted file mode 100644 index f1f83a5084c44..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import type { AlertingRouter } from '../../types'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const getAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.get( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Get an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'GET', - newApiPath: '/api/alerting/rule/{id}', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('get', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - const { systemActions, ...rule } = await rulesClient.get({ id, excludeFromPublicApi: true }); - return res.ok({ - body: rule, - }); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts deleted file mode 100644 index cc3deaad9af99..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.test.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { getAlertInstanceSummaryRoute } from './get_alert_instance_summary'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { SavedObjectsErrorHelpers } from '@kbn/core/server'; -import { rulesClientMock } from '../../rules_client.mock'; -import { AlertSummary } from '../../types'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('getAlertInstanceSummaryRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - const dateString = new Date().toISOString(); - const mockedAlertInstanceSummary: AlertSummary = { - id: '', - name: '', - tags: [], - ruleTypeId: '', - consumer: '', - muteAll: false, - throttle: null, - enabled: false, - statusStartDate: dateString, - statusEndDate: dateString, - status: 'OK', - errorMessages: [], - alerts: {}, - executionDuration: { - average: 0, - valuesWithTimestamp: {}, - }, - revision: 0, - }; - - it('gets alert instance summary', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertInstanceSummaryRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_instance_summary"`); - expect(config.options?.access).toBe('public'); - - rulesClient.getAlertSummary.mockResolvedValueOnce(mockedAlertInstanceSummary); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - query: {}, - }, - ['ok'] - ); - - await handler(context, req, res); - - expect(rulesClient.getAlertSummary).toHaveBeenCalledTimes(1); - expect(rulesClient.getAlertSummary.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "dateStart": undefined, - "id": "1", - }, - ] - `); - - expect(res.ok).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertInstanceSummaryRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_instance_summary"`); - expect(config.options?.access).toBe('internal'); - }); - - it('returns NOT-FOUND when alert is not found', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertInstanceSummaryRoute(router, licenseState, docLinks); - - const [, handler] = router.get.mock.calls[0]; - - rulesClient.getAlertSummary = jest - .fn() - .mockResolvedValueOnce( - SavedObjectsErrorHelpers.createGenericNotFoundError(RULE_SAVED_OBJECT_TYPE, '1') - ); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - query: {}, - }, - ['notFound'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - getAlertInstanceSummaryRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - - rulesClient.getAlertSummary.mockResolvedValueOnce(mockedAlertInstanceSummary); - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { params: { id: '1' }, query: {} }, - ['ok'] - ); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('instanceSummary', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertInstanceSummaryRoute(router, licenseState, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "type": "remove", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts deleted file mode 100644 index 918cdabc25a34..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_instance_summary.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { AlertSummary, LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -const querySchema = schema.object({ - dateStart: schema.maybe(schema.string()), -}); - -const rewriteBodyRes = ({ ruleTypeId, alerts, ...rest }: AlertSummary) => ({ - ...rest, - alertTypeId: ruleTypeId, - instances: alerts, -}); - -export const getAlertInstanceSummaryRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.get( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_instance_summary`, - validate: { - params: paramSchema, - query: querySchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Get an alert summary', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'remove', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('instanceSummary', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - const { dateStart } = req.query; - const summary = await rulesClient.getAlertSummary({ id, dateStart }); - - return res.ok({ body: rewriteBodyRes(summary) }); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.test.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.test.ts deleted file mode 100644 index ca79291b23dbc..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { getAlertStateRoute } from './get_alert_state'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { SavedObjectsErrorHelpers } from '@kbn/core/server'; -import { rulesClientMock } from '../../rules_client.mock'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { RULE_SAVED_OBJECT_TYPE } from '../../saved_objects'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('getAlertStateRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - const mockedAlertState = { - alertTypeState: { - some: 'value', - }, - alertInstances: { - first_instance: { - state: {}, - meta: { - lastScheduledActions: { - group: 'first_group', - date: new Date().toISOString(), - }, - }, - }, - second_instance: {}, - }, - }; - - it('gets alert state', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertStateRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`); - expect(config.options?.access).toBe('public'); - - rulesClient.getAlertState.mockResolvedValueOnce(mockedAlertState); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['ok'] - ); - - await handler(context, req, res); - - expect(rulesClient.getAlertState).toHaveBeenCalledTimes(1); - expect(rulesClient.getAlertState.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.ok).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertStateRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`); - expect(config.options?.access).toBe('internal'); - }); - - it('returns NO-CONTENT when alert exists but has no task state yet', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertStateRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`); - - rulesClient.getAlertState.mockResolvedValueOnce(undefined); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.getAlertState).toHaveBeenCalledTimes(1); - expect(rulesClient.getAlertState.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('returns NOT-FOUND when alert is not found', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertStateRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/state"`); - - rulesClient.getAlertState = jest - .fn() - .mockResolvedValueOnce( - SavedObjectsErrorHelpers.createGenericNotFoundError(RULE_SAVED_OBJECT_TYPE, '1') - ); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['notFound'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.getAlertState).toHaveBeenCalledTimes(1); - expect(rulesClient.getAlertState.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - getAlertStateRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('state', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - getAlertStateRoute(router, licenseState, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "type": "remove", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts b/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts deleted file mode 100644 index fbc82e560a45e..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/get_alert_state.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const getAlertStateRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.get( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/state`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Get the state of an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'remove', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('state', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - const state = await rulesClient.getAlertState({ id }); - return state ? res.ok({ body: state }) : res.noContent(); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.test.ts b/x-pack/plugins/alerting/server/routes/legacy/health.test.ts deleted file mode 100644 index fea24b831e97d..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/health.test.ts +++ /dev/null @@ -1,473 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { HealthStatus } from '@kbn/alerting-types'; -import { healthRoute } from './health'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RecoveredActionGroup } from '../../types'; -import { alertsMock } from '../../mocks'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { RegistryAlertTypeWithAuth } from '../../authorization'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -const alerting = alertsMock.createStart(); - -const currentDate = new Date().toISOString(); - -const ruleTypes = [ - { - id: '1', - name: 'name', - actionGroups: [ - { - id: 'default', - name: 'Default', - }, - ], - defaultActionGroupId: 'default', - minimumLicenseRequired: 'basic', - isExportable: true, - ruleTaskTimeout: '10m', - recoveryActionGroup: RecoveredActionGroup, - authorizedConsumers: {}, - actionVariables: { - context: [], - state: [], - }, - category: 'test', - producer: 'test', - enabledInLicense: true, - defaultScheduleInterval: '10m', - hasAlertsMappings: false, - hasFieldsForAAD: false, - validLegacyConsumers: [], - } as RegistryAlertTypeWithAuth, -]; - -beforeEach(() => { - jest.resetAllMocks(); - alerting.getFrameworkHealth.mockResolvedValue({ - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }); -}); - -describe('healthRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('registers the route', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_health"`); - expect(config.options?.access).toBe('public'); - }); - - it('should have internal access for serverless', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks, undefined, true); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/_health"`); - expect(config.options?.access).toBe('internal'); - }); - - it('throws error when user does not have any access to any rule types', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce([]); - const router = httpServiceMock.createRouter(); - - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: false }); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(true), - }, - {}, - ['ok'] - ); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ - body: { message: `Unauthorized to access alerting framework health` }, - }); - }); - - it('evaluates whether Encrypted Saved Objects is missing encryption key', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: false }); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(true), - }, - {}, - ['ok'] - ); - - expect(await handler(context, req, res)).toStrictEqual({ - body: { - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - _deprecated: 'This state property has a typo, use "alertingFrameworkHealth" instead.', - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - alertingFrameworkHealth: { - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - hasPermanentEncryptionKey: false, - isSufficientlySecure: true, - }, - }); - }); - - test('when ES security status cannot be determined from license state, isSufficientlySecure should return false', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - licenseState.getIsSecurityEnabled.mockReturnValueOnce(null); - - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(true), - }, - {}, - ['ok'] - ); - - expect(await handler(context, req, res)).toStrictEqual({ - body: { - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - _deprecated: 'This state property has a typo, use "alertingFrameworkHealth" instead.', - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - alertingFrameworkHealth: { - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - hasPermanentEncryptionKey: true, - isSufficientlySecure: false, - }, - }); - }); - - test('when ES security is disabled, isSufficientlySecure should return true', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - licenseState.getIsSecurityEnabled.mockReturnValueOnce(false); - - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(false), - }, - {}, - ['ok'] - ); - - expect(await handler(context, req, res)).toStrictEqual({ - body: { - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - _deprecated: 'This state property has a typo, use "alertingFrameworkHealth" instead.', - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - alertingFrameworkHealth: { - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - hasPermanentEncryptionKey: true, - isSufficientlySecure: true, - }, - }); - }); - - test('when ES security is enabled but user cannot generate api keys, isSufficientlySecure should return false', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - licenseState.getIsSecurityEnabled.mockReturnValueOnce(true); - - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(false), - }, - {}, - ['ok'] - ); - - expect(await handler(context, req, res)).toStrictEqual({ - body: { - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - _deprecated: 'This state property has a typo, use "alertingFrameworkHealth" instead.', - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - alertingFrameworkHealth: { - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - hasPermanentEncryptionKey: true, - isSufficientlySecure: false, - }, - }); - }); - - test('when ES security is enabled and user can generate api keys, isSufficientlySecure should return true', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - licenseState.getIsSecurityEnabled.mockReturnValueOnce(true); - - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - const [, handler] = router.get.mock.calls[0]; - - const [context, req, res] = mockHandlerArguments( - { - rulesClient, - getFrameworkHealth: alerting.getFrameworkHealth, - areApiKeysEnabled: () => Promise.resolve(true), - }, - {}, - ['ok'] - ); - - expect(await handler(context, req, res)).toStrictEqual({ - body: { - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - _deprecated: 'This state property has a typo, use "alertingFrameworkHealth" instead.', - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - alertingFrameworkHealth: { - decryptionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - executionHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - readHealth: { - status: HealthStatus.OK, - timestamp: currentDate, - }, - }, - hasPermanentEncryptionKey: true, - isSufficientlySecure: true, - }, - }); - }); - - it('should track every call', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - healthRoute(router, licenseState, encryptedSavedObjects, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: { id: '1' } }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('health', mockUsageCounter); - }); - - it('should be deprecated', async () => { - rulesClient.listRuleTypes.mockResolvedValueOnce(ruleTypes); - const router = httpServiceMock.createRouter(); - - const licenseState = licenseStateMock.create(); - const encryptedSavedObjects = encryptedSavedObjectsMock.createSetup({ canEncrypt: true }); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "GET", - "newApiPath": "/api/alerting/rule/_health", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/health.ts b/x-pack/plugins/alerting/server/routes/legacy/health.ts deleted file mode 100644 index 8b8a64df14cd1..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/health.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { EncryptedSavedObjectsPluginSetup } from '@kbn/encrypted-saved-objects-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { AlertingFrameworkHealth } from '../../types'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { getSecurityHealth } from '../../lib/get_security_health'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -export function healthRoute( - router: AlertingRouter, - licenseState: ILicenseState, - encryptedSavedObjects: EncryptedSavedObjectsPluginSetup, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) { - router.get( - { - path: '/api/alerts/_health', - validate: false, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Get the alerting framework health', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'GET', - newApiPath: '/api/alerting/rule/_health', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('health', usageCounter); - try { - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - // Verify that user has access to at least one rule type - const ruleTypes = Array.from(await rulesClient.listRuleTypes()); - if (ruleTypes.length > 0) { - const alertingFrameworkHealth = await alertingContext.getFrameworkHealth(); - - const securityHealth = await getSecurityHealth( - async () => (licenseState ? licenseState.getIsSecurityEnabled() : null), - async () => encryptedSavedObjects.canEncrypt, - alertingContext.areApiKeysEnabled - ); - - const frameworkHealth: AlertingFrameworkHealth = { - ...securityHealth, - alertingFrameworkHealth, - }; - - return res.ok({ - body: { - ...frameworkHealth, - alertingFrameworkHeath: { - // Legacy: pre-v8.0 typo - ...alertingFrameworkHealth, - _deprecated: - 'This state property has a typo, use "alertingFrameworkHealth" instead.', - }, - }, - }); - } else { - return res.forbidden({ - body: { message: `Unauthorized to access alerting framework health` }, - }); - } - } catch (error) { - return res.badRequest({ body: error }); - } - }) - ); -} diff --git a/x-pack/plugins/alerting/server/routes/legacy/index.ts b/x-pack/plugins/alerting/server/routes/legacy/index.ts deleted file mode 100644 index e9551d938e6c1..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 { createAlertRoute } from './create'; -import { deleteAlertRoute } from './delete'; -import { findAlertRoute } from './find'; -import { getAlertRoute } from './get'; -import { getAlertStateRoute } from './get_alert_state'; -import { getAlertInstanceSummaryRoute } from './get_alert_instance_summary'; -import { listAlertTypesRoute } from './list_alert_types'; -import { updateAlertRoute } from './update'; -import { enableAlertRoute } from './enable'; -import { disableAlertRoute } from './disable'; -import { updateApiKeyRoute } from './update_api_key'; -import { muteAlertInstanceRoute } from './mute_instance'; -import { unmuteAlertInstanceRoute } from './unmute_instance'; -import { muteAllAlertRoute } from './mute_all'; -import { unmuteAllAlertRoute } from './unmute_all'; -import { healthRoute } from './health'; -import { RouteOptions } from '..'; - -export function defineLegacyRoutes(opts: RouteOptions) { - const { router, licenseState, encryptedSavedObjects, usageCounter, isServerless, docLinks } = - opts; - - createAlertRoute(opts); - deleteAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - findAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - getAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - getAlertStateRoute(router, licenseState, docLinks, usageCounter, isServerless); - getAlertInstanceSummaryRoute(router, licenseState, docLinks, usageCounter, isServerless); - listAlertTypesRoute(router, licenseState, docLinks, usageCounter, isServerless); - updateAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - enableAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - disableAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - updateApiKeyRoute(router, licenseState, docLinks, usageCounter, isServerless); - muteAllAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - unmuteAllAlertRoute(router, licenseState, docLinks, usageCounter, isServerless); - muteAlertInstanceRoute(router, licenseState, docLinks, usageCounter, isServerless); - unmuteAlertInstanceRoute(router, licenseState, docLinks, usageCounter, isServerless); - healthRoute(router, licenseState, encryptedSavedObjects, docLinks, usageCounter, isServerless); -} diff --git a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts deleted file mode 100644 index 27e9d7ce44865..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.test.ts +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { listAlertTypesRoute } from './list_alert_types'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RecoveredActionGroup } from '../../../common'; -import { RegistryAlertTypeWithAuth } from '../../authorization'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); - -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('listAlertTypesRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - it('lists alert types with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - listAlertTypesRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`); - expect(config.options?.access).toBe('public'); - - const listTypes: RegistryAlertTypeWithAuth[] = [ - { - id: '1', - name: 'name', - actionGroups: [ - { - id: 'default', - name: 'Default', - }, - ], - defaultActionGroupId: 'default', - minimumLicenseRequired: 'basic', - isExportable: true, - recoveryActionGroup: RecoveredActionGroup, - authorizedConsumers: {}, - actionVariables: { - context: [], - state: [], - }, - category: 'test', - producer: 'test', - enabledInLicense: true, - hasAlertsMappings: false, - hasFieldsForAAD: false, - validLegacyConsumers: [], - }, - ]; - - rulesClient.listRuleTypes.mockResolvedValueOnce(listTypes); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, {}, ['ok']); - - expect(await handler(context, req, res)).toMatchInlineSnapshot(` - Object { - "body": Array [ - Object { - "actionGroups": Array [ - Object { - "id": "default", - "name": "Default", - }, - ], - "actionVariables": Object { - "context": Array [], - "state": Array [], - }, - "authorizedConsumers": Object {}, - "category": "test", - "defaultActionGroupId": "default", - "enabledInLicense": true, - "hasAlertsMappings": false, - "hasFieldsForAAD": false, - "id": "1", - "isExportable": true, - "minimumLicenseRequired": "basic", - "name": "name", - "producer": "test", - "recoveryActionGroup": Object { - "id": "recovered", - "name": "Recovered", - }, - "validLegacyConsumers": Array [], - }, - ], - } - `); - - expect(rulesClient.listRuleTypes).toHaveBeenCalledTimes(1); - - expect(res.ok).toHaveBeenCalledWith({ - body: listTypes, - }); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - listAlertTypesRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the license allows listing alert types', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - listAlertTypesRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`); - - const listTypes = [ - { - id: '1', - name: 'name', - actionGroups: [ - { - id: 'default', - name: 'Default', - }, - ], - defaultActionGroupId: 'default', - minimumLicenseRequired: 'basic', - isExportable: true, - recoveryActionGroup: RecoveredActionGroup, - authorizedConsumers: {}, - actionVariables: { - context: [], - state: [], - }, - category: 'test', - producer: 'alerts', - enabledInLicense: true, - hasAlertsMappings: false, - hasFieldsForAAD: false, - validLegacyConsumers: [], - } as RegistryAlertTypeWithAuth, - ]; - - rulesClient.listRuleTypes.mockResolvedValueOnce(listTypes); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents listing alert types', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - listAlertTypesRoute(router, licenseState, docLinks); - - const [config, handler] = router.get.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/list_alert_types"`); - - const listTypes = [ - { - id: '1', - name: 'name', - actionGroups: [ - { - id: 'default', - name: 'Default', - }, - ], - defaultActionGroupId: 'default', - minimumLicenseRequired: 'basic', - isExportable: true, - recoveryActionGroup: RecoveredActionGroup, - authorizedConsumers: {}, - actionVariables: { - context: [], - state: [], - }, - category: 'test', - producer: 'alerts', - enabledInLicense: true, - hasAlertsMappings: false, - hasFieldsForAAD: false, - validLegacyConsumers: [], - } as RegistryAlertTypeWithAuth, - ]; - - rulesClient.listRuleTypes.mockResolvedValueOnce(listTypes); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { id: '1' }, - }, - ['ok'] - ); - - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - rulesClient.listRuleTypes.mockResolvedValueOnce([]); - - listAlertTypesRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.get.mock.calls[0]; - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { params: { id: '1' }, body: {} }, - ['ok'] - ); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('listAlertTypes', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - listAlertTypesRoute(router, licenseState, docLinks); - - const [config] = router.get.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "GET", - "newApiPath": "/api/alerting/rule_types", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts b/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts deleted file mode 100644 index 6e6b4e3499f72..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/list_alert_types.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -export const listAlertTypesRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.get( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/list_alert_types`, - validate: {}, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Get the alert types', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'GET', - newApiPath: '/api/alerting/rule_types', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('listAlertTypes', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - - return res.ok({ - body: Array.from(await rulesClient.listRuleTypes()), - }); - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_all.test.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_all.test.ts deleted file mode 100644 index d80cf415283d0..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_all.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { muteAllAlertRoute } from './mute_all'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('muteAllAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('mute an alert', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAllAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_mute_all"`); - expect(config.options?.access).toBe('public'); - - rulesClient.muteAll.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.muteAll).toHaveBeenCalledTimes(1); - expect(rulesClient.muteAll.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAllAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_mute_all"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAllAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.muteAll.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - muteAllAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('muteAll', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAllAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id}/_mute_all", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts deleted file mode 100644 index b978cc223b88b..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_all.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const muteAllAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_mute_all`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Mute all alert instances', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id}/_mute_all', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('muteAll', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - try { - await rulesClient.muteAll({ id }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.test.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.test.ts deleted file mode 100644 index 08e03a6d053ef..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.test.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { muteAlertInstanceRoute } from './mute_instance'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('muteAlertInstanceRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('mutes an alert instance', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAlertInstanceRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot( - `"/api/alerts/alert/{alert_id}/alert_instance/{alert_instance_id}/_mute"` - ); - expect(config.options?.access).toBe('public'); - - rulesClient.muteInstance.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - alert_id: '1', - alert_instance_id: '2', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.muteInstance).toHaveBeenCalledTimes(1); - expect(rulesClient.muteInstance.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "alertId": "1", - "alertInstanceId": "2", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAlertInstanceRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot( - `"/api/alerts/alert/{alert_id}/alert_instance/{alert_instance_id}/_mute"` - ); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAlertInstanceRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.muteInstance.mockRejectedValue( - new RuleTypeDisabledError('Fail', 'license_invalid') - ); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - muteAlertInstanceRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('muteInstance', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - muteAlertInstanceRoute(router, licenseState, docLinks); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{rule_id}/alert/{alert_id}/_mute", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts deleted file mode 100644 index 155086ebc247d..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/mute_instance.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { renameKeys } from '../lib/rename_keys'; -import { MuteOptions } from '../../rules_client'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - alert_id: schema.string(), - alert_instance_id: schema.string(), -}); - -export const muteAlertInstanceRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{alert_id}/alert_instance/{alert_instance_id}/_mute`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Mute an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{rule_id}/alert/{alert_id}/_mute', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - - trackLegacyRouteUsage('muteInstance', usageCounter); - - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - - const renameMap = { - alert_id: 'alertId', - alert_instance_id: 'alertInstanceId', - }; - - const renamedQuery = renameKeys>(renameMap, req.params); - try { - await rulesClient.muteInstance(renamedQuery); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.test.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.test.ts deleted file mode 100644 index 5ae337e6a3f51..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { unmuteAllAlertRoute } from './unmute_all'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('unmuteAllAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('unmutes an alert', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAllAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_unmute_all"`); - expect(config.options?.access).toBe('public'); - - rulesClient.unmuteAll.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.unmuteAll).toHaveBeenCalledTimes(1); - expect(rulesClient.unmuteAll.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAllAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_unmute_all"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAllAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.unmuteAll.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - unmuteAllAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('unmuteAll', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAllAlertRoute(router, licenseState, docLinks); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id}/_unmute_all", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts deleted file mode 100644 index 5ae7dedcc8666..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_all.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const unmuteAllAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_unmute_all`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Unmute all alert instances', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id}/_unmute_all', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('unmuteAll', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - try { - await rulesClient.unmuteAll({ id }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.test.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.test.ts deleted file mode 100644 index b6fba61aaff8a..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.test.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { unmuteAlertInstanceRoute } from './unmute_instance'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('unmuteAlertInstanceRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('unmutes an alert instance', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAlertInstanceRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot( - `"/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute"` - ); - expect(config.options?.access).toBe('public'); - - rulesClient.unmuteInstance.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - alertId: '1', - alertInstanceId: '2', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.unmuteInstance).toHaveBeenCalledTimes(1); - expect(rulesClient.unmuteInstance.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "alertId": "1", - "alertInstanceId": "2", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAlertInstanceRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot( - `"/api/alerts/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute"` - ); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAlertInstanceRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.unmuteInstance.mockRejectedValue( - new RuleTypeDisabledError('Fail', 'license_invalid') - ); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - unmuteAlertInstanceRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('unmuteInstance', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - unmuteAlertInstanceRoute(router, licenseState, docLinks); - - const [config] = router.post.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{rule_id}/alert/{alert_id}/_unmute", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts b/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts deleted file mode 100644 index 85cf06df83387..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/unmute_instance.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - alertId: schema.string(), - alertInstanceId: schema.string(), -}); - -export const unmuteAlertInstanceRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{alertId}/alert_instance/{alertInstanceId}/_unmute`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Unmute an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{rule_id}/alert/{alert_id}/_unmute', - }, - }, - }, - }, - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('unmuteInstance', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { alertId, alertInstanceId } = req.params; - try { - await rulesClient.unmuteInstance({ alertId, alertInstanceId }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/update.test.ts b/x-pack/plugins/alerting/server/routes/legacy/update.test.ts deleted file mode 100644 index 7aaee90b805c5..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/update.test.ts +++ /dev/null @@ -1,390 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { updateAlertRoute } from './update'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { RuleNotifyWhen, SanitizedRule, RuleSystemAction } from '../../../common'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('updateAlertRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - const mockedResponse = { - id: '1', - alertTypeId: '1', - tags: ['foo'], - schedule: { interval: '12s' }, - params: { - otherField: false, - }, - createdAt: new Date(), - updatedAt: new Date(), - actions: [ - { - group: 'default', - id: '2', - actionTypeId: 'test', - params: { - baz: true, - }, - }, - ], - notifyWhen: RuleNotifyWhen.CHANGE, - }; - - const systemAction: RuleSystemAction = { - actionTypeId: 'test-2', - id: 'system_action-id', - params: { - foo: true, - }, - uuid: '123-456', - }; - - it('updates an alert with proper parameters', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.put.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('public'); - - rulesClient.update.mockResolvedValueOnce(mockedResponse as unknown as SanitizedRule); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - body: { - throttle: null, - name: 'abc', - tags: ['bar'], - schedule: { interval: '12s' }, - params: { - otherField: false, - }, - actions: [ - { - group: 'default', - id: '2', - params: { - baz: true, - }, - }, - ], - notifyWhen: 'onActionGroupChange', - }, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: mockedResponse }); - - expect(rulesClient.update).toHaveBeenCalledTimes(1); - expect(rulesClient.update.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "baz": true, - }, - }, - ], - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "otherField": false, - }, - "schedule": Object { - "interval": "12s", - }, - "tags": Array [ - "bar", - ], - "throttle": null, - }, - "id": "1", - }, - ] - `); - - expect(res.ok).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.put.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the license allows updating alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.put.mock.calls[0]; - - rulesClient.update.mockResolvedValueOnce(mockedResponse as unknown as SanitizedRule); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - body: { - throttle: null, - name: 'abc', - tags: ['bar'], - schedule: { interval: '12s' }, - params: { - otherField: false, - }, - actions: [ - { - group: 'default', - id: '2', - params: { - baz: true, - }, - }, - ], - }, - }, - ['ok'] - ); - - await handler(context, req, res); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the license check prevents updating alerts', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - (verifyApiAccess as jest.Mock).mockImplementation(() => { - throw new Error('OMG'); - }); - - updateAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.put.mock.calls[0]; - - rulesClient.update.mockResolvedValueOnce(mockedResponse as unknown as SanitizedRule); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - body: { - throttle: null, - name: 'abc', - tags: ['bar'], - schedule: { interval: '12s' }, - params: { - otherField: false, - }, - actions: [ - { - group: 'default', - id: '2', - params: { - baz: true, - }, - }, - ], - }, - }, - ['ok'] - ); - - await expect(handler(context, req, res)).rejects.toMatchInlineSnapshot(`[Error: OMG]`); - - expect(verifyApiAccess).toHaveBeenCalledWith(licenseState); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks); - - const [, handler] = router.put.mock.calls[0]; - - rulesClient.update.mockRejectedValue(new RuleTypeDisabledError('Fail', 'license_invalid')); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - updateAlertRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.put.mock.calls[0]; - rulesClient.update.mockResolvedValueOnce(mockedResponse as unknown as SanitizedRule); - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('update', mockUsageCounter); - }); - - it('does not return system actions', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks); - - const [config, handler] = router.put.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}"`); - - rulesClient.update.mockResolvedValueOnce({ - ...mockedResponse, - systemActions: [systemAction], - } as unknown as SanitizedRule); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - body: { - throttle: null, - name: 'abc', - tags: ['bar'], - schedule: { interval: '12s' }, - params: { - otherField: false, - }, - actions: [ - { - group: 'default', - id: '2', - params: { - baz: true, - }, - }, - ], - notifyWhen: 'onActionGroupChange', - }, - }, - ['ok'] - ); - - expect(await handler(context, req, res)).toEqual({ body: mockedResponse }); - - expect(rulesClient.update).toHaveBeenCalledTimes(1); - expect(rulesClient.update.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "data": Object { - "actions": Array [ - Object { - "group": "default", - "id": "2", - "params": Object { - "baz": true, - }, - }, - ], - "name": "abc", - "notifyWhen": "onActionGroupChange", - "params": Object { - "otherField": false, - }, - "schedule": Object { - "interval": "12s", - }, - "tags": Array [ - "bar", - ], - "throttle": null, - }, - "id": "1", - }, - ] - `); - - expect(res.ok).toHaveBeenCalled(); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateAlertRoute(router, licenseState, docLinks); - - const [config] = router.put.mock.calls[0]; - - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "PUT", - "newApiPath": "/api/alerting/rule/rule/{id}", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/update.ts b/x-pack/plugins/alerting/server/routes/legacy/update.ts deleted file mode 100644 index 95bb1bd651761..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/update.ts +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { validateDurationSchema } from '../../lib'; -import { handleDisabledApiKeysError } from '../lib/error_handler'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { - RuleNotifyWhenType, - LEGACY_BASE_ALERT_API_PATH, - validateNotifyWhenType, -} from '../../../common'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -const bodySchema = schema.object({ - name: schema.string(), - tags: schema.arrayOf(schema.string(), { defaultValue: [] }), - schedule: schema.object({ - interval: schema.string({ validate: validateDurationSchema }), - }), - throttle: schema.nullable(schema.string({ validate: validateDurationSchema })), - params: schema.recordOf(schema.string(), schema.any(), { defaultValue: {} }), - actions: schema.arrayOf( - schema.object({ - group: schema.string(), - id: schema.string(), - params: schema.recordOf(schema.string(), schema.any(), { defaultValue: {} }), - actionTypeId: schema.maybe(schema.string()), - }), - { defaultValue: [] } - ), - notifyWhen: schema.nullable(schema.string({ validate: validateNotifyWhenType })), -}); - -export const updateAlertRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.put( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}`, - validate: { - body: bodySchema, - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Update an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'PUT', - newApiPath: '/api/alerting/rule/rule/{id}', - }, - }, - }, - }, - handleDisabledApiKeysError( - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('update', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - const { name, actions, params, schedule, tags, throttle, notifyWhen } = req.body; - try { - const { systemActions, ...alertRes } = await rulesClient.update({ - id, - data: { - name, - actions, - params, - schedule, - tags, - throttle, - notifyWhen: notifyWhen as RuleNotifyWhenType, - }, - }); - return res.ok({ - body: alertRes, - }); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ) - ); -}; diff --git a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.test.ts b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.test.ts deleted file mode 100644 index cb2817af2ed58..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.test.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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 { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; -import { updateApiKeyRoute } from './update_api_key'; -import { httpServiceMock } from '@kbn/core/server/mocks'; -import { licenseStateMock } from '../../lib/license_state.mock'; -import { mockHandlerArguments } from '../_mock_handler_arguments'; -import { rulesClientMock } from '../../rules_client.mock'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { docLinksServiceMock } from '@kbn/core/server/mocks'; - -const rulesClient = rulesClientMock.create(); -jest.mock('../../lib/license_api_access', () => ({ - verifyApiAccess: jest.fn(), -})); - -jest.mock('../../lib/track_legacy_route_usage', () => ({ - trackLegacyRouteUsage: jest.fn(), -})); - -beforeEach(() => { - jest.resetAllMocks(); -}); - -describe('updateApiKeyRoute', () => { - const docLinks = docLinksServiceMock.createSetupContract(); - - it('updates api key for an alert', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateApiKeyRoute(router, licenseState, docLinks); - - const [config, handler] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_update_api_key"`); - expect(config.options?.access).toBe('public'); - - rulesClient.updateRuleApiKey.mockResolvedValueOnce(); - - const [context, req, res] = mockHandlerArguments( - { rulesClient }, - { - params: { - id: '1', - }, - }, - ['noContent'] - ); - - expect(await handler(context, req, res)).toEqual(undefined); - - expect(rulesClient.updateRuleApiKey).toHaveBeenCalledTimes(1); - expect(rulesClient.updateRuleApiKey.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - Object { - "id": "1", - }, - ] - `); - - expect(res.noContent).toHaveBeenCalled(); - }); - - it('should have internal access for serverless', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateApiKeyRoute(router, licenseState, docLinks, undefined, true); - - const [config] = router.post.mock.calls[0]; - - expect(config.path).toMatchInlineSnapshot(`"/api/alerts/alert/{id}/_update_api_key"`); - expect(config.options?.access).toBe('internal'); - }); - - it('ensures the alert type gets validated for the license', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateApiKeyRoute(router, licenseState, docLinks); - - const [, handler] = router.post.mock.calls[0]; - - rulesClient.updateRuleApiKey.mockRejectedValue( - new RuleTypeDisabledError('Fail', 'license_invalid') - ); - - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - 'forbidden', - ]); - - await handler(context, req, res); - - expect(res.forbidden).toHaveBeenCalledWith({ body: { message: 'Fail' } }); - }); - - it('should track every call', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); - const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); - - updateApiKeyRoute(router, licenseState, docLinks, mockUsageCounter); - const [, handler] = router.post.mock.calls[0]; - const [context, req, res] = mockHandlerArguments({ rulesClient }, { params: {}, body: {} }, [ - 'ok', - ]); - await handler(context, req, res); - expect(trackLegacyRouteUsage).toHaveBeenCalledWith('updateApiKey', mockUsageCounter); - }); - - it('should be deprecated', async () => { - const licenseState = licenseStateMock.create(); - const router = httpServiceMock.createRouter(); - - updateApiKeyRoute(router, licenseState, docLinks); - - const [config] = router.post.mock.calls[0]; - expect(config.options?.deprecated).toMatchInlineSnapshot( - { - documentationUrl: expect.stringMatching(/#breaking-201550$/), - }, - ` - Object { - "documentationUrl": StringMatching /#breaking-201550\\$/, - "reason": Object { - "newApiMethod": "POST", - "newApiPath": "/api/alerting/rule/{id}/_update_api_key", - "type": "migrate", - }, - "severity": "warning", - } - ` - ); - }); -}); diff --git a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts b/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts deleted file mode 100644 index 45a3d35e7e5d3..0000000000000 --- a/x-pack/plugins/alerting/server/routes/legacy/update_api_key.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 { schema } from '@kbn/config-schema'; -import { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { DocLinksServiceSetup } from '@kbn/core/server'; -import type { AlertingRouter } from '../../types'; -import { ILicenseState } from '../../lib/license_state'; -import { verifyApiAccess } from '../../lib/license_api_access'; -import { LEGACY_BASE_ALERT_API_PATH } from '../../../common'; -import { handleDisabledApiKeysError } from '../lib/error_handler'; -import { RuleTypeDisabledError } from '../../lib/errors/rule_type_disabled'; -import { trackLegacyRouteUsage } from '../../lib/track_legacy_route_usage'; -import { DEFAULT_ALERTING_ROUTE_SECURITY } from '../constants'; - -const paramSchema = schema.object({ - id: schema.string(), -}); - -export const updateApiKeyRoute = ( - router: AlertingRouter, - licenseState: ILicenseState, - docLinks: DocLinksServiceSetup, - usageCounter?: UsageCounter, - isServerless?: boolean -) => { - router.post( - { - path: `${LEGACY_BASE_ALERT_API_PATH}/alert/{id}/_update_api_key`, - validate: { - params: paramSchema, - }, - security: DEFAULT_ALERTING_ROUTE_SECURITY, - options: { - access: isServerless ? 'internal' : 'public', - summary: 'Update the API key for an alert', - tags: ['oas-tag:alerting'], - deprecated: { - documentationUrl: docLinks.links.alerting.legacyRuleApiDeprecations, - severity: 'warning', - reason: { - type: 'migrate', - newApiMethod: 'POST', - newApiPath: '/api/alerting/rule/{id}/_update_api_key', - }, - }, - }, - }, - handleDisabledApiKeysError( - router.handleLegacyErrors(async function (context, req, res) { - verifyApiAccess(licenseState); - if (!context.alerting) { - return res.badRequest({ body: 'RouteHandlerContext is not registered for alerting' }); - } - trackLegacyRouteUsage('updateApiKey', usageCounter); - const alertingContext = await context.alerting; - const rulesClient = await alertingContext.getRulesClient(); - const { id } = req.params; - try { - await rulesClient.updateRuleApiKey({ id }); - return res.noContent(); - } catch (e) { - if (e instanceof RuleTypeDisabledError) { - return e.sendResponse(res); - } - throw e; - } - }) - ) - ); -}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/delete_connector_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/delete_connector_api_logic.ts index a427b634c3b6e..80af793a42f80 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/delete_connector_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/delete_connector_api_logic.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { i18n } from '@kbn/i18n'; import { DeleteConnectorResponse } from '../../../../../common/types/connectors'; @@ -12,30 +13,42 @@ import { HttpLogic } from '../../../shared/http'; export interface DeleteConnectorApiLogicArgs { connectorId: string; + connectorName: string; shouldDeleteIndex: boolean; } export interface DeleteConnectorApiLogicResponse { - acknowledged: boolean; + connectorName: string; } export const deleteConnector = async ({ connectorId, + connectorName, shouldDeleteIndex = false, -}: DeleteConnectorApiLogicArgs) => { - return await HttpLogic.values.http.delete( - `/internal/enterprise_search/connectors/${connectorId}`, - { - query: { - shouldDeleteIndex, - }, - } - ); +}: DeleteConnectorApiLogicArgs): Promise => { + await HttpLogic.values.http.delete(`/internal/enterprise_search/connectors/${connectorId}`, { + query: { + shouldDeleteIndex, + }, + }); + return { connectorName }; }; export const DeleteConnectorApiLogic = createApiLogic( ['delete_connector_api_logic'], - deleteConnector + deleteConnector, + { + showSuccessFlashFn: ({ connectorName }) => + i18n.translate( + 'xpack.enterpriseSearch.content.connectors.deleteConnector.successToast.title', + { + defaultMessage: 'The connector {connectorName} was successfully deleted', + values: { + connectorName, + }, + } + ), + } ); export type DeleteConnectorApiLogicActions = Actions< diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/delete_connector_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/delete_connector_modal.tsx index a047b8ab8219b..65f3e38916faf 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/delete_connector_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/delete_connector_modal.tsx @@ -46,7 +46,7 @@ export const DeleteConnectorModal: React.FC = ({ isCr isDeleteModalVisible, } = useValues(ConnectorsLogic); - const connectorName = isCrawler ? deleteModalIndexName : deleteModalConnectorName; + const connectorName = (isCrawler ? deleteModalIndexName : deleteModalConnectorName) || ''; const [inputConnectorName, setInputConnectorName] = useState(''); const [shouldDeleteIndex, setShouldDeleteIndex] = useState(false); @@ -80,6 +80,7 @@ export const DeleteConnectorModal: React.FC = ({ isCr } else { deleteConnector({ connectorId, + connectorName, shouldDeleteIndex, }); setConnectorUiOptions(omit(connectorUiOptions, connectorId)); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.test.ts index df02a53fe0ab0..bacde5895073e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.test.ts @@ -138,7 +138,10 @@ describe('PipelinesLogic', () => { describe('apiSuccess', () => { it('should call flashSuccessToast', () => { PipelinesLogic.actions.apiSuccess({ connectorId: 'a', pipeline: newPipeline }); - expect(flashSuccessToast).toHaveBeenCalledWith('Pipelines updated'); + expect(flashSuccessToast).toHaveBeenCalledWith('Pipelines updated', { + 'aria-live': 'assertive', + role: 'alert', + }); }); }); describe('createCustomPipelineError', () => { @@ -154,7 +157,10 @@ describe('PipelinesLogic', () => { PipelinesLogic.actions.fetchCustomPipeline = jest.fn(); PipelinesLogic.actions.fetchIndexApiSuccess(connectorIndex); PipelinesLogic.actions.createCustomPipelineSuccess({ [connectorIndex.name]: {} }); - expect(flashSuccessToast).toHaveBeenCalledWith('Custom pipeline created'); + expect(flashSuccessToast).toHaveBeenCalledWith('Custom pipeline created', { + 'aria-live': 'assertive', + role: 'alert', + }); expect(PipelinesLogic.actions.setPipelineState).toHaveBeenCalledWith({ ...PipelinesLogic.values.pipelineState, name: connectorIndex.name, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.test.ts index ced4a7c5004b5..5598510567684 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.test.ts @@ -91,7 +91,10 @@ describe('CreateApiLogic', () => { const { mount: messageMount } = messageLogic; messageMount(); messageLogic.actions.apiSuccess({}); - expect(flashSuccessToast).toHaveBeenCalledWith('test message'); + expect(flashSuccessToast).toHaveBeenCalledWith('test message', { + 'aria-live': 'assertive', + role: 'alert', + }); }); }); describe('apiError', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.ts index 65e0b5f052e33..a32f479dcda82 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/api_logic/create_api_logic.ts @@ -59,7 +59,10 @@ export const createApiLogic = ( }, apiSuccess: (result) => { if (options.showSuccessFlashFn) { - flashSuccessToast(options.showSuccessFlashFn(result)); + flashSuccessToast(options.showSuccessFlashFn(result), { + 'aria-live': 'assertive', + role: 'alert', + }); } }, makeRequest: async (args, breakpoint) => { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts index d7cea1fe1b26d..6c7012bb1a061 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.test.ts @@ -103,9 +103,18 @@ describe('toastAPIErrors', () => { it('converts API errors into flash messages', () => { toastAPIErrors(mockHttpError); - expect(flashErrorToast).toHaveBeenNthCalledWith(1, 'Could not find X'); - expect(flashErrorToast).toHaveBeenNthCalledWith(2, 'Could not find Y'); - expect(flashErrorToast).toHaveBeenNthCalledWith(3, 'Something else bad happened'); + expect(flashErrorToast).toHaveBeenNthCalledWith(1, 'Could not find X', { + 'aria-live': 'assertive', + role: 'alert', + }); + expect(flashErrorToast).toHaveBeenNthCalledWith(2, 'Could not find Y', { + 'aria-live': 'assertive', + role: 'alert', + }); + expect(flashErrorToast).toHaveBeenNthCalledWith(3, 'Something else bad happened', { + 'aria-live': 'assertive', + role: 'alert', + }); }); it('falls back to the basic message for http responses without an errors array', () => { @@ -117,7 +126,10 @@ describe('toastAPIErrors', () => { }, } as any); - expect(flashErrorToast).toHaveBeenCalledWith('Not Found'); + expect(flashErrorToast).toHaveBeenCalledWith('Not Found', { + 'aria-live': 'assertive', + role: 'alert', + }); }); it('displays a generic error message and re-throws non-API errors', () => { @@ -127,7 +139,10 @@ describe('toastAPIErrors', () => { toastAPIErrors(error as any); }).toThrowError(error); - expect(flashErrorToast).toHaveBeenCalledWith(expect.any(String)); + expect(flashErrorToast).toHaveBeenCalledWith(expect.any(String), { + 'aria-live': 'assertive', + role: 'alert', + }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts index 9e74d90605dc0..e08178f730d27 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/handle_api_errors.ts @@ -74,7 +74,10 @@ export const toastAPIErrors = (response: HttpResponse) => { const messages = getErrorsFromHttpResponse(response); for (const message of messages) { - flashErrorToast(message); + flashErrorToast(message, { + 'aria-live': 'assertive', + role: 'alert', + }); } // If this was a programming error or a failed request (such as a CORS) error, // we rethrow the error so it shows up in the developer console diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/types.ts b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/types.ts index 47040fb76cbc4..48a883e8ed28c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/shared/flash_messages/types.ts @@ -19,7 +19,9 @@ export interface IFlashMessage { // @see EuiGlobalToastListToast for more props export interface ToastOptions { + 'aria-live'?: 'assertive' | 'polite'; // Defaults to 'polite' iconType?: string; + role?: string; // Defaults to the log role. The alert role can be considered only if all toasts in this list will require immediate user attention. text?: string; // Additional text below the message/title, same as EuiToast['text'] toastLifeTimeMs?: number; // Allows customizing per-toast timeout } diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.test.tsx index 77ce5720b294d..2926caae9e7fb 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.test.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/components/agent_based_table.test.tsx @@ -55,7 +55,8 @@ const mockPagination = { pageSizeOptions: [10, 20, 50], }; -describe('AgentBasedPackagePoliciesTable', () => { +// FLAKY: https://github.com/elastic/kibana/issues/201837 +describe.skip('AgentBasedPackagePoliciesTable', () => { it('renders the table with package policies', async () => { const renderer = createIntegrationsTestRendererMock(); const result = renderer.render( diff --git a/x-pack/plugins/observability_solution/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts b/x-pack/plugins/observability_solution/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts index 2da87653c0707..b0e2d99fefd5b 100644 --- a/x-pack/plugins/observability_solution/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts +++ b/x-pack/plugins/observability_solution/apm/server/lib/apm_telemetry/collect_data_telemetry/index.ts @@ -46,8 +46,8 @@ export function collectDataTelemetry({ } catch (err) { // catch error and log as debug in production env and warn in dev env const logLevel = isProd ? logger.debug : logger.warn; - logLevel(`Failed executing the APM telemetry task: "${task.name}"`); - logLevel(err); + logLevel.call(logger, `Failed executing the APM telemetry task: "${task.name}"`); + logLevel.call(logger, err); return data; } }); diff --git a/x-pack/plugins/observability_solution/apm_data_access/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts b/x-pack/plugins/observability_solution/apm_data_access/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts index a349c7c48f687..79084daeb22e6 100644 --- a/x-pack/plugins/observability_solution/apm_data_access/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts +++ b/x-pack/plugins/observability_solution/apm_data_access/server/lib/helpers/create_es_client/create_apm_event_client/index.test.ts @@ -47,34 +47,46 @@ describe('APMEventClient', () => { const router = createRouter('/'); let abortSignal: AbortSignal | undefined; - router.get({ path: '/', validate: false }, async (context, request, res) => { - const eventClient = new APMEventClient({ - esClient: { - search: async (params: any, { signal }: { signal: AbortSignal }) => { - abortSignal = signal; - await setTimeoutPromise(3_000, undefined, { - signal: abortSignal, - }); - return {}; + router.get( + { + path: '/', + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', }, - } as any, - debug: false, - request, - indices: {} as APMIndices, - options: { - includeFrozen: false, }, - }); + validate: false, + }, + async (context, request, res) => { + const eventClient = new APMEventClient({ + esClient: { + search: async (params: any, { signal }: { signal: AbortSignal }) => { + abortSignal = signal; + await setTimeoutPromise(3_000, undefined, { + signal: abortSignal, + }); + return {}; + }, + } as any, + debug: false, + request, + indices: {} as APMIndices, + options: { + includeFrozen: false, + }, + }); - await eventClient.search('foo', { - apm: { - events: [], - }, - body: { size: 0, track_total_hits: false }, - }); + await eventClient.search('foo', { + apm: { + events: [], + }, + body: { size: 0, track_total_hits: false }, + }); - return res.ok({ body: 'ok' }); - }); + return res.ok({ body: 'ok' }); + } + ); await server.start(); diff --git a/x-pack/plugins/observability_solution/metrics_data_access/server/routes/metric_indices/index.ts b/x-pack/plugins/observability_solution/metrics_data_access/server/routes/metric_indices/index.ts index ebd4ed1943f20..465a7fdf69f22 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/server/routes/metric_indices/index.ts +++ b/x-pack/plugins/observability_solution/metrics_data_access/server/routes/metric_indices/index.ts @@ -50,6 +50,12 @@ export function initMetricIndicesRoute({ router.get( { path: `/api/metrics/indices`, + security: { + authz: { + enabled: false, + reason: 'This route is opted out from authorization', + }, + }, validate: false, }, async (context, _req, res) => { diff --git a/x-pack/plugins/security_solution/server/assistant/tools/index.ts b/x-pack/plugins/security_solution/server/assistant/tools/index.ts index dc32e01335b30..dd2aa8e54ebdf 100644 --- a/x-pack/plugins/security_solution/server/assistant/tools/index.ts +++ b/x-pack/plugins/security_solution/server/assistant/tools/index.ts @@ -14,6 +14,8 @@ import { KNOWLEDGE_BASE_RETRIEVAL_TOOL } from './knowledge_base/knowledge_base_r import { KNOWLEDGE_BASE_WRITE_TOOL } from './knowledge_base/knowledge_base_write_tool'; import { SECURITY_LABS_KNOWLEDGE_BASE_TOOL } from './security_labs/security_labs_tool'; +// any new tool should also be added to telemetry schema in +// x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts export const assistantTools = [ ALERT_COUNTS_TOOL, DEFEND_INSIGHTS_TOOL, diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts index c3fd5b36ee1e2..50184413063cf 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.test.ts @@ -5,25 +5,34 @@ * 2.0. */ +import moment from 'moment'; +import { merge } from 'lodash'; + import type { ElasticsearchClient } from '@kbn/core/server'; import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { kibanaPackageJson } from '@kbn/repo-info'; +import { DefendInsightType } from '@kbn/elastic-assistant-common'; import type { HostMetadata } from '../../../../common/endpoint/types'; -import type { SearchParams } from '../../../../common/endpoint/types/workflow_insights'; +import type { + SearchParams, + SecurityWorkflowInsight, +} from '../../../../common/endpoint/types/workflow_insights'; import { ActionType, Category, SourceType, + TargetType, } from '../../../../common/endpoint/types/workflow_insights'; import type { EndpointMetadataService } from '../metadata'; import { buildEsQueryParams, createDatastream, createPipeline, + generateInsightId, groupEndpointIdsByOS, } from './helpers'; import { @@ -43,6 +52,57 @@ jest.mock('@kbn/data-stream-adapter', () => ({ })), })); +function getDefaultInsight(overrides?: Partial): SecurityWorkflowInsight { + const defaultInsight = { + '@timestamp': moment(), + message: 'This is a test message', + category: Category.Endpoint, + type: DefendInsightType.Enum.incompatible_antivirus, + source: { + type: SourceType.LlmConnector, + id: 'openai-connector-id', + data_range_start: moment(), + data_range_end: moment(), + }, + target: { + type: TargetType.Endpoint, + ids: ['endpoint-1', 'endpoint-2'], + }, + action: { + type: ActionType.Refreshed, + timestamp: moment(), + }, + value: 'unique-key', + remediation: { + exception_list_items: [ + { + list_id: 'example-list-id', + name: 'Example List Name', + description: 'Example description', + entries: [ + { + field: 'example-field', + operator: 'included', + type: 'match', + value: 'example-value', + }, + ], + tags: ['example-tag'], + os_types: ['windows', 'linux'], + }, + ], + }, + metadata: { + notes: { + key1: 'value1', + key2: 'value2', + }, + message_variables: ['variable1', 'variable2'], + }, + }; + return merge(defaultInsight, overrides); +} + describe('helpers', () => { describe('createDatastream', () => { it('should create a DataStreamSpacesAdapter with the correct configuration', () => { @@ -193,4 +253,13 @@ describe('helpers', () => { }); }); }); + + describe('generateInsightId', () => { + it('should generate the correct hashed id', () => { + const insight = getDefaultInsight(); + const result = generateInsightId(insight); + const expectedHash = '6b1a7a9625decbf899db4fbf78105a0eff9ef98e3f2dadc2781d59996b55445e'; + expect(result).toBe(expectedHash); + }); + }); }); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts index 67c852cc2720b..f7b477a17018d 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/helpers.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { createHash } from 'crypto'; import { get as _get } from 'lodash'; import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; @@ -12,7 +13,10 @@ import type { ElasticsearchClient } from '@kbn/core/server'; import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; -import type { SearchParams } from '../../../../common/endpoint/types/workflow_insights'; +import type { + SearchParams, + SecurityWorkflowInsight, +} from '../../../../common/endpoint/types/workflow_insights'; import type { SupportedHostOsType } from '../../../../common/endpoint/constants'; import type { EndpointMetadataService } from '../metadata'; @@ -130,3 +134,18 @@ export async function groupEndpointIdsByOS( return acc; }, {}); } + +export function generateInsightId(insight: SecurityWorkflowInsight): string { + const { type, category, value, target } = insight; + const targetType = target.type; + const targetIds = target.ids.join(','); + + const hash = createHash('sha256'); + hash.update(type); + hash.update(category); + hash.update(value); + hash.update(targetType); + hash.update(targetIds); + + return hash.digest('hex'); +} diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts index c742daa90d258..849c6431a09a8 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.test.ts @@ -5,12 +5,13 @@ * 2.0. */ -import { merge } from 'lodash'; +import { merge, cloneDeep } from 'lodash'; import moment from 'moment'; import { ReplaySubject } from 'rxjs'; import type { ElasticsearchClient, KibanaRequest, Logger } from '@kbn/core/server'; import type { DefendInsight, DefendInsightsPostRequestBody } from '@kbn/elastic-assistant-common'; +import type { SearchHit, UpdateResponse } from '@elastic/elasticsearch/lib/api/types'; import { DataStreamSpacesAdapter } from '@kbn/data-stream-adapter'; import { DefendInsightType } from '@kbn/elastic-assistant-common'; @@ -31,7 +32,7 @@ import { ActionType, } from '../../../../common/endpoint/types/workflow_insights'; import { createMockEndpointAppContext } from '../../mocks'; -import { createDatastream, createPipeline } from './helpers'; +import { createDatastream, createPipeline, generateInsightId } from './helpers'; import { securityWorkflowInsightsService } from '.'; import { DATA_STREAM_NAME } from './constants'; import { buildWorkflowInsights } from './builders'; @@ -108,6 +109,7 @@ describe('SecurityWorkflowInsightsService', () => { let logger: Logger; let esClient: ElasticsearchClient; let mockEndpointAppContextService: jest.Mocked; + let isInitializedSpy: jest.SpyInstance, [], boolean>; beforeEach(() => { logger = loggerMock.create(); @@ -115,6 +117,10 @@ describe('SecurityWorkflowInsightsService', () => { mockEndpointAppContextService = createMockEndpointAppContext() .service as jest.Mocked; + + isInitializedSpy = jest + .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') + .mockResolvedValueOnce([undefined, undefined]); }); afterEach(() => { @@ -217,10 +223,6 @@ describe('SecurityWorkflowInsightsService', () => { describe('createFromDefendInsights', () => { it('should create workflow insights from defend insights', async () => { - const isInitializedSpy = jest - .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') - .mockResolvedValueOnce([undefined, undefined]); - const defendInsights: DefendInsight[] = [ { group: 'AVGAntivirus', @@ -258,8 +260,8 @@ describe('SecurityWorkflowInsightsService', () => { request ); - // twice since it calls securityWorkflowInsightsService.create internally - expect(isInitializedSpy).toHaveBeenCalledTimes(2); + // three since it calls securityWorkflowInsightsService.create + fetch + expect(isInitializedSpy).toHaveBeenCalledTimes(3); expect(buildWorkflowInsightsMock).toHaveBeenCalledWith({ defendInsights, request, @@ -271,32 +273,55 @@ describe('SecurityWorkflowInsightsService', () => { describe('create', () => { it('should index the doc correctly', async () => { - const isInitializedSpy = jest - .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') - .mockResolvedValueOnce([undefined, undefined]); - await securityWorkflowInsightsService.start({ esClient }); const insight = getDefaultInsight(); await securityWorkflowInsightsService.create(insight); - // ensure it waits for initialization first - expect(isInitializedSpy).toHaveBeenCalledTimes(1); + // two since it calls fetch as well + expect(isInitializedSpy).toHaveBeenCalledTimes(2); // indexes the doc expect(esClient.index).toHaveBeenCalledTimes(1); expect(esClient.index).toHaveBeenCalledWith({ index: DATA_STREAM_NAME, - body: insight, + body: { ...insight, id: generateInsightId(insight) }, refresh: 'wait_for', }); }); + + it('should call update instead if insight already exists', async () => { + const indexName = 'backing-index'; + const fetchSpy = jest + .spyOn(securityWorkflowInsightsService, 'fetch') + .mockResolvedValueOnce([{ _index: indexName }] as Array< + SearchHit + >); + const updateSpy = jest + .spyOn(securityWorkflowInsightsService, 'update') + .mockResolvedValueOnce({} as UpdateResponse); + await securityWorkflowInsightsService.start({ esClient }); + const insight = getDefaultInsight(); + await securityWorkflowInsightsService.create(insight); + + const expectedInsight = cloneDeep(insight); + expectedInsight['@timestamp'] = expect.any(moment); + expectedInsight.action.timestamp = expect.any(moment); + expectedInsight.source.data_range_start = expect.any(moment); + expectedInsight.source.data_range_end = expect.any(moment); + + // ensure it waits for initialization first + expect(isInitializedSpy).toHaveBeenCalledTimes(1); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expect(updateSpy).toHaveBeenCalledTimes(1); + expect(updateSpy).toHaveBeenCalledWith( + generateInsightId(insight), + expect.objectContaining(insight), + indexName + ); + }); }); describe('update', () => { it('should update the doc correctly', async () => { - const isInitializedSpy = jest - .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') - .mockResolvedValueOnce([undefined, undefined]); - await securityWorkflowInsightsService.start({ esClient }); const insightId = 'some-insight-id'; const insight = getDefaultInsight(); @@ -318,10 +343,6 @@ describe('SecurityWorkflowInsightsService', () => { describe('fetch', () => { it('should fetch the docs with the correct params', async () => { - const isInitializedSpy = jest - .spyOn(securityWorkflowInsightsService, 'isInitialized', 'get') - .mockResolvedValueOnce([undefined, undefined]); - await securityWorkflowInsightsService.start({ esClient }); const searchParams: SearchParams = { size: 50, diff --git a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts index d1c765196db29..1baeaf74e00f0 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/workflow_insights/index.ts @@ -23,7 +23,7 @@ import type { import type { EndpointAppContextService } from '../../endpoint_app_context_services'; import { SecurityWorkflowInsightsFailedInitialized } from './errors'; -import { buildEsQueryParams, createDatastream, createPipeline } from './helpers'; +import { buildEsQueryParams, createDatastream, createPipeline, generateInsightId } from './helpers'; import { DATA_STREAM_NAME } from './constants'; import { buildWorkflowInsights } from './builders'; @@ -135,9 +135,17 @@ class SecurityWorkflowInsightsService { public async create(insight: SecurityWorkflowInsight): Promise { await this.isInitialized; + const id = generateInsightId(insight); + + // if insight already exists, update instead + const existingInsights = await this.fetch({ ids: [id] }); + if (existingInsights.length) { + return this.update(id, insight, existingInsights[0]._index); + } + const response = await this.esClient.index({ index: DATA_STREAM_NAME, - body: insight, + body: { ...insight, id }, refresh: 'wait_for', }); diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/process_query.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/process_query.ts index 27a9bca16390d..e4b7e64e85b00 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/process_query.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/process_query.ts @@ -32,7 +32,6 @@ export const getProcessQueryNode = ({ const response = await replaceQueryResourcePrompt.invoke({ query: state.original_rule.query, macros: resourceContext.macros, - lookup_tables: resourceContext.lists, }); const splQuery = response.match(/```spl\n([\s\S]*?)\n```/)?.[1] ?? ''; if (splQuery) { diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/prompts.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/prompts.ts index be19ca8b0bf10..68eaaeffd11b1 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/prompts.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/process_query/prompts.ts @@ -43,7 +43,7 @@ export const REPLACE_QUERY_RESOURCE_PROMPT = ChatPromptTemplate.fromMessages([ [ 'system', `You are an agent expert in Splunk SPL (Search Processing Language). -Your task is to inline a set of macros and lookup tables syntax using their values in a SPL query. +Your task is to inline a set of macros syntax using its values in a SPL query. Here are some context for you to reference for your task, read it carefully as you will get questions about it later: @@ -72,54 +72,14 @@ The correct replacement would be: | table * \`\`\` - - -Always follow the below guidelines when replacing lookup tables: -- OUTPUTNEW and OUTPUT fields should be replaced with the values from the lookup table. -- Use the \`case\` function to evaluate conditions in the same order provided by the lookup table. -- Ensure all lookup matching fields are correctly matched to their respective case conditions. -- If there are more than one field to match, use the \`AND\` operator to combine them inside the \`case\` function. -- The transformed SPL query should function equivalently to the original query with the \`lookup\` command. - - -Having the following lookup table: - uid,username,department - 1066,Claudia Garcia,Engineering - 1690,Rutherford Sullivan,Engineering - 1815,Vanya Patel,IT - 1862,Wei Zhang,Engineering - 1916,Alex Martin,Personnel -And the following SPL query: - \`\`\`spl - ... | lookup users uid OUTPUTNEW username, department - \`\`\` -The correct replacement would be: - \`\`\`spl - ... | eval username=case(uid=1066, "Claudia Garcia", - uid=1690, "Rutherford Sullivan", - uid=1815, "Vanya Patel", - uid=1862, "Wei Zhang", - uid=1916, "Alex Martin", - true, null), - department=case(uid=1066, "Engineering", - uid=1690, "Engineering", - uid=1815, "IT", - uid=1862, "Engineering", - uid=1916, "Personnel", - true, null) - \`\`\` - `, ], [ 'human', - `Go through the SPL query and identify all the macros and lookup tables that are used. + `Go through the SPL query and identify all the macros that are used. {macros} - -{lookup_tables} - \`\`\`spl @@ -127,13 +87,13 @@ The correct replacement would be: \`\`\` -Divide the query up into separate section and go through each section one at a time to identify the macros and lookup tables used that need to be replaced using one of two scenarios: -- The macro or lookup table is provided in the resources: Replace it using its actual content. -- The macro or lookup table is not provided in the resources: Do not replace it, keep it in the query as it is. +Divide the query up into separate section and go through each section one at a time to identify the macros used that need to be replaced using one of two scenarios: +- The macro is provided in the list of available macros: Replace it using its actual content. +- The macro is not in the list of available macros: Do not replace it, keep it in the query as it is. -- You will be provided with a SPL query and also the resources reference with the values of macros and lookup tables. -- You have to replace the macros and lookup tables syntax in the SPL query and use their values inline, if provided. +- You will be provided with a SPL query and also the related macros used in the query. +- You have to replace the macros syntax in the SPL query and use their values inline, if provided. - The original and modified queries must be equivalent. - You must respond only with the modified query inside a \`\`\`spl code block, nothing else similar to the example response below. diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/ecs_mapping/ecs_mapping.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/ecs_mapping/ecs_mapping.ts index ac7f6db7236d1..6acc45a95d17b 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/ecs_mapping/ecs_mapping.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/ecs_mapping/ecs_mapping.ts @@ -59,7 +59,7 @@ export const getEcsMappingNode = ({ }; const getTranslationResult = (esqlQuery: string): SiemMigrationRuleTranslationResult => { - if (esqlQuery.match(/\[(macro|lookup):[\s\S]*\]/)) { + if (esqlQuery.match(/\[(macro):[\s\S]*\]/)) { return SiemMigrationRuleTranslationResult.PARTIAL; } return SiemMigrationRuleTranslationResult.FULL; diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/prompts.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/prompts.ts index 1ea8295c7402f..626251c3c8259 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/prompts.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/prompts.ts @@ -9,33 +9,49 @@ import { ChatPromptTemplate } from '@langchain/core/prompts'; export const ESQL_SYNTAX_TRANSLATION_PROMPT = ChatPromptTemplate.fromTemplate(`You are a helpful cybersecurity (SIEM) expert agent. Your task is to migrate "detection rules" from Splunk SPL to Elasticsearch ES|QL. -Your goal is to translate the SPL query syntax into an equivalent Elastic Search Query Language (ES|QL) query without changing any of the field names and focusing only on translating the syntax and structure. +Your goal is to translate the SPL query syntax into an equivalent Elastic Search Query Language (ES|QL) query without changing any of the field names except lookup lists and macros when relevant and focusing only on translating the syntax and structure. Here are some context for you to reference for your task, read it carefully as you will get questions about it later: {splunk_rule} - -If, in the SPL query, you find a lookup list or macro call, mention it in the summary and add a placeholder in the query with the format [macro:(argumentCount)] or [lookup:] including the [] keys, + +If, in the SPL query, you find a macro call, mention it in the summary and add a placeholder in the query with the format [macro:(argumentCount)] including the [] keys, Examples: - \`get_duration(firstDate,secondDate)\` -> [macro:get_duration(2)] - - lookup dns_domains.csv -> [lookup:dns_domains.csv]. - + + +If in an SPL query you identify a looku list call, it should be translated the following way: +\`\`\`spl +... | lookup users uid OUTPUTNEW username, department +\`\`\` + +In the above example it uses the following syntax: +lookup 'index_name' 'field_to_match' OUTPUTNEW 'field1', 'field2' + +However in the ES|QL query, some of the information is removed and should be used in the following way: +\`\`\`esql +... | LOOKUP JOIN 'index_name' ON 'field_to_match' +\`\`\` +We do not define OUTPUTNEW or which fields is returned, only the index name and the field to match. + Go through each step and part of the splunk rule and query while following the below guide to produce the resulting ES|QL query: - Analyze all the information about the related splunk rule and try to determine the intent of the rule, in order to translate into an equivalent ES|QL rule. - Go through each part of the SPL query and determine the steps required to produce the same end results using ES|QL. Only focus on translating the structure without modifying any of the field names. - Do NOT map any of the fields to the Elastic Common Schema (ECS), this will happen in a later step. -- Always remember to replace any lookup list or macro call with the appropriate placeholder as defined in the context. +- Always remember to translate any lookup list using the lookup_syntax above +- Always remember to replace macro call with the appropriate placeholder as defined in the macro info. - Analyze the SPL query and identify the key components. - Do NOT translate the field names of the SPL query. - Always start the resulting ES|QL query by filtering using FROM and with these index patterns: {indexPatterns}. -- Remember to always replace any lookup list or macro call with the appropriate placeholder as defined in the context. +- Always remember to translate any lookup list using the lookup_syntax above +- Always remember to replace macro call with the appropriate placeholder as defined in the macro info. diff --git a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/translate_rule.ts b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/translate_rule.ts index 09f9bca474004..d613da223038c 100644 --- a/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/translate_rule.ts +++ b/x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/sub_graphs/translate_rule/nodes/translate_rule/translate_rule.ts @@ -64,7 +64,7 @@ export const getTranslateRuleNode = ({ }; const getTranslationResult = (esqlQuery: string): SiemMigrationRuleTranslationResult => { - if (esqlQuery.match(/\[(macro|lookup):[\s\S]*\]/)) { + if (esqlQuery.match(/\[(macro):[\s\S]*\]/)) { return SiemMigrationRuleTranslationResult.PARTIAL; } return SiemMigrationRuleTranslationResult.FULL; diff --git a/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx b/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx index 988afb8d2182b..97b614a5b5785 100644 --- a/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx +++ b/x-pack/plugins/stack_alerts/public/rule_types/components/data_view_select_popover.tsx @@ -18,6 +18,7 @@ import { EuiPopover, EuiPopoverFooter, EuiPopoverTitle, + EuiLoadingSpinner, EuiText, useEuiPaddingCSS, useIsWithinBreakpoints, @@ -63,6 +64,7 @@ export const DataViewSelectPopover: React.FunctionComponent { + const [loadingDataViews, setLoadingDataViews] = useState(false); const [dataViewItems, setDataViewsItems] = useState([]); const [dataViewPopoverOpen, setDataViewPopoverOpen] = useState(false); @@ -71,7 +73,7 @@ export const DataViewSelectPopover: React.FunctionComponent void | undefined>(); const allDataViewItems = useMemo( - () => [...dataViewItems, ...metadata.adHocDataViewList.map(toDataViewListItem)], + () => [...(dataViewItems ?? []), ...metadata.adHocDataViewList.map(toDataViewListItem)], [dataViewItems, metadata.adHocDataViewList] ); @@ -87,10 +89,16 @@ export const DataViewSelectPopover: React.FunctionComponent { - const ids = await dataViews.getIds(); - const dataViewsList = await Promise.all(ids.map((id) => dataViews.get(id))); - - setDataViewsItems(dataViewsList.map(toDataViewListItem)); + setLoadingDataViews(true); + try { + // Calling getIds with refresh = true to make sure we don't get stale data + const ids = await dataViews.getIds(true); + const dataViewsList = await Promise.all(ids.map((id) => dataViews.get(id))); + setDataViewsItems(dataViewsList.map(toDataViewListItem)); + } catch (e) { + // Error fetching data views + } + setLoadingDataViews(false); }, [dataViews]); const onAddAdHocDataView = useCallback( @@ -153,8 +161,10 @@ export const DataViewSelectPopover: React.FunctionComponent; } return ( diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_observability.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_observability.json index 22b1e3c3071ec..4b60ca1da8d6b 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_observability.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_observability.json @@ -131,6 +131,82 @@ } } } + }, + "slo": { + "properties": { + "slo": { + "properties": { + "total": { + "type": "long", + "_meta": { + "description": "The total number of slos in the cluster" + } + }, + "by_status": { + "properties": { + "enabled": { + "type": "long", + "_meta": { + "description": "The number of enabled slos in the cluster" + } + }, + "disabled": { + "type": "long", + "_meta": { + "description": "The number of disabled slos in the cluster" + } + } + } + }, + "by_sli_type": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "The number of slos by sli type in the cluster" + } + } + } + }, + "by_rolling_duration": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "The number of slos by rolling duration in the cluster" + } + } + } + }, + "by_calendar_aligned_duration": { + "properties": { + "DYNAMIC_KEY": { + "type": "long", + "_meta": { + "description": "The number of slos by calendar aligned duration in the cluster" + } + } + } + }, + "by_budgeting_method": { + "properties": { + "occurrences": { + "type": "long", + "_meta": { + "description": "The number of slos by timeslices budgeting method in the cluster" + } + }, + "timeslices": { + "type": "long", + "_meta": { + "description": "The number of slos by occurrences budgeting method in the cluster" + } + } + } + } + } + } + } } } } diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index ccdfb2a3bf647..fb9479ca60f04 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -19428,82 +19428,6 @@ } } }, - "slo": { - "properties": { - "slo": { - "properties": { - "total": { - "type": "long", - "_meta": { - "description": "The total number of slos in the cluster" - } - }, - "by_status": { - "properties": { - "enabled": { - "type": "long", - "_meta": { - "description": "The number of enabled slos in the cluster" - } - }, - "disabled": { - "type": "long", - "_meta": { - "description": "The number of disabled slos in the cluster" - } - } - } - }, - "by_sli_type": { - "properties": { - "DYNAMIC_KEY": { - "type": "long", - "_meta": { - "description": "The number of slos by sli type in the cluster" - } - } - } - }, - "by_rolling_duration": { - "properties": { - "DYNAMIC_KEY": { - "type": "long", - "_meta": { - "description": "The number of slos by rolling duration in the cluster" - } - } - } - }, - "by_calendar_aligned_duration": { - "properties": { - "DYNAMIC_KEY": { - "type": "long", - "_meta": { - "description": "The number of slos by calendar aligned duration in the cluster" - } - } - } - }, - "by_budgeting_method": { - "properties": { - "occurrences": { - "type": "long", - "_meta": { - "description": "The number of slos by timeslices budgeting method in the cluster" - } - }, - "timeslices": { - "type": "long", - "_meta": { - "description": "The number of slos by occurrences budgeting method in the cluster" - } - } - } - } - } - } - } - }, "spaces": { "properties": { "usesFeatureControls": { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx index df52b1729bb8d..1c5008d4e1dde 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx @@ -9,7 +9,7 @@ import React, { lazy } from 'react'; import { actionTypeRegistryMock } from '../../../action_type_registry.mock'; import userEvent from '@testing-library/user-event'; -import { waitFor, act } from '@testing-library/react'; +import { waitFor, act, screen } from '@testing-library/react'; import CreateConnectorFlyout from '.'; import { AppMockRenderer, createAppMockRenderer } from '../../test_utils'; import { TECH_PREVIEW_LABEL } from '../../translations'; @@ -426,7 +426,7 @@ describe('CreateConnectorFlyout', () => { describe('Submitting', () => { it('creates a connector correctly', async () => { - const { getByTestId } = appMockRenderer.render( + const { getByTestId, queryByTestId } = appMockRenderer.render( { name: 'My test', secrets: {}, }); + expect(queryByTestId('connector-form-header-error-label')).not.toBeInTheDocument(); + }); + + it('show error message in the form header', async () => { + appMockRenderer.render( + + ); + + await userEvent.click(await screen.findByTestId(`${actionTypeModel.id}-card`)); + expect(await screen.findByTestId('test-connector-text-field')).toBeInTheDocument(); + + await userEvent.type( + await screen.findByTestId('test-connector-text-field'), + 'My text field', + { + delay: 100, + } + ); + + await userEvent.click(await screen.findByTestId('create-connector-flyout-save-btn')); + expect(onClose).not.toHaveBeenCalled(); + expect(onConnectorCreated).not.toHaveBeenCalled(); + expect(await screen.findByTestId('connector-form-header-error-label')).toBeInTheDocument(); + }); + + it('removes error message from the form header', async () => { + appMockRenderer.render( + + ); + + await userEvent.click(await screen.findByTestId(`${actionTypeModel.id}-card`)); + expect(await screen.findByTestId('test-connector-text-field')).toBeInTheDocument(); + + await userEvent.type( + await screen.findByTestId('test-connector-text-field'), + 'My text field', + { + delay: 100, + } + ); + + await userEvent.click(await screen.findByTestId('create-connector-flyout-save-btn')); + expect(onClose).not.toHaveBeenCalled(); + expect(onConnectorCreated).not.toHaveBeenCalled(); + expect(await screen.findByTestId('connector-form-header-error-label')).toBeInTheDocument(); + + await userEvent.type(await screen.findByTestId('nameInput'), 'My test', { + delay: 100, + }); + + await userEvent.click(await screen.findByTestId('create-connector-flyout-save-btn')); + expect(onClose).toHaveBeenCalled(); + expect(onConnectorCreated).toHaveBeenCalled(); + expect(screen.queryByTestId('connector-form-header-error-label')).not.toBeInTheDocument(); }); it('runs pre submit validator correctly', async () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx index b93d2815bf197..c341f861b5ead 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx @@ -9,6 +9,7 @@ import React, { memo, ReactNode, useCallback, useEffect, useRef, useState } from import { EuiButton, EuiButtonGroup, + EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiFlyout, @@ -18,6 +19,7 @@ import { import { getConnectorCompatibility } from '@kbn/actions-plugin/common'; import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; import { ActionConnector, ActionType, @@ -60,6 +62,7 @@ const CreateConnectorFlyoutComponent: React.FC = ({ const [actionType, setActionType] = useState(null); const [hasActionsUpgradeableByTrial, setHasActionsUpgradeableByTrial] = useState(false); const canSave = hasSaveActionsCapability(capabilities); + const [showFormErrors, setShowFormErrors] = useState(false); const [preSubmitValidationErrorMessage, setPreSubmitValidationErrorMessage] = useState(null); @@ -106,6 +109,7 @@ const CreateConnectorFlyoutComponent: React.FC = ({ const setResetForm = (reset: ResetForm) => { resetConnectorForm.current = reset; + setShowFormErrors(false); }; const onChangeGroupAction = (id: string) => { @@ -127,6 +131,7 @@ const CreateConnectorFlyoutComponent: React.FC = ({ const validateAndCreateConnector = useCallback(async () => { setPreSubmitValidationErrorMessage(null); + setShowFormErrors(false); const { isValid, data } = await submit(); if (!isMounted.current) { @@ -159,6 +164,8 @@ const CreateConnectorFlyoutComponent: React.FC = ({ const createdConnector = await createConnector(validConnector); return createdConnector; + } else { + setShowFormErrors(true); } }, [submit, preSubmitValidator, createConnector]); @@ -228,6 +235,23 @@ const CreateConnectorFlyoutComponent: React.FC = ({ )} + {showFormErrors && ( + <> + + + + )} { describe('Submitting', () => { it('updates the connector correctly', async () => { - const { getByTestId } = appMockRenderer.render( + const { getByTestId, queryByTestId } = appMockRenderer.render( { name: 'My test', secrets: {}, }); + expect(queryByTestId('connector-form-header-error-label')).not.toBeInTheDocument(); }); it('updates connector form field with latest value', async () => { @@ -555,6 +556,39 @@ describe('EditConnectorFlyout', () => { }); }); + it('show error message in the form header', async () => { + appMockRenderer.render( + + ); + + expect(await screen.findByTestId('test-connector-text-field')).toBeInTheDocument(); + await userEvent.clear(screen.getByTestId('nameInput')); + await userEvent.click(screen.getByTestId('edit-connector-flyout-save-btn')); + expect(await screen.findByTestId('connector-form-header-error-label')).toBeInTheDocument(); + }); + + it('removes error message from the form header', async () => { + appMockRenderer.render( + + ); + + await userEvent.clear(screen.getByTestId('nameInput')); + await userEvent.type(screen.getByTestId('nameInput'), 'My new name'); + await userEvent.type(screen.getByTestId('test-connector-secret-text-field'), 'password'); + await userEvent.click(screen.getByTestId('edit-connector-flyout-save-btn')); + expect(screen.queryByTestId('connector-form-header-error-label')).not.toBeInTheDocument(); + }); + it('runs pre submit validator correctly', async () => { const errorActionTypeModel = actionTypeRegistryMock.createMockActionTypeModel({ actionConnectorFields: lazy(() => import('../connector_error_mock')), diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.tsx index e787f3eac42bf..1188f06a87d56 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.tsx @@ -6,7 +6,14 @@ */ import React, { memo, ReactNode, useCallback, useEffect, useRef, useState } from 'react'; -import { EuiFlyout, EuiFlyoutBody, EuiButton, EuiConfirmModal } from '@elastic/eui'; +import { + EuiFlyout, + EuiFlyoutBody, + EuiButton, + EuiConfirmModal, + EuiCallOut, + EuiSpacer, +} from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { ActionTypeExecutorResult, isActionTypeExecutorResult } from '@kbn/actions-plugin/common'; @@ -62,6 +69,7 @@ const EditConnectorFlyoutComponent: React.FC = ({ const canSave = hasSaveActionsCapability(capabilities); const { isLoading: isUpdatingConnector, updateConnector } = useUpdateConnector(); const { isLoading: isExecutingConnector, executeConnector } = useExecuteConnector(); + const [showFormErrors, setShowFormErrors] = useState(false); const [preSubmitValidationErrorMessage, setPreSubmitValidationErrorMessage] = useState(null); @@ -90,6 +98,7 @@ const EditConnectorFlyoutComponent: React.FC = ({ if (nextPage === EditConnectorTabs.Configuration && testExecutionResult !== none) { setTestExecutionResult(none); } + setShowFormErrors(false); setTab(nextPage); }, [testExecutionResult, setTestExecutionResult] @@ -146,6 +155,7 @@ const EditConnectorFlyoutComponent: React.FC = ({ const onClickSave = useCallback(async () => { setPreSubmitValidationErrorMessage(null); + setShowFormErrors(false); const { isValid, data } = await submit(); if (!isMounted.current) { @@ -194,6 +204,8 @@ const EditConnectorFlyoutComponent: React.FC = ({ } return updatedConnector; + } else { + setShowFormErrors(true); } }, [ onConnectorUpdated, @@ -218,6 +230,23 @@ const EditConnectorFlyoutComponent: React.FC = ({ <> {isEdit && ( <> + {showFormErrors && ( + <> + + + + )} = ({ ); }, [ connector, + docLinks.links.alerting.preconfiguredConnectors, actionTypeModel, isEdit, - docLinks.links.alerting.preconfiguredConnectors, - hasErrors, - isFormModified, - isSaved, - isSaving, + showFormErrors, + onFormModifiedChange, preSubmitValidationErrorMessage, showButtons, + isSaved, + isSaving, onClickSave, - onFormModifiedChange, + isFormModified, + hasErrors, ]); const renderTestTab = useCallback(() => { diff --git a/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js b/x-pack/solutions/observability/plugins/slo/.storybook/jest_setup.js similarity index 100% rename from x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js rename to x-pack/solutions/observability/plugins/slo/.storybook/jest_setup.js diff --git a/x-pack/plugins/observability_solution/slo/.storybook/main.js b/x-pack/solutions/observability/plugins/slo/.storybook/main.js similarity index 100% rename from x-pack/plugins/observability_solution/slo/.storybook/main.js rename to x-pack/solutions/observability/plugins/slo/.storybook/main.js diff --git a/x-pack/plugins/observability_solution/slo/.storybook/preview.js b/x-pack/solutions/observability/plugins/slo/.storybook/preview.js similarity index 100% rename from x-pack/plugins/observability_solution/slo/.storybook/preview.js rename to x-pack/solutions/observability/plugins/slo/.storybook/preview.js diff --git a/x-pack/plugins/observability_solution/slo/README.md b/x-pack/solutions/observability/plugins/slo/README.md similarity index 100% rename from x-pack/plugins/observability_solution/slo/README.md rename to x-pack/solutions/observability/plugins/slo/README.md diff --git a/x-pack/plugins/observability_solution/slo/common/config.ts b/x-pack/solutions/observability/plugins/slo/common/config.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/config.ts rename to x-pack/solutions/observability/plugins/slo/common/config.ts diff --git a/x-pack/plugins/observability_solution/slo/common/constants.ts b/x-pack/solutions/observability/plugins/slo/common/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/constants.ts rename to x-pack/solutions/observability/plugins/slo/common/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/common/field_names/slo.ts b/x-pack/solutions/observability/plugins/slo/common/field_names/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/field_names/slo.ts rename to x-pack/solutions/observability/plugins/slo/common/field_names/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/common/i18n.ts b/x-pack/solutions/observability/plugins/slo/common/i18n.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/i18n.ts rename to x-pack/solutions/observability/plugins/slo/common/i18n.ts diff --git a/x-pack/plugins/observability_solution/slo/common/index.ts b/x-pack/solutions/observability/plugins/slo/common/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/index.ts rename to x-pack/solutions/observability/plugins/slo/common/index.ts diff --git a/x-pack/plugins/observability_solution/slo/common/locators/paths.ts b/x-pack/solutions/observability/plugins/slo/common/locators/paths.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/locators/paths.ts rename to x-pack/solutions/observability/plugins/slo/common/locators/paths.ts diff --git a/x-pack/plugins/observability_solution/slo/common/parse_kuery.ts b/x-pack/solutions/observability/plugins/slo/common/parse_kuery.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/parse_kuery.ts rename to x-pack/solutions/observability/plugins/slo/common/parse_kuery.ts diff --git a/x-pack/plugins/observability_solution/slo/common/summary_indices.test.ts b/x-pack/solutions/observability/plugins/slo/common/summary_indices.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/summary_indices.test.ts rename to x-pack/solutions/observability/plugins/slo/common/summary_indices.test.ts diff --git a/x-pack/plugins/observability_solution/slo/common/summary_indices.ts b/x-pack/solutions/observability/plugins/slo/common/summary_indices.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/summary_indices.ts rename to x-pack/solutions/observability/plugins/slo/common/summary_indices.ts diff --git a/x-pack/plugins/observability_solution/slo/common/types.ts b/x-pack/solutions/observability/plugins/slo/common/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/common/types.ts rename to x-pack/solutions/observability/plugins/slo/common/types.ts diff --git a/x-pack/plugins/observability_solution/slo/dev_docs/slo.md b/x-pack/solutions/observability/plugins/slo/dev_docs/slo.md similarity index 98% rename from x-pack/plugins/observability_solution/slo/dev_docs/slo.md rename to x-pack/solutions/observability/plugins/slo/dev_docs/slo.md index 6286c47f2447d..3eb4c6f898352 100644 --- a/x-pack/plugins/observability_solution/slo/dev_docs/slo.md +++ b/x-pack/solutions/observability/plugins/slo/dev_docs/slo.md @@ -8,7 +8,7 @@ Starting in 8.8, SLO is enabled by default. SLO is GA since 8.12 1. Data generation > [!TIP] -> The following commands uses [kbn-data-forge](../../../../platform/packages/shared/kbn-data-forge/README.md) to generate some data for developping or testing SLOs +> The following commands uses [kbn-data-forge](../../../../../platform/packages/shared/kbn-data-forge/README.md) to generate some data for developping or testing SLOs Basic command to generate 7 days of data with a couple of services: ```sh diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/README.md b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/README.md similarity index 93% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/README.md rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/README.md index f6a80b82c9754..198dc9a405685 100644 --- a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/README.md +++ b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/README.md @@ -14,7 +14,7 @@ A guide about the OpenApi specification can be found at [https://swagger.io/docs ## Tools It is possible to manually validate the docs before bundling them with the following -command in the `x-pack/plugins/observability_solution/slo/docs/openapi/slo` folder: +command in the `x-pack/solutions/observability/plugins/slo/docs/openapi/slo` folder: ```bash make validate diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.json b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.json similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.json rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.json diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/bundled.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/README.md b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/README.md similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/README.md rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/README.md diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/slo_id.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/parameters/slo_id.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/slo_id.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/parameters/slo_id.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/space_id.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/parameters/space_id.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/space_id.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/parameters/space_id.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/400_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/400_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/400_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/400_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/401_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/401_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/401_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/401_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/403_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/403_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/403_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/403_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/404_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/404_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/404_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/404_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/409_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/409_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/409_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/409_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/error_budget.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/error_budget.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/error_budget.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/error_budget.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/filter.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/filter.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter_meta.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/filter_meta.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter_meta.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/filter_meta.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/group_by.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/group_by.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/group_by.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/group_by.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters_good.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters_good.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters_good.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters_good.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters_total.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters_total.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters_total.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/kql_with_filters_total.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/objective.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/objective.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/objective.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/objective.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/settings.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/settings.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/settings.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/settings.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/summary.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/summary.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary_status.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/summary_status.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary_status.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/summary_status.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/time_window.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/time_window.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/time_window.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/time_window.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/entrypoint.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/entrypoint.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/entrypoint.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/entrypoint.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/makefile b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/makefile similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/makefile rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/makefile diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/README.md b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/README.md similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/README.md rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/README.md diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml diff --git a/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml b/x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml rename to x-pack/solutions/observability/plugins/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml diff --git a/x-pack/plugins/observability_solution/slo/e2e/journeys/annotation_list.journey.ts b/x-pack/solutions/observability/plugins/slo/e2e/journeys/annotation_list.journey.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/journeys/annotation_list.journey.ts rename to x-pack/solutions/observability/plugins/slo/e2e/journeys/annotation_list.journey.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/journeys/index.ts b/x-pack/solutions/observability/plugins/slo/e2e/journeys/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/journeys/index.ts rename to x-pack/solutions/observability/plugins/slo/e2e/journeys/index.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/journeys/slos_overview.journey.ts b/x-pack/solutions/observability/plugins/slo/e2e/journeys/slos_overview.journey.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/journeys/slos_overview.journey.ts rename to x-pack/solutions/observability/plugins/slo/e2e/journeys/slos_overview.journey.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/page_objects/slo_app.tsx b/x-pack/solutions/observability/plugins/slo/e2e/page_objects/slo_app.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/page_objects/slo_app.tsx rename to x-pack/solutions/observability/plugins/slo/e2e/page_objects/slo_app.tsx diff --git a/x-pack/plugins/observability_solution/slo/e2e/services/annotation_data_service.ts b/x-pack/solutions/observability/plugins/slo/e2e/services/annotation_data_service.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/services/annotation_data_service.ts rename to x-pack/solutions/observability/plugins/slo/e2e/services/annotation_data_service.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/services/slo_data_service.ts b/x-pack/solutions/observability/plugins/slo/e2e/services/slo_data_service.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/services/slo_data_service.ts rename to x-pack/solutions/observability/plugins/slo/e2e/services/slo_data_service.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/synthetics_run.ts b/x-pack/solutions/observability/plugins/slo/e2e/synthetics_run.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/e2e/synthetics_run.ts rename to x-pack/solutions/observability/plugins/slo/e2e/synthetics_run.ts diff --git a/x-pack/plugins/observability_solution/slo/e2e/tsconfig.json b/x-pack/solutions/observability/plugins/slo/e2e/tsconfig.json similarity index 87% rename from x-pack/plugins/observability_solution/slo/e2e/tsconfig.json rename to x-pack/solutions/observability/plugins/slo/e2e/tsconfig.json index 68203a4db6013..420d48f662617 100644 --- a/x-pack/plugins/observability_solution/slo/e2e/tsconfig.json +++ b/x-pack/solutions/observability/plugins/slo/e2e/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../../tsconfig.base.json", + "extends": "../../../../../../tsconfig.base.json", "exclude": ["tmp", "target/**/*"], "include": ["**/*"], "compilerOptions": { diff --git a/x-pack/plugins/observability_solution/slo/emotion.d.ts b/x-pack/solutions/observability/plugins/slo/emotion.d.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/emotion.d.ts rename to x-pack/solutions/observability/plugins/slo/emotion.d.ts diff --git a/x-pack/plugins/observability_solution/slo/jest.config.js b/x-pack/solutions/observability/plugins/slo/jest.config.js similarity index 50% rename from x-pack/plugins/observability_solution/slo/jest.config.js rename to x-pack/solutions/observability/plugins/slo/jest.config.js index fa7ff9c84deca..5de5881b39250 100644 --- a/x-pack/plugins/observability_solution/slo/jest.config.js +++ b/x-pack/solutions/observability/plugins/slo/jest.config.js @@ -7,13 +7,13 @@ module.exports = { preset: '@kbn/test', - rootDir: '../../../..', - roots: ['/x-pack/plugins/observability_solution/slo'], - setupFiles: ['/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js'], + rootDir: '../../../../..', + roots: ['/x-pack/solutions/observability/plugins/slo'], + setupFiles: ['/x-pack/solutions/observability/plugins/slo/.storybook/jest_setup.js'], coverageDirectory: - '/target/kibana-coverage/jest/x-pack/plugins/observability_solution/slo', + '/target/kibana-coverage/jest/x-pack/solutions/observability/plugins/slo', coverageReporters: ['text', 'html'], collectCoverageFrom: [ - '/x-pack/plugins/observability_solution/slo/{common,public,server}/**/*.{js,ts,tsx}', + '/x-pack/solutions/observability/plugins/slo/{common,public,server}/**/*.{js,ts,tsx}', ], }; diff --git a/x-pack/plugins/observability_solution/slo/kibana.jsonc b/x-pack/solutions/observability/plugins/slo/kibana.jsonc similarity index 100% rename from x-pack/plugins/observability_solution/slo/kibana.jsonc rename to x-pack/solutions/observability/plugins/slo/kibana.jsonc diff --git a/x-pack/plugins/observability_solution/slo/public/application.tsx b/x-pack/solutions/observability/plugins/slo/public/application.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/application.tsx rename to x-pack/solutions/observability/plugins/slo/public/application.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/alert_details_app_section.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/alert_details_app_section.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/alert_details_app_section.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/alert_details_app_section.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/apm/apm_alert_details.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/apm/apm_alert_details.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/apm/apm_alert_details.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/apm/apm_alert_details.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/apm/embeddable_root.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/apm/embeddable_root.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/apm/embeddable_root.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/apm/embeddable_root.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/custom_kql_panels.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/custom_kql_panels.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/custom_kql_panels.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/custom_kql_panels.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/__snapshots__/log_rate_analysis_query.test.ts.snap b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/__snapshots__/log_rate_analysis_query.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/__snapshots__/log_rate_analysis_query.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/__snapshots__/log_rate_analysis_query.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.test.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.test.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/helpers/log_rate_analysis_query.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/log_rate_analysis_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/log_rate_analysis_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_kql/log_rate_analysis_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_kql/log_rate_analysis_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_panels.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_panels.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/custom_panels/custom_panels.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/custom_panels/custom_panels.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/components/error_rate/error_rate_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/error_rate/error_rate_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/components/error_rate/error_rate_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/components/error_rate/error_rate_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/types.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/types.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/alert.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/alert.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/alert.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/alert.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/last_duration_i18n.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/last_duration_i18n.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/last_duration_i18n.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/last_duration_i18n.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/time_range.ts b/x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/time_range.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/alert_details/utils/time_range.ts rename to x-pack/solutions/observability/plugins/slo/public/components/alert_details/utils/time_range.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/burn_rate_rule_editor.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/constants.ts b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/dependencies.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/dependencies.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/dependencies.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/dependencies.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/dependency_editor.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/dependency_editor.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/dependency_editor.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/dependency_editor.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/index.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/long_window_duration.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/long_window_duration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/long_window_duration.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/long_window_duration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/short_window_duration.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/short_window_duration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/short_window_duration.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/short_window_duration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/slo_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/validation.test.ts b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/validation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/validation.test.ts rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/validation.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/validation.ts b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/validation.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/validation.ts rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/validation.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/windows.tsx b/x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/windows.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/windows.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/burn_rate_rule_editor/windows.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/good_bad_events_chart/good_bad_events_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/components/good_bad_events_chart/good_bad_events_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/good_bad_events_chart/good_bad_events_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/good_bad_events_chart/good_bad_events_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/header_menu/header_menu.tsx b/x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/header_menu/header_menu.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/header_menu/header_menu.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/loading_state.tsx b/x-pack/solutions/observability/plugins/slo/public/components/loading_state.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/loading_state.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/loading_state.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/index.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/auto_refresh_button/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/index.ts b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/index.ts rename to x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/index.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/use_lens_definition.ts b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/use_lens_definition.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/use_lens_definition.ts rename to x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/use_lens_definition.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/utils.test.ts b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/utils.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/utils.test.ts rename to x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/utils.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/utils.ts b/x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/utils.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/utils.ts rename to x-pack/solutions/observability/plugins/slo/public/components/slo/error_rate_chart/utils.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/simple_burn_rate/burn_rate.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/simple_burn_rate/burn_rate.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/simple_burn_rate/burn_rate.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/simple_burn_rate/burn_rate.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_outdated_callout/index.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_outdated_callout/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_outdated_callout/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_outdated_callout/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_permissions_callout/index.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_permissions_callout/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_permissions_callout/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_permissions_callout/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/index.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/components/technical_preview_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/components/technical_preview_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/components/technical_preview_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/components/technical_preview_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/constants.ts b/x-pack/solutions/observability/plugins/slo/public/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/context/plugin_context.tsx b/x-pack/solutions/observability/plugins/slo/public/context/plugin_context.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/context/plugin_context.tsx rename to x-pack/solutions/observability/plugins/slo/public/context/plugin_context.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/data/slo/common.ts b/x-pack/solutions/observability/plugins/slo/public/data/slo/common.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/data/slo/common.ts rename to x-pack/solutions/observability/plugins/slo/public/data/slo/common.ts diff --git a/x-pack/plugins/observability_solution/slo/public/data/slo/historical_summary_data.ts b/x-pack/solutions/observability/plugins/slo/public/data/slo/historical_summary_data.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/data/slo/historical_summary_data.ts rename to x-pack/solutions/observability/plugins/slo/public/data/slo/historical_summary_data.ts diff --git a/x-pack/plugins/observability_solution/slo/public/data/slo/indicator.ts b/x-pack/solutions/observability/plugins/slo/public/data/slo/indicator.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/data/slo/indicator.ts rename to x-pack/solutions/observability/plugins/slo/public/data/slo/indicator.ts diff --git a/x-pack/plugins/observability_solution/slo/public/data/slo/slo.ts b/x-pack/solutions/observability/plugins/slo/public/data/slo/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/data/slo/slo.ts rename to x-pack/solutions/observability/plugins/slo/public/data/slo/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/data/slo/time_window.ts b/x-pack/solutions/observability/plugins/slo/public/data/slo/time_window.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/data/slo/time_window.ts rename to x-pack/solutions/observability/plugins/slo/public/data/slo/time_window.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/constants.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_open_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_open_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_open_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_open_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/slo_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/types.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/alerts/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/burn_rate.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/burn_rate.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/burn_rate.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/burn_rate.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/burn_rate_react_embeddable_factory.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/burn_rate_react_embeddable_factory.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/burn_rate_react_embeddable_factory.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/burn_rate_react_embeddable_factory.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/constants.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/open_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/open_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/open_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/open_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/types.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/burn_rate/types.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/burn_rate/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/common/slo_overview_details.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/common/slo_overview_details.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/common/slo_overview_details.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/common/slo_overview_details.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/constants.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/constants.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_burn_down.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_burn_down.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_burn_down.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_burn_down.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_open_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_open_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_open_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_open_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_react_embeddable_factory.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_react_embeddable_factory.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/error_budget_react_embeddable_factory.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/error_budget_react_embeddable_factory.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/slo_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/slo_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/types.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/types.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/error_budget/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/constants.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/group_view.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/group_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/group_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/group_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/__snapshots__/build_kql_query.test.ts.snap b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/__snapshots__/build_kql_query.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/__snapshots__/build_kql_query.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/__snapshots__/build_kql_query.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.test.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.test.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/helpers/build_kql_query.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/slo_group_filters.scss b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/slo_group_filters.scss similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/slo_group_filters.scss rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/slo_group_filters.scss diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/slo_group_filters.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/slo_group_filters.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/group_view/slo_group_filters.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/group_view/slo_group_filters.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/overview_mode_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/overview_mode_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/overview_mode_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/overview_mode_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_embeddable_factory.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_grid.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview_grid.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_grid.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview_grid.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_open_configuration.tsx b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview_open_configuration.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_open_configuration.tsx rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/slo_overview_open_configuration.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/types.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/overview/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/embeddable/slo/types.ts b/x-pack/solutions/observability/plugins/slo/public/embeddable/slo/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/embeddable/slo/types.ts rename to x-pack/solutions/observability/plugins/slo/public/embeddable/slo/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_capabilities.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_capabilities.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_capabilities.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_capabilities.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_active_alerts.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_active_alerts.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_active_alerts.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_active_alerts.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_apm_suggestions.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_apm_suggestions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_apm_suggestions.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_apm_suggestions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_historical_summary.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_historical_summary.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_historical_summary.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_historical_summary.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_slo_list.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_slo_list.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/__storybook_mocks__/use_fetch_slo_list.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/__storybook_mocks__/use_fetch_slo_list.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/active_alerts.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/active_alerts.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/active_alerts.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/active_alerts.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/query_key_factory.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/query_key_factory.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/query_key_factory.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/query_key_factory.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_alerts_url.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_alerts_url.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_alerts_url.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_alerts_url.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_capabilities.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_capabilities.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_capabilities.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_capabilities.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_clone_slo.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_clone_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_clone_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_clone_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_create_burn_rate_rule.tsx b/x-pack/solutions/observability/plugins/slo/public/hooks/use_create_burn_rate_rule.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_create_burn_rate_rule.tsx rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_create_burn_rate_rule.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_create_data_view.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_create_data_view.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_create_data_view.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_create_data_view.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_create_slo.tsx b/x-pack/solutions/observability/plugins/slo/public/hooks/use_create_slo.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_create_slo.tsx rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_create_slo.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_delete_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_delete_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo_instance.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_delete_slo_instance.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo_instance.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_delete_slo_instance.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_active_alerts.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_active_alerts.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_active_alerts.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_active_alerts.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_indices.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_apm_indices.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_indices.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_apm_indices.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_suggestions.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_apm_suggestions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_suggestions.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_apm_suggestions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_global_diagnosis.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_global_diagnosis.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_global_diagnosis.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_global_diagnosis.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_group_by_cardinality.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_group_by_cardinality.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_group_by_cardinality.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_group_by_cardinality.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_historical_summary.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_historical_summary.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_historical_summary.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_historical_summary.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_indices.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_indices.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_indices.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_indices.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_rules_for_slo.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_rules_for_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_rules_for_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_rules_for_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_burn_rates.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_burn_rates.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_burn_rates.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_burn_rates.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_definitions.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_definitions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_definitions.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_definitions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_details.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_details.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_details.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_details.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_groups.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_groups.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_groups.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_groups.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_health.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_health.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_health.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_health.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_inspect.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_inspect.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_inspect.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_inspect.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_list.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_list.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_list.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slo_list.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slos_with_burn_rate_rules.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slos_with_burn_rate_rules.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slos_with_burn_rate_rules.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_slos_with_burn_rate_rules.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_synthetics_suggestions.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_synthetics_suggestions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_synthetics_suggestions.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_fetch_synthetics_suggestions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_get_filtered_rule_types.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_get_filtered_rule_types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_get_filtered_rule_types.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_get_filtered_rule_types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_get_preview_data.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_get_preview_data.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_get_preview_data.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_get_preview_data.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_kibana.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_kibana.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_kibana.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_kibana.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_license.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_license.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_license.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_license.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_permissions.test.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_permissions.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_permissions.test.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_permissions.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_permissions.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_permissions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_permissions.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_permissions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_plugin_context.tsx b/x-pack/solutions/observability/plugins/slo/public/hooks/use_plugin_context.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_plugin_context.tsx rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_plugin_context.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_reset_slo.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_reset_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_reset_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_reset_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_space.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_space.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_space.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_space.ts diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_update_slo.ts b/x-pack/solutions/observability/plugins/slo/public/hooks/use_update_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/hooks/use_update_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/hooks/use_update_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/index.ts b/x-pack/solutions/observability/plugins/slo/public/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/index.ts rename to x-pack/solutions/observability/plugins/slo/public/index.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_details.test.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_details.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_details.test.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_details.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_details.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_details.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_details.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_details.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.test.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_edit.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_edit.test.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_edit.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_edit.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_edit.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_edit.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_list.test.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_list.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_list.test.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_list.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/locators/slo_list.ts b/x-pack/solutions/observability/plugins/slo/public/locators/slo_list.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/locators/slo_list.ts rename to x-pack/solutions/observability/plugins/slo/public/locators/slo_list.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/404.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/404.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/404.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/404.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/burn_rate_status.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/utils.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/utils.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/burn_rate_panel/utils.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/burn_rate_panel/utils.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_actions.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_actions.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_actions.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_actions.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_chart_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_chart_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_header.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_header.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_header.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_header.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_header.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_header.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_header.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/error_budget_header.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_area_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/events_area_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_area_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/events_area_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_chart_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/events_chart_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_chart_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/events_chart_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/groupings/slo_grouping_value_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/groupings/slo_grouping_value_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/groupings/slo_grouping_value_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/groupings/slo_grouping_value_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/groupings/slo_groupings.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/groupings/slo_groupings.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/groupings/slo_groupings.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/groupings/slo_groupings.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_control.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_control.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_control.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_control.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_title.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_title.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_title.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/header_title.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/historical_data_charts.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/historical_data_charts.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/historical_data_charts.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/historical_data_charts.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/history/slo_details_history.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/history/slo_details_history.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/history/slo_details_history.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/history/slo_details_history.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/display_query.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/display_query.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/display_query.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/display_query.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview_item.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview_item.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview_item.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/overview_item.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/synthetics_indicator_overview.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/synthetics_indicator_overview.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/synthetics_indicator_overview.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/overview/synthetics_indicator_overview.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/sli_chart_panel.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/sli_chart_panel.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/sli_chart_panel.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/sli_chart_panel.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_detail_alerts.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_detail_alerts.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_detail_alerts.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_detail_alerts.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_details.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_details.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_details.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_details.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_details.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_details.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_details.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_details.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_health_callout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_health_callout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_health_callout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_health_callout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_remote_callout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_remote_callout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/slo_remote_callout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/slo_remote_callout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/timeslice_annotation.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/timeslice_annotation.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/timeslice_annotation.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/timeslice_annotation.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/wide_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/wide_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/wide_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/components/wide_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_fetch_burn_rate_windows.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_fetch_burn_rate_windows.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_fetch_burn_rate_windows.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_fetch_burn_rate_windows.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_fetch_slo_instances.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_fetch_slo_instances.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_fetch_slo_instances.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_fetch_slo_instances.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_get_query_params.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_get_query_params.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_get_query_params.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_get_query_params.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_selected_tab.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_selected_tab.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_selected_tab.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_selected_tab.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_actions.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_slo_actions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_actions.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_slo_actions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/slo_details.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/slo_details.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/slo_details.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/slo_details.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_details/types.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_details/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_details/types.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_details/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/data_preview_chart.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/data_preview_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/data_preview_chart.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/data_preview_chart.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/documents_table.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/documents_table.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/documents_table.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/documents_table.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/equivalent_api_request.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/equivalent_api_request.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/equivalent_api_request.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/equivalent_api_request.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_cardinality.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_cardinality.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_cardinality.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_cardinality.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/group_by_field_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/optional_text.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/optional_text.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/optional_text.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/optional_text.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_builder.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_builder.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_search_bar.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_search_bar.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_search_bar.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/query_search_bar.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/runtime_field_used.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/runtime_field_used.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/runtime_field_used.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/runtime_field_used.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/code_block_accordion.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/code_block_accordion.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/code_block_accordion.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/code_block_accordion.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/loading_state.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/loading_state.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/loading_state.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/loading_state.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/req_code_viewer.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/req_code_viewer.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/req_code_viewer.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/req_code_viewer.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/slo_inspect.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/slo_inspect.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect/slo_inspect.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/slo_inspect/slo_inspect.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/timestamp_field_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/timestamp_field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/timestamp_field_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/timestamp_field_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_table_docs.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/use_table_docs.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_table_docs.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/common/use_table_docs.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/advanced_settings.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/advanced_settings.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/advanced_settings.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/advanced_settings.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/sync_field_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/sync_field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/sync_field_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/advanced_settings/sync_field_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_availability/apm_availability_indicator_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/field_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.test.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.test.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/get_group_by_cardinality_filters.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/use_apm_default_values.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/use_apm_default_values.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_common/use_apm_default_values.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_common/use_apm_default_values.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/apm_latency/apm_latency_indicator_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_and_timestamp_field.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_and_timestamp_field.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_and_timestamp_field.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_and_timestamp_field.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/index_selection.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/use_adhoc_data_views.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/use_adhoc_data_views.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_common/use_adhoc_data_views.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_common/use_adhoc_data_views.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_kql/custom_kql_indicator_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/custom_metric_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/metric_indicator.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/metric_indicator.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/custom_metric/metric_indicator.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/custom_metric/metric_indicator.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/histogram/histogram_indicator_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_availability/synthetics_availability_indicator_type_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_common/field_selector.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_common/field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/synthetics_common/field_selector.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/synthetics_common/field_selector.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_indicator.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_indicator.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_indicator.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_indicator.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_input.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_input.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_input.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/metric_input.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/timeslice_metric_indicator.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/timeslice_metric_indicator.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/timeslice_metric_indicator.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/indicator_section/timeslice_metric/timeslice_metric_indicator.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/components/slo_edit_form_objective_section_timeslices.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/constants.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/constants.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/aggregation_options.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/aggregation_options.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/aggregation_options.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/aggregation_options.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_options.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/create_options.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_options.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/create_options.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/format_filters.test.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/format_filters.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/format_filters.test.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/format_filters.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/format_filters.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/format_filters.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/format_filters.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/format_filters.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_fetch_suggestions.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_fetch_suggestions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_fetch_suggestions.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_fetch_suggestions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_find_runtime_usage.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_find_runtime_usage.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_find_runtime_usage.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_find_runtime_usage.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_preview.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_preview.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_preview.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_preview.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_show_sections.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_show_sections.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/slo_add_form_flyout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/shared_flyout/slo_add_form_flyout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/slo_add_form_flyout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/shared_flyout/slo_add_form_flyout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/slo_edit.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/types.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_edit/types.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_edit/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/index.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/index.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/index.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_settings/hooks/use_get_settings.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/hooks/use_get_settings.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_settings/hooks/use_get_settings.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/hooks/use_get_settings.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_settings/hooks/use_put_slo_settings.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/hooks/use_put_slo_settings.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_settings/hooks/use_put_slo_settings.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/hooks/use_put_slo_settings.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_settings/settings_form.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/settings_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_settings/settings_form.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/settings_form.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_settings/slo_settings.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/slo_settings.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slo_settings/slo_settings.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slo_settings/slo_settings.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_badges.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_badges.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_badges.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_badges.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_remote_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_remote_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_remote_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_remote_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_rules_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_rules_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_time_window_badge.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_time_window_badge.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_time_window_badge.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_time_window_badge.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_time_window_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_time_window_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_time_window_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/badges/slo_time_window_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_actions.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_actions.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_actions.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_actions.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_badges.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_badges.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_badges.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_badges.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_instance_badge.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_instance_badge.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item_instance_badge.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slo_card_item_instance_badge.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slos_card_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slos_card_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slos_card_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/card_view/slos_card_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/create_slo_btn.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/create_slo_btn.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/create_slo_btn.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/create_slo_btn.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/edit_burn_rate_rule_flyout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/edit_burn_rate_rule_flyout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/edit_burn_rate_rule_flyout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/edit_burn_rate_rule_flyout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/feedback_button.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/feedback_button.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/feedback_button.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/feedback_button.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/quick_filters.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/quick_filters.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/quick_filters.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/quick_filters.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_groupings.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/slo_groupings.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_groupings.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/slo_groupings.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_tags_list.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/slo_tags_list.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_tags_list.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/slo_tags_list.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/sort_by_select.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/sort_by_select.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/sort_by_select.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/common/sort_by_select.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_view.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_view.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_view.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_view.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/group_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.test.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.test.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/grouped_slos/hooks/use_group_name.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/header_title.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/header_title.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/header_title.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/header_title.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/header_title.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/header_title.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/header_title.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/header_title.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/health_callout/health_callout.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/health_callout/health_callout.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/health_callout/health_callout.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/health_callout/health_callout.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_context_menu.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_context_menu.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_context_menu.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_context_menu.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_item_actions.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_item_actions.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_item_actions.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_item_actions.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_empty.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_empty.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_empty.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_empty.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_error.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_error.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_error.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_error.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_group_by.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_group_by.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_group_by.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_group_by.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_search_bar.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_search_bar.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_item.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_item.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_item.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_item.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_item.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_item.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_item.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_item.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_sparkline.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_sparkline.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_sparkline.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_sparkline.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_summary.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_summary.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_summary.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slo_summary.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/overview_item.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/overview_item.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/overview_item.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/overview_item.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/slo_overview_alerts.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/slo_overview_alerts.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/slo_overview_alerts.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/slo_overview_alerts.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/slos_overview.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/slos_overview.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_overview/slos_overview.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_overview/slos_overview.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/slos_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/slos_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/toggle_slo_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/toggle_slo_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/toggle_slo_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/toggle_slo_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/components/ungrouped_slos/ungrouped_view.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/components/ungrouped_slos/ungrouped_view.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/components/ungrouped_slos/ungrouped_view.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/components/ungrouped_slos/ungrouped_view.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_crud_loading.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_crud_loading.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_crud_loading.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_crud_loading.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_fetch_slos_overview.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_fetch_slos_overview.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_fetch_slos_overview.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_fetch_slos_overview.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_slo_list_actions.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_slo_list_actions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_slo_list_actions.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_slo_list_actions.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_slo_summary.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_slo_summary.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_slo_summary.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_slo_summary.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_summary_dataview.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_summary_dataview.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_summary_dataview.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_summary_dataview.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_url_search_state.ts b/x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_url_search_state.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_url_search_state.ts rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/hooks/use_url_search_state.ts diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/slos.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos/slos.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos/slos.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/assets/illustration.svg b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/assets/illustration.svg similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/assets/illustration.svg rename to x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/assets/illustration.svg diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.stories.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.stories.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.stories.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.stories.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.test.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.test.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.test.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.tsx b/x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.tsx rename to x-pack/solutions/observability/plugins/slo/public/pages/slos_welcome/slos_welcome.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.mock.tsx b/x-pack/solutions/observability/plugins/slo/public/plugin.mock.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/plugin.mock.tsx rename to x-pack/solutions/observability/plugins/slo/public/plugin.mock.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.ts b/x-pack/solutions/observability/plugins/slo/public/plugin.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/plugin.ts rename to x-pack/solutions/observability/plugins/slo/public/plugin.ts diff --git a/x-pack/plugins/observability_solution/slo/public/routes/routes.tsx b/x-pack/solutions/observability/plugins/slo/public/routes/routes.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/routes/routes.tsx rename to x-pack/solutions/observability/plugins/slo/public/routes/routes.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/rules/observability_rule_type_registry_mock.ts b/x-pack/solutions/observability/plugins/slo/public/rules/observability_rule_type_registry_mock.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/rules/observability_rule_type_registry_mock.ts rename to x-pack/solutions/observability/plugins/slo/public/rules/observability_rule_type_registry_mock.ts diff --git a/x-pack/plugins/observability_solution/slo/public/rules/register_burn_rate_rule_type.ts b/x-pack/solutions/observability/plugins/slo/public/rules/register_burn_rate_rule_type.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/rules/register_burn_rate_rule_type.ts rename to x-pack/solutions/observability/plugins/slo/public/rules/register_burn_rate_rule_type.ts diff --git a/x-pack/plugins/observability_solution/slo/public/types.ts b/x-pack/solutions/observability/plugins/slo/public/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/types.ts rename to x-pack/solutions/observability/plugins/slo/public/types.ts diff --git a/x-pack/plugins/observability_solution/slo/public/typings/index.ts b/x-pack/solutions/observability/plugins/slo/public/typings/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/typings/index.ts rename to x-pack/solutions/observability/plugins/slo/public/typings/index.ts diff --git a/x-pack/plugins/observability_solution/slo/public/typings/slo/index.ts b/x-pack/solutions/observability/plugins/slo/public/typings/slo/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/typings/slo/index.ts rename to x-pack/solutions/observability/plugins/slo/public/typings/slo/index.ts diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/create_alerts_panel_action.tsx b/x-pack/solutions/observability/plugins/slo/public/ui_actions/create_alerts_panel_action.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/ui_actions/create_alerts_panel_action.tsx rename to x-pack/solutions/observability/plugins/slo/public/ui_actions/create_alerts_panel_action.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/create_burn_rate_panel_action.tsx b/x-pack/solutions/observability/plugins/slo/public/ui_actions/create_burn_rate_panel_action.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/ui_actions/create_burn_rate_panel_action.tsx rename to x-pack/solutions/observability/plugins/slo/public/ui_actions/create_burn_rate_panel_action.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/create_error_budget_action.tsx b/x-pack/solutions/observability/plugins/slo/public/ui_actions/create_error_budget_action.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/ui_actions/create_error_budget_action.tsx rename to x-pack/solutions/observability/plugins/slo/public/ui_actions/create_error_budget_action.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/create_overview_panel_action.tsx b/x-pack/solutions/observability/plugins/slo/public/ui_actions/create_overview_panel_action.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/ui_actions/create_overview_panel_action.tsx rename to x-pack/solutions/observability/plugins/slo/public/ui_actions/create_overview_panel_action.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts b/x-pack/solutions/observability/plugins/slo/public/ui_actions/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts rename to x-pack/solutions/observability/plugins/slo/public/ui_actions/index.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/get_lazy_with_context_providers.tsx b/x-pack/solutions/observability/plugins/slo/public/utils/get_lazy_with_context_providers.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/get_lazy_with_context_providers.tsx rename to x-pack/solutions/observability/plugins/slo/public/utils/get_lazy_with_context_providers.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.mock.ts b/x-pack/solutions/observability/plugins/slo/public/utils/kibana_react.mock.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/kibana_react.mock.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/kibana_react.mock.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.storybook_decorator.tsx b/x-pack/solutions/observability/plugins/slo/public/utils/kibana_react.storybook_decorator.tsx similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/kibana_react.storybook_decorator.tsx rename to x-pack/solutions/observability/plugins/slo/public/utils/kibana_react.storybook_decorator.tsx diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/chart_data_formatter.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/chart_data_formatter.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/chart_data_formatter.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/chart_data_formatter.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/duration.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/duration.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/duration.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/duration.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/get_discover_link.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/get_discover_link.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/get_discover_link.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/get_discover_link.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/groupings.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/groupings.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/groupings.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/groupings.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/indicator.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/indicator.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/indicator.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/indicator.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/labels.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/labels.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/labels.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/labels.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/remote_slo_urls.test.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/remote_slo_urls.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/remote_slo_urls.test.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/remote_slo_urls.test.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/slo/remote_slo_urls.ts b/x-pack/solutions/observability/plugins/slo/public/utils/slo/remote_slo_urls.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/public/utils/slo/remote_slo_urls.ts rename to x-pack/solutions/observability/plugins/slo/public/utils/slo/remote_slo_urls.ts diff --git a/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx b/x-pack/solutions/observability/plugins/slo/public/utils/test_helper.tsx similarity index 96% rename from x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx rename to x-pack/solutions/observability/plugins/slo/public/utils/test_helper.tsx index 44cd0abceded4..723d2fc68bee1 100644 --- a/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx +++ b/x-pack/solutions/observability/plugins/slo/public/utils/test_helper.tsx @@ -53,7 +53,7 @@ export const render = (component: React.ReactNode) => { exploratoryView: { createExploratoryViewUrl: jest.fn(), getAppDataView: jest.fn(), - // eslint-disable-next-line @kbn/i18n/strings_should_be_translated_with_i18n + ExploratoryViewEmbeddable: () =>
Embeddable exploratory view
, }, }} diff --git a/x-pack/plugins/observability_solution/slo/scripts/e2e.js b/x-pack/solutions/observability/plugins/slo/scripts/e2e.js similarity index 100% rename from x-pack/plugins/observability_solution/slo/scripts/e2e.js rename to x-pack/solutions/observability/plugins/slo/scripts/e2e.js diff --git a/x-pack/plugins/observability_solution/slo/scripts/storybook.js b/x-pack/solutions/observability/plugins/slo/scripts/storybook.js similarity index 100% rename from x-pack/plugins/observability_solution/slo/scripts/storybook.js rename to x-pack/solutions/observability/plugins/slo/scripts/storybook.js diff --git a/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_mappings_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_mappings_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_mappings_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_mappings_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_settings_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_settings_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_settings_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_settings_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_mappings_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_summary_mappings_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_mappings_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_summary_mappings_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_settings_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_summary_settings_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_settings_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/component_templates/slo_summary_settings_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_index_templates.ts b/x-pack/solutions/observability/plugins/slo/server/assets/index_templates/slo_index_templates.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_index_templates.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/index_templates/slo_index_templates.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_summary_index_templates.ts b/x-pack/solutions/observability/plugins/slo/server/assets/index_templates/slo_summary_index_templates.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_summary_index_templates.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/index_templates/slo_summary_index_templates.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/ingest_templates/slo_pipeline_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/ingest_templates/slo_pipeline_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.test.ts b/x-pack/solutions/observability/plugins/slo/server/assets/transform_templates/slo_transform_template.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.test.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/transform_templates/slo_transform_template.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.ts b/x-pack/solutions/observability/plugins/slo/server/assets/transform_templates/slo_transform_template.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.ts rename to x-pack/solutions/observability/plugins/slo/server/assets/transform_templates/slo_transform_template.ts diff --git a/x-pack/plugins/observability_solution/slo/server/client/index.ts b/x-pack/solutions/observability/plugins/slo/server/client/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/client/index.ts rename to x-pack/solutions/observability/plugins/slo/server/client/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/common/constants.ts b/x-pack/solutions/observability/plugins/slo/server/common/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/common/constants.ts rename to x-pack/solutions/observability/plugins/slo/server/common/constants.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/common.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/common.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/common.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/common.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/error_budget.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/error_budget.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/error_budget.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/error_budget.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/health.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/health.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/health.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/health.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/index.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/index.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/indicators.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/indicators.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/indicators.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/indicators.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/slo.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/slo.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/time_window.ts b/x-pack/solutions/observability/plugins/slo/server/domain/models/time_window.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/models/time_window.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/models/time_window.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.test.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_burn_rate.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.test.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_burn_rate.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_burn_rate.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_burn_rate.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.test.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_sli.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.test.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_sli.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_sli.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_sli.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.test.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_summary_status.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.test.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_summary_status.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/compute_summary_status.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/compute_summary_status.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.test.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/date_range.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/date_range.test.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/date_range.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/date_range.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/date_range.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/date_range.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/error_budget.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/error_budget.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/error_budget.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/error_budget.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/get_delay_in_seconds_from_slo.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/get_delay_in_seconds_from_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/get_delay_in_seconds_from_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/get_delay_in_seconds_from_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/get_lookback_date_range.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/get_lookback_date_range.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/get_lookback_date_range.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/get_lookback_date_range.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/index.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/index.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/validate_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/validate_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts b/x-pack/solutions/observability/plugins/slo/server/domain/services/validate_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/domain/services/validate_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/errors/errors.ts b/x-pack/solutions/observability/plugins/slo/server/errors/errors.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/errors/errors.ts rename to x-pack/solutions/observability/plugins/slo/server/errors/errors.ts diff --git a/x-pack/plugins/observability_solution/slo/server/errors/handler.ts b/x-pack/solutions/observability/plugins/slo/server/errors/handler.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/errors/handler.ts rename to x-pack/solutions/observability/plugins/slo/server/errors/handler.ts diff --git a/x-pack/plugins/observability_solution/slo/server/errors/index.ts b/x-pack/solutions/observability/plugins/slo/server/errors/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/errors/index.ts rename to x-pack/solutions/observability/plugins/slo/server/errors/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/index.ts b/x-pack/solutions/observability/plugins/slo/server/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/index.ts rename to x-pack/solutions/observability/plugins/slo/server/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.test.ts b/x-pack/solutions/observability/plugins/slo/server/lib/collectors/fetcher.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.test.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/collectors/fetcher.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.ts b/x-pack/solutions/observability/plugins/slo/server/lib/collectors/fetcher.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/collectors/fetcher.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/collectors/register.ts b/x-pack/solutions/observability/plugins/slo/server/lib/collectors/register.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/collectors/register.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/collectors/register.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/collectors/type.ts b/x-pack/solutions/observability/plugins/slo/server/lib/collectors/type.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/collectors/type.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/collectors/type.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/register_burn_rate_rule.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/register_burn_rate_rule.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.test.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/executor.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.test.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/executor.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/executor.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/executor.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/field_map.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/field_map.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/field_map.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/field_map.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/index.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/index.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate_dependencies.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/evaluate_dependencies.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate_dependencies.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/evaluate_dependencies.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.test.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.test.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/should_suppress_instance_id.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/summary_repository.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/summary_repository.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/summary_repository.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/lib/summary_repository.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/register.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/register.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/register.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/register.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/types.ts b/x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/types.ts rename to x-pack/solutions/observability/plugins/slo/server/lib/rules/slo_burn_rate/types.ts diff --git a/x-pack/plugins/observability_solution/slo/server/plugin.ts b/x-pack/solutions/observability/plugins/slo/server/plugin.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/plugin.ts rename to x-pack/solutions/observability/plugins/slo/server/plugin.ts diff --git a/x-pack/plugins/observability_solution/slo/server/routes/create_slo_server_route.ts b/x-pack/solutions/observability/plugins/slo/server/routes/create_slo_server_route.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/routes/create_slo_server_route.ts rename to x-pack/solutions/observability/plugins/slo/server/routes/create_slo_server_route.ts diff --git a/x-pack/plugins/observability_solution/slo/server/routes/get_slo_server_route_repository.ts b/x-pack/solutions/observability/plugins/slo/server/routes/get_slo_server_route_repository.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/routes/get_slo_server_route_repository.ts rename to x-pack/solutions/observability/plugins/slo/server/routes/get_slo_server_route_repository.ts diff --git a/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts b/x-pack/solutions/observability/plugins/slo/server/routes/register_routes.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts rename to x-pack/solutions/observability/plugins/slo/server/routes/register_routes.ts diff --git a/x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts b/x-pack/solutions/observability/plugins/slo/server/routes/slo/route.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts rename to x-pack/solutions/observability/plugins/slo/server/routes/slo/route.ts diff --git a/x-pack/plugins/observability_solution/slo/server/routes/types.ts b/x-pack/solutions/observability/plugins/slo/server/routes/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/routes/types.ts rename to x-pack/solutions/observability/plugins/slo/server/routes/types.ts diff --git a/x-pack/plugins/observability_solution/slo/server/saved_objects/index.ts b/x-pack/solutions/observability/plugins/slo/server/saved_objects/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/saved_objects/index.ts rename to x-pack/solutions/observability/plugins/slo/server/saved_objects/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/saved_objects/slo.ts b/x-pack/solutions/observability/plugins/slo/server/saved_objects/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/saved_objects/slo.ts rename to x-pack/solutions/observability/plugins/slo/server/saved_objects/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/saved_objects/slo_settings.ts b/x-pack/solutions/observability/plugins/slo/server/saved_objects/slo_settings.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/saved_objects/slo_settings.ts rename to x-pack/solutions/observability/plugins/slo/server/saved_objects/slo_settings.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/create_slo.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/create_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/create_slo.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/create_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/delete_slo.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/delete_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/delete_slo.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/delete_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/manage_slo.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/manage_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/manage_slo.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/manage_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/reset_slo.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/reset_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/reset_slo.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/reset_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/slo_definition_client.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/slo_definition_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/slo_definition_client.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/slo_definition_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_client.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/summary_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_client.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/summary_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_search_client.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/summary_search_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_search_client.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/__snapshots__/summary_search_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/aggregations/index.ts b/x-pack/solutions/observability/plugins/slo/server/services/aggregations/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/aggregations/index.ts rename to x-pack/solutions/observability/plugins/slo/server/services/aggregations/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/burn_rates_client.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/burn_rates_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/burn_rates_client.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/burn_rates_client.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/burn_rates_client.ts b/x-pack/solutions/observability/plugins/slo/server/services/burn_rates_client.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/burn_rates_client.ts rename to x-pack/solutions/observability/plugins/slo/server/services/burn_rates_client.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/create_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/create_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/create_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/create_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/create_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/create_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/create_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/create_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/delete_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/delete_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/delete_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/delete_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/delete_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/delete_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/delete_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/delete_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/delete_slo_instances.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/delete_slo_instances.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.ts b/x-pack/solutions/observability/plugins/slo/server/services/delete_slo_instances.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.ts rename to x-pack/solutions/observability/plugins/slo/server/services/delete_slo_instances.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/find_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/find_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/find_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/find_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/find_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/find_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/find_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/find_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/find_slo_definitions.ts b/x-pack/solutions/observability/plugins/slo/server/services/find_slo_definitions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/find_slo_definitions.ts rename to x-pack/solutions/observability/plugins/slo/server/services/find_slo_definitions.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/find_slo_groups.ts b/x-pack/solutions/observability/plugins/slo/server/services/find_slo_groups.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/find_slo_groups.ts rename to x-pack/solutions/observability/plugins/slo/server/services/find_slo_groups.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/date.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/date.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/date.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/date.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/duration.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/duration.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/duration.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/duration.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/error_budget.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/error_budget.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/error_budget.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/error_budget.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/summary_search_document.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/summary_search_document.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/summary_search_document.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/summary_search_document.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/fixtures/time_window.ts b/x-pack/solutions/observability/plugins/slo/server/services/fixtures/time_window.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/fixtures/time_window.ts rename to x-pack/solutions/observability/plugins/slo/server/services/fixtures/time_window.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_burn_rates.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_burn_rates.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_burn_rates.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_burn_rates.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_diagnosis.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_diagnosis.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_diagnosis.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_diagnosis.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_preview_data.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_preview_data.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_preview_data.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_preview_data.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo_groupings.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo_groupings.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo_groupings.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo_groupings.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo_groupings.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo_groupings.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo_groupings.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo_groupings.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo_health.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo_health.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo_health.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo_health.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo_health.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo_health.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo_health.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo_health.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slo_suggestions.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slo_suggestions.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slo_suggestions.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slo_suggestions.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts b/x-pack/solutions/observability/plugins/slo/server/services/get_slos_overview.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/get_slos_overview.ts rename to x-pack/solutions/observability/plugins/slo/server/services/get_slos_overview.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/historical_summary_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/historical_summary_client.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.ts b/x-pack/solutions/observability/plugins/slo/server/services/historical_summary_client.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.ts rename to x-pack/solutions/observability/plugins/slo/server/services/historical_summary_client.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/index.ts b/x-pack/solutions/observability/plugins/slo/server/services/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/index.ts rename to x-pack/solutions/observability/plugins/slo/server/services/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/manage_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/manage_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/manage_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/manage_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/manage_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/manage_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/manage_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/manage_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/mocks/index.ts b/x-pack/solutions/observability/plugins/slo/server/services/mocks/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/mocks/index.ts rename to x-pack/solutions/observability/plugins/slo/server/services/mocks/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/reset_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/reset_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/reset_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/reset_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/reset_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/reset_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/reset_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/reset_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/resource_installer.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/resource_installer.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/resource_installer.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/resource_installer.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/resource_installer.ts b/x-pack/solutions/observability/plugins/slo/server/services/resource_installer.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/resource_installer.ts rename to x-pack/solutions/observability/plugins/slo/server/services/resource_installer.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_definition_client.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_definition_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_definition_client.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_definition_client.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_definition_client.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_definition_client.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_definition_client.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_definition_client.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_installer.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_installer.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_installer.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_installer.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_installer.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_installer.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_installer.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_installer.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_repository.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_repository.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_repository.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_repository.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_repository.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_repository.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_repository.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_repository.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/slo_settings.ts b/x-pack/solutions/observability/plugins/slo/server/services/slo_settings.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/slo_settings.ts rename to x-pack/solutions/observability/plugins/slo/server/services/slo_settings.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_client.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_client.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_client.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_client.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_client.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_client.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_client.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_search_client.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_search_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_search_client.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_search_client.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_search_client.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_search_client.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_search_client.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_search_client.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/occurrences.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/occurrences.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/occurrences.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/occurrences.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_calendar_aligned.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_calendar_aligned.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_calendar_aligned.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_calendar_aligned.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_rolling.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_rolling.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_rolling.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/__snapshots__/timeslices_rolling.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/common.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/common.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/common.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/common.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/occurrences.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/occurrences.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/occurrences.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/occurrences.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_rolling.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_rolling.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/utils.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/utils.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/utils.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/utils.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/utils.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/utils.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/utils.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/generators/utils.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/summary_transform_generator.ts b/x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/summary_transform_generator.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/summary_transform_generator.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summary_transform_generator/summary_transform_generator.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/summay_transform_manager.ts b/x-pack/solutions/observability/plugins/slo/server/services/summay_transform_manager.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/summay_transform_manager.ts rename to x-pack/solutions/observability/plugins/slo/server/services/summay_transform_manager.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.ts b/x-pack/solutions/observability/plugins/slo/server/services/tasks/orphan_summary_cleanup_task.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.ts rename to x-pack/solutions/observability/plugins/slo/server/services/tasks/orphan_summary_cleanup_task.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/synthetics_availability.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/synthetics_availability.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/synthetics_availability.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/synthetics_availability.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/transform_generator.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/transform_generator.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/transform_generator.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/__snapshots__/transform_generator.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_duration.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_duration.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_duration.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_duration.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_error_rate.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/apm_transaction_error_rate.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/common.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/common.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/common.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/common.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/histogram.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/histogram.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/histogram.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/histogram.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/index.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/index.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/kql_custom.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/kql_custom.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/kql_custom.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/kql_custom.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/metric_custom.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/metric_custom.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/metric_custom.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/metric_custom.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/synthetics_availability.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/synthetics_availability.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/synthetics_availability.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/synthetics_availability.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/timeslice_metric.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/timeslice_metric.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/timeslice_metric.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/timeslice_metric.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generator.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generator.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generator.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generator.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generators_factory.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generators_factory.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generators_factory.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/transform_generators_factory.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_generators/types.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_generators/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_generators/types.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_generators/types.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_manager.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_manager.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_manager.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_manager.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/transform_manager.ts b/x-pack/solutions/observability/plugins/slo/server/services/transform_manager.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/transform_manager.ts rename to x-pack/solutions/observability/plugins/slo/server/services/transform_manager.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/__snapshots__/remote_summary_doc_to_slo.test.ts.snap b/x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/__snapshots__/remote_summary_doc_to_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/__snapshots__/remote_summary_doc_to_slo.test.ts.snap rename to x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/__snapshots__/remote_summary_doc_to_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/unsafe_federated/remote_summary_doc_to_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/update_slo.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/update_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/update_slo.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/update_slo.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/update_slo.ts b/x-pack/solutions/observability/plugins/slo/server/services/update_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/update_slo.ts rename to x-pack/solutions/observability/plugins/slo/server/services/update_slo.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/utils/assert_expected_indicator_source_index_privileges.ts b/x-pack/solutions/observability/plugins/slo/server/services/utils/assert_expected_indicator_source_index_privileges.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/utils/assert_expected_indicator_source_index_privileges.ts rename to x-pack/solutions/observability/plugins/slo/server/services/utils/assert_expected_indicator_source_index_privileges.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/utils/compute_total_slices_from_date_range.ts b/x-pack/solutions/observability/plugins/slo/server/services/utils/compute_total_slices_from_date_range.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/utils/compute_total_slices_from_date_range.ts rename to x-pack/solutions/observability/plugins/slo/server/services/utils/compute_total_slices_from_date_range.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/utils/get_transform_compite_query.ts b/x-pack/solutions/observability/plugins/slo/server/services/utils/get_transform_compite_query.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/utils/get_transform_compite_query.ts rename to x-pack/solutions/observability/plugins/slo/server/services/utils/get_transform_compite_query.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/utils/index.test.ts b/x-pack/solutions/observability/plugins/slo/server/services/utils/index.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/utils/index.test.ts rename to x-pack/solutions/observability/plugins/slo/server/services/utils/index.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/services/utils/index.ts b/x-pack/solutions/observability/plugins/slo/server/services/utils/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/services/utils/index.ts rename to x-pack/solutions/observability/plugins/slo/server/services/utils/index.ts diff --git a/x-pack/plugins/observability_solution/slo/server/types.ts b/x-pack/solutions/observability/plugins/slo/server/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/types.ts rename to x-pack/solutions/observability/plugins/slo/server/types.ts diff --git a/x-pack/plugins/observability_solution/slo/server/utils/number.ts b/x-pack/solutions/observability/plugins/slo/server/utils/number.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/utils/number.ts rename to x-pack/solutions/observability/plugins/slo/server/utils/number.ts diff --git a/x-pack/plugins/observability_solution/slo/server/utils/queries.test.ts b/x-pack/solutions/observability/plugins/slo/server/utils/queries.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/utils/queries.test.ts rename to x-pack/solutions/observability/plugins/slo/server/utils/queries.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/utils/queries.ts b/x-pack/solutions/observability/plugins/slo/server/utils/queries.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/utils/queries.ts rename to x-pack/solutions/observability/plugins/slo/server/utils/queries.ts diff --git a/x-pack/plugins/observability_solution/slo/server/utils/retry.test.ts b/x-pack/solutions/observability/plugins/slo/server/utils/retry.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/utils/retry.test.ts rename to x-pack/solutions/observability/plugins/slo/server/utils/retry.test.ts diff --git a/x-pack/plugins/observability_solution/slo/server/utils/retry.ts b/x-pack/solutions/observability/plugins/slo/server/utils/retry.ts similarity index 100% rename from x-pack/plugins/observability_solution/slo/server/utils/retry.ts rename to x-pack/solutions/observability/plugins/slo/server/utils/retry.ts diff --git a/x-pack/plugins/observability_solution/slo/tsconfig.json b/x-pack/solutions/observability/plugins/slo/tsconfig.json similarity index 97% rename from x-pack/plugins/observability_solution/slo/tsconfig.json rename to x-pack/solutions/observability/plugins/slo/tsconfig.json index 125a8463be595..e6cd1c2d890fc 100644 --- a/x-pack/plugins/observability_solution/slo/tsconfig.json +++ b/x-pack/solutions/observability/plugins/slo/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types" }, @@ -7,7 +7,7 @@ "common/**/*", "public/**/*", "server/**/*", - "../../../typings/**/*", + "../../../../typings/**/*", // Emotion theme typing "./emotion.d.ts" ], diff --git a/x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts b/x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts index 92330b4960e76..03e9e1d225ae1 100644 --- a/x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts +++ b/x-pack/solutions/security/plugins/elastic_assistant/server/lib/telemetry/event_based_telemetry.ts @@ -77,13 +77,16 @@ export const INVOKE_ASSISTANT_SUCCESS_EVENT: EventTypeOpts<{ actionTypeId: string; isEnabledKnowledgeBase: boolean; durationMs: number; - ['toolsInvoked.AlertCountsTool']?: number; - ['toolsInvoked.NaturalLanguageESQLTool']?: number; - ['toolsInvoked.KnowledgeBaseRetrievalTool']?: number; - ['toolsInvoked.KnowledgeBaseWriteTool']?: number; - ['toolsInvoked.OpenAndAcknowledgedAlertsTool']?: number; - ['toolsInvoked.SecurityLabsKnowledgeBaseTool']?: number; - ['toolsInvoked.CustomTool']?: number; + toolsInvoked: { + AlertCountsTool?: number; + NaturalLanguageESQLTool?: number; + KnowledgeBaseRetrievalTool?: number; + KnowledgeBaseWriteTool?: number; + OpenAndAcknowledgedAlertsTool?: number; + SecurityLabsKnowledgeBaseTool?: number; + ProductDocumentationTool?: number; + CustomTool?: number; + }; model?: string; isOssModel?: boolean; }> = { @@ -127,53 +130,64 @@ export const INVOKE_ASSISTANT_SUCCESS_EVENT: EventTypeOpts<{ description: 'The duration of the request.', }, }, - 'toolsInvoked.AlertCountsTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.NaturalLanguageESQLTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.KnowledgeBaseRetrievalTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.KnowledgeBaseWriteTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.OpenAndAcknowledgedAlertsTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.SecurityLabsKnowledgeBaseTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, - }, - }, - 'toolsInvoked.CustomTool': { - type: 'long', - _meta: { - description: 'Number of times tool was invoked.', - optional: true, + toolsInvoked: { + properties: { + AlertCountsTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + NaturalLanguageESQLTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + ProductDocumentationTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + KnowledgeBaseRetrievalTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + KnowledgeBaseWriteTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + OpenAndAcknowledgedAlertsTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + SecurityLabsKnowledgeBaseTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, + CustomTool: { + type: 'long', + _meta: { + description: 'Number of times tool was invoked.', + optional: true, + }, + }, }, }, }, diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all.ts index 39da3ab33a6ea..b354f0f962d84 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; -import { RULE_SAVED_OBJECT_TYPE } from '@kbn/alerting-plugin/server'; import { UserAtSpaceScenarios } from '../../../scenarios'; import { getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; @@ -199,7 +198,7 @@ export default function getAllConnectorTests({ getService }: FtrProviderContext) }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, RULE_SAVED_OBJECT_TYPE, 'alerts'); + objectRemover.add(space.id, createdAlert.id, 'rule', 'alerting'); const response = await supertestWithoutAuth .get(`${getUrlPrefix(space.id)}/api/actions/connectors`) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all_system.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all_system.ts index e19ade26171b1..860ab6daf3eca 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all_system.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/get_all_system.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; -import { RULE_SAVED_OBJECT_TYPE } from '@kbn/alerting-plugin/server'; import { SuperuserAtSpace1, UserAtSpaceScenarios } from '../../../scenarios'; import { getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; @@ -244,7 +243,7 @@ export default function getAllConnectorTests({ getService }: FtrProviderContext) }) ) .expect(200); - objectRemover.add(space.id, createdAlert.id, RULE_SAVED_OBJECT_TYPE, 'alerts'); + objectRemover.add(space.id, createdAlert.id, 'rule', 'alerting'); const response = await supertestWithoutAuth .get(`${getUrlPrefix(space.id)}/internal/actions/connectors`) diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/connector_types/stack/preconfigured_alert_history_connector.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/connector_types/stack/preconfigured_alert_history_connector.ts index 22f81d7bb7e96..2e98d9129b553 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/connector_types/stack/preconfigured_alert_history_connector.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/connector_types/stack/preconfigured_alert_history_connector.ts @@ -137,10 +137,10 @@ export default function preconfiguredAlertHistoryConnectorTests({ expect().fail(`waiting for alert ${id} statuses ${Array.from(statuses)} timed out`); } - const response = await supertest.get(`/api/alerts/alert/${id}`); + const response = await supertest.get(`/api/alerting/rule/${id}`); expect(response.status).to.eql(200); - const { executionStatus } = response.body || {}; + const { execution_status: executionStatus } = response.body || {}; const { status } = executionStatus || {}; const message = `waitForStatus(${Array.from(statuses)}): got ${JSON.stringify( diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/create.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/create.ts index 5a6385a3895d2..ecef6541f7181 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/create.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/create.ts @@ -720,104 +720,5 @@ export default function createAlertTests({ getService }: FtrProviderContext) { }); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle create alert request appropriately', async () => { - const { body: createdAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/connector`) - .set('kbn-xsrf', 'foo') - .send({ - name: 'MY action', - connector_type_id: 'test.noop', - config: {}, - secrets: {}, - }) - .expect(200); - - const { - rule_type_id: alertTypeId, - notify_when: notifyWhen, - ...testAlert - } = getTestRuleData({ - actions: [ - { - id: createdAction.id, - group: 'default', - params: {}, - }, - ], - }); - const response = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert`) - .set('kbn-xsrf', 'foo') - .send({ - ...testAlert, - alertTypeId, - notifyWhen, - }); - - expect(response.status).to.eql(200); - objectRemover.add(Spaces.space1.id, response.body.id, 'rule', 'alerting'); - expect(response.body).to.eql({ - id: response.body.id, - name: 'abc', - tags: ['foo'], - actions: [ - { - id: createdAction.id, - actionTypeId: createdAction.connector_type_id, - group: 'default', - params: {}, - uuid: response.body.actions[0].uuid, - }, - ], - enabled: true, - alertTypeId: 'test.noop', - consumer: 'alertsFixture', - params: {}, - createdBy: null, - schedule: { interval: '1m' }, - scheduledTaskId: response.body.scheduledTaskId, - updatedBy: null, - apiKeyOwner: null, - apiKeyCreatedByUser: null, - throttle: '1m', - notifyWhen: 'onThrottleInterval', - muteAll: false, - mutedInstanceIds: [], - createdAt: response.body.createdAt, - updatedAt: response.body.updatedAt, - executionStatus: response.body.executionStatus, - revision: 0, - running: false, - ...(response.body.next_run ? { next_run: response.body.next_run } : {}), - ...(response.body.last_run ? { last_run: response.body.last_run } : {}), - }); - expect(Date.parse(response.body.createdAt)).to.be.greaterThan(0); - expect(Date.parse(response.body.updatedAt)).to.be.greaterThan(0); - expect(Date.parse(response.body.updatedAt)).to.eql(Date.parse(response.body.createdAt)); - if (response.body.next_run) { - expect(Date.parse(response.body.next_run)).to.be.greaterThan(0); - } - expect(typeof response.body.scheduledTaskId).to.be('string'); - const taskRecord = await getScheduledTask(response.body.scheduledTaskId); - expect(taskRecord.type).to.eql('task'); - expect(taskRecord.task.taskType).to.eql('alerting:test.noop'); - expect(JSON.parse(taskRecord.task.params)).to.eql({ - alertId: response.body.id, - spaceId: Spaces.space1.id, - consumer: 'alertsFixture', - }); - expect(taskRecord.task.enabled).to.eql(true); - // Ensure AAD isn't broken - await checkAAD({ - supertest, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: response.body.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/delete.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/delete.ts index 811fbbf2b1732..37f482a5d512e 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/delete.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/delete.ts @@ -65,27 +65,5 @@ export default function createDeleteTests({ getService }: FtrProviderContext) { message: `Saved object [alert/${createdAlert.id}] not found`, }); }); - - describe('legacy', () => { - it('should handle delete alert request appropriately', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - - await supertest - .delete(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(204, ''); - - try { - await getScheduledTask(createdAlert.scheduledTaskId); - throw new Error('Should have removed scheduled task'); - } catch (e) { - expect(e.meta.statusCode).to.eql(404); - } - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/disable.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/disable.ts index 01fa746b65f2a..846c4a719522f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/disable.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/disable.ts @@ -266,50 +266,5 @@ export default function createDisableRuleTests({ getService }: FtrProviderContex id: createdRule.id, }); }); - - describe('legacy', function () { - it('should handle disable rule request appropriately', async () => { - const { body: createdRule } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: true })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdRule.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdRule.id}/_disable`) - .set('kbn-xsrf', 'foo') - .expect(204); - - // task doc should still exist but be disabled - await retry.try(async () => { - const taskRecord = await getScheduledTask(createdRule.scheduled_task_id); - expect(taskRecord.type).to.eql('task'); - expect(taskRecord.task.taskType).to.eql('alerting:test.noop'); - expect(JSON.parse(taskRecord.task.params)).to.eql({ - alertId: createdRule.id, - spaceId: Spaces.space1.id, - consumer: 'alertsFixture', - }); - expect(taskRecord.task.enabled).to.eql(false); - }); - - const { body: disabledRule } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdRule.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - - // Ensure revision was not updated - expect(disabledRule.revision).to.eql(0); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdRule.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/enable.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/enable.ts index 74b8fd0307a86..8eae2dfe7022b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/enable.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/enable.ts @@ -94,48 +94,5 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex }); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle enable alert request appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: false })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_enable`) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(typeof updatedAlert.scheduled_task_id).to.eql('string'); - const taskRecord = await getScheduledTask(updatedAlert.scheduled_task_id); - expect(taskRecord.type).to.eql('task'); - expect(taskRecord.task.taskType).to.eql('alerting:test.noop'); - expect(JSON.parse(taskRecord.task.params)).to.eql({ - alertId: createdAlert.id, - spaceId: Spaces.space1.id, - consumer: 'alertsFixture', - }); - expect(taskRecord.task.enabled).to.eql(true); - - // Ensure revision was not updated - expect(updatedAlert.revision).to.eql(0); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find.ts index f6b48df9b9f17..c902355b68fcc 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find.ts @@ -336,58 +336,5 @@ export default function createFindTests({ getService }: FtrProviderContext) { }); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle find alert request appropriately', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - const response = await supertest.get( - `${getUrlPrefix( - Spaces.space1.id - )}/api/alerts/_find?search=test.noop&search_fields=alertTypeId` - ); - - expect(response.status).to.eql(200); - expect(response.body.page).to.equal(1); - expect(response.body.perPage).to.be.greaterThan(0); - expect(response.body.total).to.be.greaterThan(0); - const match = response.body.data.find((obj: any) => obj.id === createdAlert.id); - expect(match).to.eql({ - id: createdAlert.id, - name: 'abc', - tags: ['foo'], - alertTypeId: 'test.noop', - consumer: 'alertsFixture', - schedule: { interval: '1m' }, - enabled: true, - actions: [], - params: {}, - createdBy: null, - apiKeyOwner: null, - apiKeyCreatedByUser: null, - scheduledTaskId: match.scheduledTaskId, - updatedBy: null, - throttle: '1m', - notifyWhen: 'onThrottleInterval', - muteAll: false, - mutedInstanceIds: [], - createdAt: match.createdAt, - updatedAt: match.updatedAt, - executionStatus: match.executionStatus, - revision: 0, - running: false, - ...(match.nextRun ? { nextRun: match.nextRun } : {}), - ...(match.lastRun ? { lastRun: match.lastRun } : {}), - }); - expect(Date.parse(match.createdAt)).to.be.greaterThan(0); - expect(Date.parse(match.updatedAt)).to.be.greaterThan(0); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find_internal.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find_internal.ts index 7c10b9be598bb..e8dc9ac696842 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find_internal.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/find_internal.ts @@ -337,54 +337,5 @@ export default function createFindTests({ getService }: FtrProviderContext) { expect(response.body.total).to.equal(1); expect(response.body.data[0].consumer).to.eql('alertsRestrictedFixture'); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle find alert request appropriately', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - const response = await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/_find`); - - expect(response.status).to.eql(200); - expect(response.body.page).to.equal(1); - expect(response.body.perPage).to.be.greaterThan(0); - expect(response.body.total).to.be.greaterThan(0); - const match = response.body.data.find((obj: any) => obj.id === createdAlert.id); - expect(match).to.eql({ - id: createdAlert.id, - name: 'abc', - tags: ['foo'], - alertTypeId: 'test.noop', - consumer: 'alertsFixture', - schedule: { interval: '1m' }, - enabled: true, - actions: [], - params: {}, - createdBy: null, - apiKeyOwner: null, - apiKeyCreatedByUser: null, - scheduledTaskId: match.scheduledTaskId, - updatedBy: null, - throttle: '1m', - notifyWhen: 'onThrottleInterval', - muteAll: false, - mutedInstanceIds: [], - createdAt: match.createdAt, - updatedAt: match.updatedAt, - executionStatus: match.executionStatus, - revision: 0, - running: false, - ...(match.nextRun ? { nextRun: match.nextRun } : {}), - ...(match.lastRun ? { lastRun: match.lastRun } : {}), - }); - expect(Date.parse(match.createdAt)).to.be.greaterThan(0); - expect(Date.parse(match.updatedAt)).to.be.greaterThan(0); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get.ts index e559b1d17f196..58fdbf377ecf1 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get.ts @@ -124,55 +124,5 @@ export default function createGetTests({ getService }: FtrProviderContext) { getTestUtils('public', objectRemover, supertest); getTestUtils('internal', objectRemover, supertest); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle get alert request appropriately', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - const response = await supertest.get( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}` - ); - - expect(response.status).to.eql(200); - expect(response.body).to.eql({ - id: createdAlert.id, - name: 'abc', - tags: ['foo'], - alertTypeId: 'test.noop', - consumer: 'alertsFixture', - schedule: { interval: '1m' }, - enabled: true, - actions: [], - params: {}, - createdBy: null, - scheduledTaskId: response.body.scheduledTaskId, - updatedBy: null, - apiKeyOwner: null, - apiKeyCreatedByUser: null, - throttle: '1m', - notifyWhen: 'onThrottleInterval', - muteAll: false, - mutedInstanceIds: [], - createdAt: response.body.createdAt, - updatedAt: response.body.updatedAt, - executionStatus: response.body.executionStatus, - revision: 0, - running: false, - ...(response.body.nextRun ? { nextRun: response.body.nextRun } : {}), - ...(response.body.lastRun ? { lastRun: response.body.lastRun } : {}), - }); - expect(Date.parse(response.body.createdAt)).to.be.greaterThan(0); - expect(Date.parse(response.body.updatedAt)).to.be.greaterThan(0); - if (response.body.nextRun) { - expect(Date.parse(response.body.nextRun)).to.be.greaterThan(0); - } - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_state.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_state.ts index 6082e6ff69eb8..87a8449fb37e1 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_state.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_state.ts @@ -91,53 +91,5 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont message: 'Saved object [alert/1] not found', }); }); - - describe('legacy', () => { - it('should fetch updated state', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send({ - enabled: true, - name: 'abc', - tags: ['foo'], - rule_type_id: 'test.cumulative-firing', - consumer: 'alertsFixture', - schedule: { interval: '5s' }, - throttle: '5s', - actions: [], - params: {}, - notify_when: 'onThrottleInterval', - }) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - // wait for alert to actually execute - await retry.try(async () => { - const response = await supertest.get( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/state` - ); - - expect(response.status).to.eql(200); - expect(response.body).to.key('alertInstances', 'alertTypeState', 'previousStartedAt'); - expect(response.body.alertTypeState.runCount).to.greaterThan(1); - }); - - const response = await supertest.get( - `${getUrlPrefix(Spaces.space1.id)}/internal/alerting/rule/${createdAlert.id}/state` - ); - - expect(response.body.rule_type_state.runCount).to.greaterThan(0); - - const alertInstances = Object.entries>(response.body.alerts); - expect(alertInstances.length).to.eql(response.body.rule_type_state.runCount); - alertInstances.forEach(([key, value], index) => { - expect(key).to.eql(`instance-${index}`); - expect(value.state.instanceStateValue).to.be(true); - expect(value.state.start).not.to.be(undefined); - expect(value.state.duration).not.to.be(undefined); - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_summary.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_summary.ts index 86444543bde73..cee5e44afcc8d 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_summary.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/get_alert_summary.ts @@ -384,78 +384,6 @@ export default function createGetAlertSummaryTests({ getService }: FtrProviderCo expect(actualAlerts).to.eql(expectedAlerts); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('handles multi-alert status', async () => { - // wait so cache expires - await setTimeoutAsync(TEST_CACHE_EXPIRATION_TIME); - - // pattern of when the alert should fire - const pattern = { - alertA: [true, true, true, true], - alertB: [true, true, false, false], - alertC: [true, true, true, true], - }; - - const { body: createdRule } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send( - getTestRuleData({ - rule_type_id: 'test.patternFiring', - params: { pattern }, - schedule: { interval: '1s' }, - }) - ) - .expect(200); - objectRemover.add(Spaces.space1.id, createdRule.id, 'rule', 'alerting'); - - await alertUtils.muteInstance(createdRule.id, 'alertC'); - await alertUtils.muteInstance(createdRule.id, 'alertD'); - await waitForEvents(createdRule.id, ['new-instance', 'recovered-instance']); - const response = await supertest.get( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdRule.id}/_instance_summary` - ); - - const actualAlerts = checkAndCleanActualAlerts(response.body.instances, [ - 'alertA', - 'alertB', - 'alertC', - ]); - const expectedAlerts = { - alertA: { - status: 'Active', - muted: false, - actionGroupId: 'default', - activeStartDate: actualAlerts.alertA.activeStartDate, - flapping: false, - tracked: true, - }, - alertB: { - status: 'OK', - muted: false, - flapping: false, - tracked: true, - }, - alertC: { - status: 'Active', - muted: true, - actionGroupId: 'default', - activeStartDate: actualAlerts.alertC.activeStartDate, - flapping: false, - tracked: true, - }, - alertD: { - status: 'OK', - muted: true, - flapping: false, - tracked: true, - }, - }; - expect(actualAlerts).to.eql(expectedAlerts); - }); - }); }); async function waitForEvents(id: string, actions: string[]) { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/rule_types.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/rule_types.ts index e722d058e8b7c..9a0ad8133c02c 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/rule_types.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group1/rule_types.ts @@ -103,46 +103,5 @@ export default function listRuleTypes({ getService }: FtrProviderContext) { params: [], }); }); - - describe('legacy', () => { - it('should return 200 with list of alert types', async () => { - const response = await supertest.get( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/list_alert_types` - ); - expect(response.status).to.eql(200); - const { authorizedConsumers, ...fixtureAlertType } = response.body.find( - (alertType: any) => alertType.id === 'test.noop' - ); - expect(fixtureAlertType).to.eql({ - actionGroups: [ - { id: 'default', name: 'Default' }, - { id: 'recovered', name: 'Recovered' }, - ], - defaultActionGroupId: 'default', - doesSetRecoveryContext: false, - id: 'test.noop', - name: 'Test: Noop', - actionVariables: { - state: [], - params: [], - context: [], - }, - recoveryActionGroup: { - id: 'recovered', - name: 'Recovered', - }, - category: 'kibana', - producer: 'alertsFixture', - minimumLicenseRequired: 'basic', - isExportable: true, - enabledInLicense: true, - hasFieldsForAAD: false, - hasAlertsMappings: false, - ruleTaskTimeout: '5m', - validLegacyConsumers: ['alerts'], - }); - expect(Object.keys(authorizedConsumers)).to.contain('alertsFixture'); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_all.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_all.ts index e4cbec75460b0..09a12a1371454 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_all.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_all.ts @@ -51,35 +51,5 @@ export default function createMuteTests({ getService }: FtrProviderContext) { id: createdAlert.id, }); }); - - describe('legacy', () => { - it('should handle mute alert request appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: false })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_mute_all`) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(updatedAlert.mute_all).to.eql(true); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_instance.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_instance.ts index ac580ad335c51..65791c86e833b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_instance.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/mute_instance.ts @@ -52,39 +52,5 @@ export default function createMuteInstanceTests({ getService }: FtrProviderConte id: createdAlert.id, }); }); - - describe('legacy', () => { - it('should handle mute alert instance request appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: false })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${ - createdAlert.id - }/alert_instance/1/_mute` - ) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(updatedAlert.muted_alert_ids).to.eql(['1']); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_all.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_all.ts index 363086e1549fe..42bca18c07bfc 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_all.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_all.ts @@ -53,39 +53,5 @@ export default function createUnmuteTests({ getService }: FtrProviderContext) { id: createdAlert.id, }); }); - - describe('legacy', () => { - it('should handle unmute alert request appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: false })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_mute_all`) - .set('kbn-xsrf', 'foo') - .expect(204); - await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_unmute_all`) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(updatedAlert.mute_all).to.eql(false); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_instance.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_instance.ts index 5655e52aa4d09..4b54c6c0c134f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_instance.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/unmute_instance.ts @@ -53,47 +53,5 @@ export default function createUnmuteInstanceTests({ getService }: FtrProviderCon id: createdAlert.id, }); }); - - describe('legacy', () => { - it('should handle unmute alert instance request appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData({ enabled: false })) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${ - createdAlert.id - }/alert_instance/1/_mute` - ) - .set('kbn-xsrf', 'foo') - .expect(204); - await supertestWithoutAuth - .post( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${ - createdAlert.id - }/alert_instance/1/_unmute` - ) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(updatedAlert.muted_alert_ids).to.eql([]); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update.ts index 025fa3b693dce..24fdf571f070d 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update.ts @@ -408,75 +408,5 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { .expect(400); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle update alert request appropriately', async () => { - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - const updatedData = { - name: 'bcd', - tags: ['bar'], - params: { - foo: true, - }, - schedule: { interval: '12s' }, - actions: [], - throttle: '1m', - notifyWhen: 'onThrottleInterval', - }; - - const response = await supertest - .put(`${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .send(updatedData) - .expect(200); - - expect(response.body).to.eql({ - ...updatedData, - id: createdAlert.id, - tags: ['bar'], - alertTypeId: 'test.noop', - consumer: 'alertsFixture', - createdBy: null, - enabled: true, - updatedBy: null, - apiKeyOwner: null, - apiKeyCreatedByUser: null, - muteAll: false, - mutedInstanceIds: [], - notifyWhen: 'onThrottleInterval', - scheduledTaskId: createdAlert.scheduled_task_id, - createdAt: response.body.createdAt, - updatedAt: response.body.updatedAt, - executionStatus: response.body.executionStatus, - revision: 1, - running: false, - ...(response.body.nextRun ? { nextRun: response.body.nextRun } : {}), - ...(response.body.lastRun ? { lastRun: response.body.lastRun } : {}), - }); - expect(Date.parse(response.body.createdAt)).to.be.greaterThan(0); - expect(Date.parse(response.body.updatedAt)).to.be.greaterThan(0); - expect(Date.parse(response.body.updatedAt)).to.be.greaterThan( - Date.parse(response.body.createdAt) - ); - if (response.body.nextRun) { - expect(Date.parse(response.body.nextRun)).to.be.greaterThan(0); - } - - // Ensure AAD isn't broken - await checkAAD({ - supertest, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update_api_key.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update_api_key.ts index 0aa9ec3354acd..e588d0e606543 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update_api_key.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/group2/update_api_key.ts @@ -79,41 +79,5 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte }); }); }); - - describe('legacy', function () { - this.tags('skipFIPS'); - it('should handle update alert api key appropriately', async () => { - const { body: createdAlert } = await supertestWithoutAuth - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send(getTestRuleData()) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - await supertestWithoutAuth - .post( - `${getUrlPrefix(Spaces.space1.id)}/api/alerts/alert/${createdAlert.id}/_update_api_key` - ) - .set('kbn-xsrf', 'foo') - .expect(204); - - const { body: updatedAlert } = await supertestWithoutAuth - .get(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule/${createdAlert.id}`) - .set('kbn-xsrf', 'foo') - .expect(200); - expect(updatedAlert.api_key_owner).to.eql(null); - - // Ensure revision is not incremented when API key is updated - expect(updatedAlert.revision).to.eql(0); - - // Ensure AAD isn't broken - await checkAAD({ - supertest: supertestWithoutAuth, - spaceId: Spaces.space1.id, - type: RULE_SAVED_OBJECT_TYPE, - id: createdAlert.id, - }); - }); - }); }); } diff --git a/x-pack/test/api_integration/apis/entity_manager/count.ts b/x-pack/test/api_integration/apis/entity_manager/count.ts index 46c60e4bd2bdc..710457651d732 100644 --- a/x-pack/test/api_integration/apis/entity_manager/count.ts +++ b/x-pack/test/api_integration/apis/entity_manager/count.ts @@ -452,10 +452,10 @@ export default function ({ getService }: FtrProviderContext) { types: { chumble: 0, }, - errors: [ + errors: expect.arrayContaining([ 'No index found for source [source: source1-with-chumbles, type: chumble] with index patterns [index-1-with-chumbles]', 'No index found for source [source: source2-with-chumbles, type: chumble] with index patterns [index-2-with-chumbles]', - ], + ]), }); }); }); diff --git a/x-pack/test/functional/config.base.js b/x-pack/test/functional/config.base.js index eb13de1c0c9e8..b3d2ddc1e2f78 100644 --- a/x-pack/test/functional/config.base.js +++ b/x-pack/test/functional/config.base.js @@ -401,7 +401,14 @@ export default async function ({ readConfigFile }) { indices: [ { names: ['*'], - privileges: ['create', 'read', 'view_index_metadata', 'monitor', 'create_index'], + privileges: [ + 'create', + 'read', + 'view_index_metadata', + 'monitor', + 'create_index', + 'manage', + ], }, ], }, diff --git a/x-pack/test/functional/services/monitoring/alerts.js b/x-pack/test/functional/services/monitoring/alerts.js index c480cc0c45c03..5e5d880da102c 100644 --- a/x-pack/test/functional/services/monitoring/alerts.js +++ b/x-pack/test/functional/services/monitoring/alerts.js @@ -10,12 +10,12 @@ export function MonitoringAlertsProvider({ getService }) { return new (class MonitoringAlerts { async deleteAlerts() { - const apiResponse = await supertest.get('/api/alerts/_find?per_page=20'); + const apiResponse = await supertest.get('/api/alerting/rules/_find?per_page=20'); const alerts = apiResponse.body.data.filter(({ consumer }) => consumer === 'monitoring'); return await Promise.all( alerts.map(async (alert) => - supertest.delete(`/api/alerts/alert/${alert.id}`).set('kbn-xsrf', 'true').expect(204) + supertest.delete(`/api/alerting/rule/${alert.id}`).set('kbn-xsrf', 'true').expect(204) ) ); } diff --git a/x-pack/test/functional_search/tests/classic_navigation.ts b/x-pack/test/functional_search/tests/classic_navigation.ts index a290f7523f49c..118fb4b7b2a4f 100644 --- a/x-pack/test/functional_search/tests/classic_navigation.ts +++ b/x-pack/test/functional_search/tests/classic_navigation.ts @@ -26,7 +26,10 @@ export default function searchSolutionNavigation({ }); // Create a space with the search solution and navigate to its home page - ({ cleanUp, space: spaceCreated } = await spaces.create({ solution: 'classic' })); + ({ cleanUp, space: spaceCreated } = await spaces.create({ + name: 'search-classic-ftr', + solution: 'classic', + })); await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); await common.navigateToApp('enterpriseSearch'); }); diff --git a/x-pack/test/functional_search/tests/solution_navigation.ts b/x-pack/test/functional_search/tests/solution_navigation.ts index 03a4614017ba2..5517a9513ea48 100644 --- a/x-pack/test/functional_search/tests/solution_navigation.ts +++ b/x-pack/test/functional_search/tests/solution_navigation.ts @@ -14,10 +14,8 @@ export default function searchSolutionNavigation({ const { common, solutionNavigation } = getPageObjects(['common', 'solutionNavigation']); const spaces = getService('spaces'); const browser = getService('browser'); - const kibanaServer = getService('kibanaServer'); - // FLAKY: https://github.com/elastic/kibana/issues/201037 - describe.skip('Search Solution Navigation', () => { + describe('Search Solution Navigation', () => { let cleanUp: () => Promise; let spaceCreated: { id: string } = { id: '' }; @@ -28,20 +26,14 @@ export default function searchSolutionNavigation({ }); // Create a space with the search solution and navigate to its home page - ({ cleanUp, space: spaceCreated } = await spaces.create({ solution: 'es' })); + ({ cleanUp, space: spaceCreated } = await spaces.create({ + name: 'search-ftr', + solution: 'es', + })); await browser.navigateTo(spaces.getRootUrl(spaceCreated.id)); - - // canvas application is only available when installation contains canvas workpads - await kibanaServer.importExport.load( - 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default' - ); }); after(async () => { - await kibanaServer.importExport.unload( - 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default' - ); - // Clean up space created await cleanUp(); }); @@ -59,8 +51,6 @@ export default function searchSolutionNavigation({ await solutionNavigation.sidenav.expectLinkExists({ text: 'Search applications' }); await solutionNavigation.sidenav.expectLinkExists({ text: 'Behavioral Analytics' }); await solutionNavigation.sidenav.expectLinkExists({ text: 'Inference Endpoints' }); - await solutionNavigation.sidenav.expectLinkExists({ text: 'App Search' }); - await solutionNavigation.sidenav.expectLinkExists({ text: 'Workplace Search' }); await solutionNavigation.sidenav.expectLinkExists({ text: 'Other tools' }); }); @@ -210,38 +200,9 @@ export default function searchSolutionNavigation({ deepLinkId: 'searchInferenceEndpoints:inferenceEndpoints', }); - // check Enterprise Search - // > App Search - await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'appSearch:engines', - }); - await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'appSearch:engines', - }); - // ent-search node not running for FTRs, so we see setup guide without breadcrumbs - // await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - // text: 'App Search', - // }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'appSearch:engines', - }); - // > Workplace Search - await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'workplaceSearch', - }); - await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'workplaceSearch', - }); - // ent-search node not running for FTRs, so we see setup guide without breadcrumbs - // await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - // text: 'Workplace Search', - // }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'workplaceSearch', - }); - // Other tools await solutionNavigation.sidenav.openSection('search_project_nav.otherTools'); + await solutionNavigation.sidenav.expectSectionOpen('search_project_nav.otherTools'); // > Maps await solutionNavigation.sidenav.clickLink({ deepLinkId: 'maps', @@ -256,20 +217,6 @@ export default function searchSolutionNavigation({ await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ deepLinkId: 'maps', }); - // > Canvas - await solutionNavigation.sidenav.clickLink({ - deepLinkId: 'canvas', - }); - await solutionNavigation.sidenav.expectLinkActive({ - deepLinkId: 'canvas', - }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ text: 'Other tools' }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - text: 'Canvas', - }); - await solutionNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'canvas', - }); // > Graph await solutionNavigation.sidenav.clickLink({ deepLinkId: 'graph', @@ -292,6 +239,9 @@ export default function searchSolutionNavigation({ it('renders only expected items', async () => { await solutionNavigation.sidenav.openSection('search_project_nav.otherTools'); await solutionNavigation.sidenav.openSection('project_settings_project_nav'); + await solutionNavigation.sidenav.expectSectionOpen('search_project_nav.otherTools'); + await solutionNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); + await solutionNavigation.sidenav.expectOnlyDefinedLinks([ 'search_project_nav', 'enterpriseSearch', @@ -309,12 +259,8 @@ export default function searchSolutionNavigation({ 'enterpriseSearchAnalytics', 'relevance', 'searchInferenceEndpoints:inferenceEndpoints', - 'entsearch', - 'appSearch:engines', - 'workplaceSearch', 'otherTools', 'maps', - 'canvas', 'graph', 'project_settings_project_nav', 'ml:modelManagement', diff --git a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/alert_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/alert_flyout.ts index 25f77cb8d41ef..8126a3e42d815 100644 --- a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/alert_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/alert_flyout.ts @@ -98,7 +98,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await retry.tryForTime(60 * 1000, async () => { // add a delay before next call to not overload the server await setTimeoutAsync(1500); - const apiResponse = await supertest.get('/api/alerts/_find?search=uptime-test'); + const apiResponse = await supertest.get('/api/alerting/rules/_find?search=uptime-test'); const alertsFromThisTest = apiResponse.body.data.filter( ({ name }: { name: string }) => name === 'uptime-test' ); @@ -111,7 +111,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // for our test helper to input into the flyout. const { actions, - alertTypeId, + rule_type_id: alertTypeId, consumer, id, params: { numTimes, timerangeUnit, timerangeCount, filters }, @@ -134,7 +134,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { `{"tags":[],"url.port":["5678"],"observer.geo.name":["mpls"],"monitor.type":["http"]}` ); } finally { - await supertest.delete(`/api/alerts/alert/${id}`).set('kbn-xsrf', 'true').expect(204); + await supertest.delete(`/api/alerting/rule/${id}`).set('kbn-xsrf', 'true').expect(204); } }); }); @@ -178,7 +178,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('has created a valid alert with expected parameters', async () => { let alert: any; await retry.tryForTime(60 * 1000, async () => { - const apiResponse = await supertest.get(`/api/alerts/_find?search=${alertId}`); + const apiResponse = await supertest.get(`/api/alerting/rules/_find?search=${alertId}`); const alertsFromThisTest = apiResponse.body.data.filter( ({ name }: { name: string }) => name === alertId ); @@ -191,7 +191,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // for our test helper to input into the flyout. const { actions, - alertTypeId, + rule_type_id: alertTypeId, consumer, id, params, @@ -206,7 +206,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(params).to.eql({}); expect(interval).to.eql('11m'); } finally { - await supertest.delete(`/api/alerts/alert/${id}`).set('kbn-xsrf', 'true').expect(204); + await supertest.delete(`/api/alerting/rule/${id}`).set('kbn-xsrf', 'true').expect(204); } }); }); diff --git a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts index e5efd66060e31..d1c4c2c7742fd 100644 --- a/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts +++ b/x-pack/test/functional_with_es_ssl/apps/discover_ml_uptime/uptime/simple_down_alert.ts @@ -83,7 +83,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('has created a valid simple alert with expected parameters', async () => { let alert: any; await retry.tryForTime(15000, async () => { - const apiResponse = await supertest.get(`/api/alerts/_find?search=Simple status alert`); + const apiResponse = await supertest.get( + `/api/alerting/rules/_find?search=Simple status alert` + ); const alertsFromThisTest = apiResponse.body.data.filter(({ params }: { params: any }) => params.search.includes(monitorId) ); @@ -91,10 +93,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { alert = alertsFromThisTest[0]; }); - const { actions, alertTypeId, consumer, tags } = alert ?? {}; + const { actions, rule_type_id: alertTypeId, consumer, tags } = alert ?? {}; expect(actions).to.eql([ { - actionTypeId: '.slack', + connector_type_id: '.slack', group: 'recovered', params: { message: MonitorStatusTranslations.defaultRecoveryMessage, @@ -103,7 +105,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { uuid: actions[0].uuid, }, { - actionTypeId: '.slack', + connector_type_id: '.slack', group: 'xpack.uptime.alerts.actionGroups.monitorStatus', params: { message: MonitorStatusTranslations.defaultActionMessage, diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/general.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/general.ts index 25e6e169ec4a4..1e0123f7e9741 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/general.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/general.ts @@ -321,7 +321,7 @@ export default ({ getPageObjects, getPageObject, getService }: FtrProviderContex }, supertest ); - objectRemover.add(rule.id, 'alert', 'alerts'); + objectRemover.add(rule.id, 'rule', 'alerting'); // refresh to see rule await browser.refresh(); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/slack.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/slack.ts index a7ea6aef95c8a..6e89bcf411121 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/slack.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/slack.ts @@ -115,7 +115,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const getRuleIdByName = async (name: string) => { const response = await supertest - .get(`/api/alerts/_find?search=${name}&search_fields=name`) + .get(`/api/alerting/rules/_find?search=${name}&search_fields=name`) .expect(200); return response.body.data[0].id; }; diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts index 56150e5693a39..ebe0007b1a4ef 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts @@ -47,7 +47,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { .set('kbn-xsrf', 'foo') .send(getTestAlertData(overwrites)) .expect(200); - objectRemover.add(createdRule.id, 'alert', 'alerts'); + objectRemover.add(createdRule.id, 'rule', 'alerting'); return createdRule; } @@ -62,7 +62,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }) ) .expect(200); - objectRemover.add(createdRule.id, 'alert', 'alerts'); + objectRemover.add(createdRule.id, 'rule', 'alerting'); return createdRule; } diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list/rules_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list/rules_list.ts index a9de637cd691a..b73659839c9e3 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list/rules_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/rules_list/rules_list.ts @@ -223,7 +223,7 @@ export default ({ getPageObjects, getPageObject, getService }: FtrProviderContex ) .expect(200); - objectRemover.add(createdRule.id, 'alert', 'alerts'); + objectRemover.add(createdRule.id, 'rule', 'alerting'); await retry.try(async () => { const { alerts: alertInstances } = await getAlertSummary(createdRule.id); @@ -265,7 +265,7 @@ export default ({ getPageObjects, getPageObject, getService }: FtrProviderContex ) .expect(200); - objectRemover.add(createdRule.id, 'alert', 'alerts'); + objectRemover.add(createdRule.id, 'rule', 'alerting'); await retry.try(async () => { const { alerts: alertInstances } = await getAlertSummary(createdRule.id); diff --git a/x-pack/test/functional_with_es_ssl/lib/alert_api_actions.ts b/x-pack/test/functional_with_es_ssl/lib/alert_api_actions.ts index 09b875b43a359..72e1521b4f613 100644 --- a/x-pack/test/functional_with_es_ssl/lib/alert_api_actions.ts +++ b/x-pack/test/functional_with_es_ssl/lib/alert_api_actions.ts @@ -51,7 +51,7 @@ export async function createAlert({ overwrites?: Record; }) { const createdAlert = await createAlertManualCleanup({ supertest, overwrites }); - objectRemover.add(createdAlert.id, 'alert', 'alerts'); + objectRemover.add(createdAlert.id, 'rule', 'alerting'); return createdAlert; } diff --git a/x-pack/test/plugin_api_integration/test_suites/task_manager/metrics_route.ts b/x-pack/test/plugin_api_integration/test_suites/task_manager/metrics_route.ts index 50568fe1c206c..b456e35d5d673 100644 --- a/x-pack/test/plugin_api_integration/test_suites/task_manager/metrics_route.ts +++ b/x-pack/test/plugin_api_integration/test_suites/task_manager/metrics_route.ts @@ -301,7 +301,7 @@ export default function ({ getService }: FtrProviderContext) { // update apiKey to fix decryption error await request - .post(`/api/alerts/alert/${ruleId}/_update_api_key`) + .post(`/api/alerting/rule/${ruleId}/_update_api_key`) .set('kbn-xsrf', 'xxx') .expect(204); diff --git a/x-pack/test/rule_registry/common/lib/helpers/create_alert.ts b/x-pack/test/rule_registry/common/lib/helpers/create_alert.ts index 40d43ac80d210..b758ac4b1a041 100644 --- a/x-pack/test/rule_registry/common/lib/helpers/create_alert.ts +++ b/x-pack/test/rule_registry/common/lib/helpers/create_alert.ts @@ -17,7 +17,7 @@ export const createAlert = async ( ) => { const supertest = getService('supertestWithoutAuth'); const { body: response, status } = await supertest - .post(`${getSpaceUrlPrefix(spaceId)}/api/alerts/alert`) + .post(`${getSpaceUrlPrefix(spaceId)}/api/alerting/rule`) .auth(user.username, user.password) .send(alertDef) .set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/rule_registry/common/lib/helpers/delete_alert.ts b/x-pack/test/rule_registry/common/lib/helpers/delete_alert.ts index 209b182a958c5..b373d0ffe8667 100644 --- a/x-pack/test/rule_registry/common/lib/helpers/delete_alert.ts +++ b/x-pack/test/rule_registry/common/lib/helpers/delete_alert.ts @@ -22,7 +22,7 @@ export const deleteAlert = async ( const { body: targetIndices } = await getAlertsTargetIndices(getService, user, spaceId); if (id) { const { body, status } = await supertest - .delete(`${getSpaceUrlPrefix(spaceId)}/api/alerts/alert/${id}`) + .delete(`${getSpaceUrlPrefix(spaceId)}/api/alerting/rule/${id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/rule_registry/common/lib/helpers/wait_until_next_execution.ts b/x-pack/test/rule_registry/common/lib/helpers/wait_until_next_execution.ts index 73e15c6cdbaeb..08613ba2c143d 100644 --- a/x-pack/test/rule_registry/common/lib/helpers/wait_until_next_execution.ts +++ b/x-pack/test/rule_registry/common/lib/helpers/wait_until_next_execution.ts @@ -27,7 +27,7 @@ export async function waitUntilNextExecution( }); const { body, status } = await supertest - .get(`${getSpaceUrlPrefix(spaceId)}/api/alerts/alert/${alert.id}`) + .get(`${getSpaceUrlPrefix(spaceId)}/api/alerting/rule/${alert.id}`) .auth(user.username, user.password) .set('kbn-xsrf', 'foo'); diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts index d6799e6be611c..c4a9b7d2a8548 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/alerts/wait_for_alert_to_complete.ts @@ -17,7 +17,9 @@ export const waitForAlertToComplete = async ( ): Promise => { await waitFor( async () => { - const response = await supertest.get(`/api/alerts/alert/${id}/state`).set('kbn-xsrf', 'true'); + const response = await supertest + .get(`/internal/alerting/rule/${id}/state`) + .set('kbn-xsrf', 'true'); if (response.status !== 200) { log.debug( `Did not get an expected 200 "ok" when waiting for an alert to complete (waitForAlertToComplete). CI issues could happen. Suspect this line if you are seeing CI issues. body: ${JSON.stringify( @@ -25,7 +27,7 @@ export const waitForAlertToComplete = async ( )}, status: ${JSON.stringify(response.status)}` ); } - return response.body.previousStartedAt != null; + return response.body.previous_started_at != null; }, 'waitForAlertToComplete', log diff --git a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/authentication/trial_license_complete_tier/endpoint_authz.ts b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/authentication/trial_license_complete_tier/endpoint_authz.ts index 56b3328112e7c..df2f55ccb8d04 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/authentication/trial_license_complete_tier/endpoint_authz.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/authentication/trial_license_complete_tier/endpoint_authz.ts @@ -40,9 +40,7 @@ export default function ({ getService }: FtrProviderContext) { } // @skipInServerlessMKI - this test uses internal index manipulation in before/after hooks // @skipInServerlessMKI - if you are removing this annotation, make sure to add the test suite to the MKI pipeline in .buildkite/pipelines/security_solution_quality_gate/mki_periodic/mki_periodic_defend_workflows.yml - // FLAKY: https://github.com/elastic/kibana/issues/203909 - // FLAKY: https://github.com/elastic/kibana/issues/203910 - describe.skip('@ess @serverless @skipInServerlessMKI When attempting to call an endpoint api', function () { + describe('@ess @serverless @skipInServerlessMKI When attempting to call an endpoint api', function () { let indexedData: IndexedHostsAndAlertsResponse; let actionId = ''; let agentId = ''; diff --git a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/policy_response/trial_license_complete_tier/policy_response.ts b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/policy_response/trial_license_complete_tier/policy_response.ts index a737b337faffe..f3f49ffbc7c1f 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/policy_response/trial_license_complete_tier/policy_response.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/policy_response/trial_license_complete_tier/policy_response.ts @@ -13,9 +13,7 @@ export default function ({ getService }: FtrProviderContext) { const utils = getService('securitySolutionUtils'); const endpointTestresources = getService('endpointTestResources'); - // FLAKY: https://github.com/elastic/kibana/issues/203908 - // Failing: See https://github.com/elastic/kibana/issues/203903 - describe.skip('@ess @serverless @skipInServerlessMKI Endpoint policy response api', function () { + describe('@ess @serverless @skipInServerlessMKI Endpoint policy response api', function () { let adminSupertest: TestAgent; before(async () => { diff --git a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/response_actions/trial_license_complete_tier/execute.ts b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/response_actions/trial_license_complete_tier/execute.ts index a82487c31eff9..13afbf6e4551c 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/response_actions/trial_license_complete_tier/execute.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/response_actions/trial_license_complete_tier/execute.ts @@ -23,9 +23,7 @@ export default function ({ getService }: FtrProviderContext) { const utils = getService('securitySolutionUtils'); // @skipInServerlessMKI - this test uses internal index manipulation in before/after hooks - // FLAKY: https://github.com/elastic/kibana/issues/203906 - // Failing: See https://github.com/elastic/kibana/issues/203897 - describe.skip('@ess @serverless @skipInServerlessMKI Endpoint `execute` response action', function () { + describe('@ess @serverless @skipInServerlessMKI Endpoint `execute` response action', function () { let indexedData: IndexedHostsAndAlertsResponse; let agentId = ''; let t1AnalystSupertest: TestAgent; diff --git a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/spaces/trial_license_complete_tier/space_awareness.ts b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/spaces/trial_license_complete_tier/space_awareness.ts index 38710b65465c7..9c83451111f95 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/spaces/trial_license_complete_tier/space_awareness.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/edr_workflows/spaces/trial_license_complete_tier/space_awareness.ts @@ -24,9 +24,7 @@ export default function ({ getService }: FtrProviderContext) { const kbnServer = getService('kibanaServer'); const log = getService('log'); - // FLAKY: https://github.com/elastic/kibana/issues/203893 - // Failing: See https://github.com/elastic/kibana/issues/203898 - describe.skip('@ess @serverless @skipInServerlessMKI Endpoint management space awareness support', function () { + describe('@ess @serverless @skipInServerlessMKI Endpoint management space awareness support', function () { let adminSupertest: TestAgent; let dataSpaceA: Awaited>; let dataSpaceB: Awaited>; diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/conversations.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/conversations.cy.ts index a97fa8ab9f6e3..42bb91650c5b3 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/conversations.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/conversations.cy.ts @@ -47,6 +47,7 @@ import { } from '../../screens/ai_assistant'; import { visit, visitGetStartedPage } from '../../tasks/navigation'; +// Failing: See https://github.com/elastic/kibana/issues/204167 // Failing: See https://github.com/elastic/kibana/issues/204167 describe.skip('AI Assistant Conversations', { tags: ['@ess', '@serverless'] }, () => { beforeEach(() => { diff --git a/x-pack/test/task_manager_claimer_update_by_query/test_suites/task_manager/metrics_route.ts b/x-pack/test/task_manager_claimer_update_by_query/test_suites/task_manager/metrics_route.ts index 3e37c488e5190..2bab3cf0dc577 100644 --- a/x-pack/test/task_manager_claimer_update_by_query/test_suites/task_manager/metrics_route.ts +++ b/x-pack/test/task_manager_claimer_update_by_query/test_suites/task_manager/metrics_route.ts @@ -296,7 +296,7 @@ export default function ({ getService }: FtrProviderContext) { // update apiKey to fix decryption error await request - .post(`/api/alerts/alert/${ruleId}/_update_api_key`) + .post(`/api/alerting/rule/${ruleId}/_update_api_key`) .set('kbn-xsrf', 'xxx') .expect(204); diff --git a/yarn.lock b/yarn.lock index cf55281ef0a5f..7898cb5b5eacf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4053,10 +4053,6 @@ version "0.0.0" uid "" -"@kbn/bfetch-explorer-plugin@link:examples/bfetch_explorer": - version "0.0.0" - uid "" - "@kbn/bfetch-plugin@link:src/plugins/bfetch": version "0.0.0" uid "" @@ -5517,6 +5513,10 @@ version "0.0.0" uid "" +"@kbn/eslint-plugin-css@link:packages/kbn-eslint-plugin-css": + version "0.0.0" + uid "" + "@kbn/eslint-plugin-disable@link:packages/kbn-eslint-plugin-disable": version "0.0.0" uid "" @@ -7489,7 +7489,7 @@ version "0.0.0" uid "" -"@kbn/slo-plugin@link:x-pack/plugins/observability_solution/slo": +"@kbn/slo-plugin@link:x-pack/solutions/observability/plugins/slo": version "0.0.0" uid "" @@ -11345,6 +11345,11 @@ resolved "https://registry.yarnpkg.com/@types/cookiejar/-/cookiejar-2.1.5.tgz#14a3e83fa641beb169a2dd8422d91c3c345a9a78" integrity sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q== +"@types/cssstyle@^2.2.4": + version "2.2.4" + resolved "https://registry.yarnpkg.com/@types/cssstyle/-/cssstyle-2.2.4.tgz#3d333ab9f8e6c40183ad1d6ebeebfcb8da2bfe4b" + integrity sha512-FTGMeuHZtLB7hRm+NGvOLZElslR1UkKvZmEmFevOZe/e7Av0nFleka1s8ZwoX+QvbJ2y7r9NDZXIzyqpRWDJXQ== + "@types/cytoscape@^3.14.0": version "3.14.0" resolved "https://registry.yarnpkg.com/@types/cytoscape/-/cytoscape-3.14.0.tgz#346b5430a7a1533784bcf44fcbe6c5255b948d36" @@ -16338,6 +16343,13 @@ cssstyle@^2.3.0: dependencies: cssom "~0.3.6" +cssstyle@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-4.1.0.tgz#161faee382af1bafadb6d3867a92a19bcb4aea70" + integrity sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA== + dependencies: + rrweb-cssom "^0.7.1" + csstype@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" @@ -28894,6 +28906,11 @@ robust-predicates@^3.0.0: resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.1.tgz#ecde075044f7f30118682bd9fb3f123109577f9a" integrity sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g== +rrweb-cssom@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz#c73451a484b86dd7cfb1e0b2898df4b703183e4b" + integrity sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg== + rst-selector-parser@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91"