mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Streams 🌊] Remove enablement check in PUT /api/streams/{id}
for classic streams (#212289)
## Summary The goal of this PR is to enable all the workflows for "Classic" without enabling "Wired" streams. This PR changes the `isStreamsEnabled` check for `PUT /api/streams/{id}` to allow for `PUT` requests for an `UnwiredStreamDefinition`. This change will allow users to directly navigate to `/app/streams` and use it to manage "classic" streams. User's would still be required to call `POST /api/streams/_enable` to work with "wired" streams. This also includes a fix for the `i18n` paths that were missed when moving from Observability to Platform.
This commit is contained in:
parent
d8d976efad
commit
b7976175e5
6 changed files with 26 additions and 23 deletions
|
@ -151,7 +151,8 @@
|
|||
"xpack.securitySolutionServerless": "solutions/security/plugins/security_solution_serverless",
|
||||
"xpack.sessionView": "solutions/security/plugins/session_view",
|
||||
"xpack.streams": [
|
||||
"solutions/observability/plugins/streams_app"
|
||||
"solutions/observability/plugins/observability_streams_wrapper",
|
||||
"platform/plugins/shared/streams_app"
|
||||
],
|
||||
"xpack.slo": "solutions/observability/plugins/slo",
|
||||
"xpack.snapshotRestore": "platform/plugins/private/snapshot_restore",
|
||||
|
@ -186,4 +187,4 @@
|
|||
"@kbn/translations-plugin/translations/ja-JP.json",
|
||||
"@kbn/translations-plugin/translations/fr-FR.json"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
isWiredStreamDefinition,
|
||||
streamUpsertRequestSchema,
|
||||
isGroupStreamDefinitionBase,
|
||||
isUnwiredStreamDefinition,
|
||||
} from '@kbn/streams-schema';
|
||||
import { z } from '@kbn/zod';
|
||||
import { badData, badRequest } from '@hapi/boom';
|
||||
|
@ -150,22 +151,17 @@ export const editStreamRoute = createServerRoute({
|
|||
}),
|
||||
handler: async ({ params, request, getScopedClients }): Promise<UpsertStreamResponse> => {
|
||||
const { streamsClient } = await getScopedClients({ request });
|
||||
const streamDefinition = { ...params.body.stream, name: params.path.name };
|
||||
|
||||
if (!(await streamsClient.isStreamsEnabled())) {
|
||||
throw badData('Streams are not enabled');
|
||||
if (!isUnwiredStreamDefinition(streamDefinition) && !(await streamsClient.isStreamsEnabled())) {
|
||||
throw badData('Streams are not enabled for Wired and Group streams.');
|
||||
}
|
||||
|
||||
if (
|
||||
isWiredStreamDefinition({ ...params.body.stream, name: params.path.name }) &&
|
||||
!hasSupportedStreamsRoot(params.path.name)
|
||||
) {
|
||||
if (isWiredStreamDefinition(streamDefinition) && !hasSupportedStreamsRoot(params.path.name)) {
|
||||
throw badRequest('Cannot create wired stream due to unsupported root stream');
|
||||
}
|
||||
|
||||
if (
|
||||
isGroupStreamDefinition({ ...params.body.stream, name: params.path.name }) &&
|
||||
params.path.name.startsWith('logs.')
|
||||
) {
|
||||
if (isGroupStreamDefinition(streamDefinition) && params.path.name.startsWith('logs.')) {
|
||||
throw badRequest('A group stream name can not start with [logs.]');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { z } from '@kbn/zod';
|
||||
import { badRequest } from '@hapi/boom';
|
||||
import { badData, badRequest } from '@hapi/boom';
|
||||
import {
|
||||
GroupObjectGetResponse,
|
||||
groupObjectUpsertRequestSchema,
|
||||
|
@ -70,6 +70,10 @@ const upsertGroupRoute = createServerRoute({
|
|||
request,
|
||||
});
|
||||
|
||||
if (!(await streamsClient.isStreamsEnabled())) {
|
||||
throw badData('Streams are not enabled for Group streams.');
|
||||
}
|
||||
|
||||
const { name } = params.path;
|
||||
|
||||
if (name.startsWith('logs.')) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { badRequest } from '@hapi/boom';
|
||||
import { badData, badRequest } from '@hapi/boom';
|
||||
import {
|
||||
IngestGetResponse,
|
||||
StreamUpsertRequest,
|
||||
|
@ -75,6 +75,13 @@ const upsertIngestRoute = createServerRoute({
|
|||
request,
|
||||
});
|
||||
|
||||
if (
|
||||
isWiredStreamDefinition({ name: params.path.name, ...params.body }) &&
|
||||
!(await streamsClient.isStreamsEnabled())
|
||||
) {
|
||||
throw badData('Streams are not enabled for Wired streams.');
|
||||
}
|
||||
|
||||
const name = params.path.name;
|
||||
|
||||
const assets = await assetClient.getAssets({
|
||||
|
|
|
@ -98,7 +98,7 @@ export class ObservabilityStreamsWrapperPlugin
|
|||
sortKey: 101,
|
||||
entries: [
|
||||
{
|
||||
label: i18n.translate('app_not_found_in_i18nrc.streamsAppLinkTitle', {
|
||||
label: i18n.translate('xpack.streams.streamsAppLinkTitle', {
|
||||
defaultMessage: 'Streams',
|
||||
}),
|
||||
app: STREAMS_APP_ID,
|
||||
|
@ -117,7 +117,7 @@ export class ObservabilityStreamsWrapperPlugin
|
|||
|
||||
coreSetup.application.register({
|
||||
id: STREAMS_APP_ID,
|
||||
title: i18n.translate('app_not_found_in_i18nrc.appTitle', {
|
||||
title: i18n.translate('xpack.streams.appTitle', {
|
||||
defaultMessage: 'Streams',
|
||||
}),
|
||||
euiIconType: 'logoObservability',
|
||||
|
@ -141,7 +141,7 @@ export class ObservabilityStreamsWrapperPlugin
|
|||
? [
|
||||
{
|
||||
id: 'streams',
|
||||
title: i18n.translate('app_not_found_in_i18nrc.streamsAppDeepLinkTitle', {
|
||||
title: i18n.translate('xpack.streams.streamsAppDeepLinkTitle', {
|
||||
defaultMessage: 'Streams',
|
||||
}),
|
||||
path: '/',
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
StreamsSupertestRepositoryClient,
|
||||
createStreamsRepositoryAdminClient,
|
||||
} from './helpers/repository_client';
|
||||
import { disableStreams, enableStreams, fetchDocument, indexDocument } from './helpers/requests';
|
||||
import { fetchDocument, indexDocument } from './helpers/requests';
|
||||
|
||||
export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
||||
const roleScopedSupertest = getService('roleScopedSupertest');
|
||||
|
@ -27,11 +27,6 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
|||
describe('Classic streams', () => {
|
||||
before(async () => {
|
||||
apiClient = await createStreamsRepositoryAdminClient(roleScopedSupertest);
|
||||
await enableStreams(apiClient);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await disableStreams(apiClient);
|
||||
});
|
||||
|
||||
it('non-wired data streams', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue