mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -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.securitySolutionServerless": "solutions/security/plugins/security_solution_serverless",
|
||||||
"xpack.sessionView": "solutions/security/plugins/session_view",
|
"xpack.sessionView": "solutions/security/plugins/session_view",
|
||||||
"xpack.streams": [
|
"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.slo": "solutions/observability/plugins/slo",
|
||||||
"xpack.snapshotRestore": "platform/plugins/private/snapshot_restore",
|
"xpack.snapshotRestore": "platform/plugins/private/snapshot_restore",
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
isWiredStreamDefinition,
|
isWiredStreamDefinition,
|
||||||
streamUpsertRequestSchema,
|
streamUpsertRequestSchema,
|
||||||
isGroupStreamDefinitionBase,
|
isGroupStreamDefinitionBase,
|
||||||
|
isUnwiredStreamDefinition,
|
||||||
} from '@kbn/streams-schema';
|
} from '@kbn/streams-schema';
|
||||||
import { z } from '@kbn/zod';
|
import { z } from '@kbn/zod';
|
||||||
import { badData, badRequest } from '@hapi/boom';
|
import { badData, badRequest } from '@hapi/boom';
|
||||||
|
@ -150,22 +151,17 @@ export const editStreamRoute = createServerRoute({
|
||||||
}),
|
}),
|
||||||
handler: async ({ params, request, getScopedClients }): Promise<UpsertStreamResponse> => {
|
handler: async ({ params, request, getScopedClients }): Promise<UpsertStreamResponse> => {
|
||||||
const { streamsClient } = await getScopedClients({ request });
|
const { streamsClient } = await getScopedClients({ request });
|
||||||
|
const streamDefinition = { ...params.body.stream, name: params.path.name };
|
||||||
|
|
||||||
if (!(await streamsClient.isStreamsEnabled())) {
|
if (!isUnwiredStreamDefinition(streamDefinition) && !(await streamsClient.isStreamsEnabled())) {
|
||||||
throw badData('Streams are not enabled');
|
throw badData('Streams are not enabled for Wired and Group streams.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (isWiredStreamDefinition(streamDefinition) && !hasSupportedStreamsRoot(params.path.name)) {
|
||||||
isWiredStreamDefinition({ ...params.body.stream, name: params.path.name }) &&
|
|
||||||
!hasSupportedStreamsRoot(params.path.name)
|
|
||||||
) {
|
|
||||||
throw badRequest('Cannot create wired stream due to unsupported root stream');
|
throw badRequest('Cannot create wired stream due to unsupported root stream');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (isGroupStreamDefinition(streamDefinition) && params.path.name.startsWith('logs.')) {
|
||||||
isGroupStreamDefinition({ ...params.body.stream, name: params.path.name }) &&
|
|
||||||
params.path.name.startsWith('logs.')
|
|
||||||
) {
|
|
||||||
throw badRequest('A group stream name can not start with [logs.]');
|
throw badRequest('A group stream name can not start with [logs.]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from '@kbn/zod';
|
import { z } from '@kbn/zod';
|
||||||
import { badRequest } from '@hapi/boom';
|
import { badData, badRequest } from '@hapi/boom';
|
||||||
import {
|
import {
|
||||||
GroupObjectGetResponse,
|
GroupObjectGetResponse,
|
||||||
groupObjectUpsertRequestSchema,
|
groupObjectUpsertRequestSchema,
|
||||||
|
@ -70,6 +70,10 @@ const upsertGroupRoute = createServerRoute({
|
||||||
request,
|
request,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!(await streamsClient.isStreamsEnabled())) {
|
||||||
|
throw badData('Streams are not enabled for Group streams.');
|
||||||
|
}
|
||||||
|
|
||||||
const { name } = params.path;
|
const { name } = params.path;
|
||||||
|
|
||||||
if (name.startsWith('logs.')) {
|
if (name.startsWith('logs.')) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { badRequest } from '@hapi/boom';
|
import { badData, badRequest } from '@hapi/boom';
|
||||||
import {
|
import {
|
||||||
IngestGetResponse,
|
IngestGetResponse,
|
||||||
StreamUpsertRequest,
|
StreamUpsertRequest,
|
||||||
|
@ -75,6 +75,13 @@ const upsertIngestRoute = createServerRoute({
|
||||||
request,
|
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 name = params.path.name;
|
||||||
|
|
||||||
const assets = await assetClient.getAssets({
|
const assets = await assetClient.getAssets({
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class ObservabilityStreamsWrapperPlugin
|
||||||
sortKey: 101,
|
sortKey: 101,
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
label: i18n.translate('app_not_found_in_i18nrc.streamsAppLinkTitle', {
|
label: i18n.translate('xpack.streams.streamsAppLinkTitle', {
|
||||||
defaultMessage: 'Streams',
|
defaultMessage: 'Streams',
|
||||||
}),
|
}),
|
||||||
app: STREAMS_APP_ID,
|
app: STREAMS_APP_ID,
|
||||||
|
@ -117,7 +117,7 @@ export class ObservabilityStreamsWrapperPlugin
|
||||||
|
|
||||||
coreSetup.application.register({
|
coreSetup.application.register({
|
||||||
id: STREAMS_APP_ID,
|
id: STREAMS_APP_ID,
|
||||||
title: i18n.translate('app_not_found_in_i18nrc.appTitle', {
|
title: i18n.translate('xpack.streams.appTitle', {
|
||||||
defaultMessage: 'Streams',
|
defaultMessage: 'Streams',
|
||||||
}),
|
}),
|
||||||
euiIconType: 'logoObservability',
|
euiIconType: 'logoObservability',
|
||||||
|
@ -141,7 +141,7 @@ export class ObservabilityStreamsWrapperPlugin
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
id: 'streams',
|
id: 'streams',
|
||||||
title: i18n.translate('app_not_found_in_i18nrc.streamsAppDeepLinkTitle', {
|
title: i18n.translate('xpack.streams.streamsAppDeepLinkTitle', {
|
||||||
defaultMessage: 'Streams',
|
defaultMessage: 'Streams',
|
||||||
}),
|
}),
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
StreamsSupertestRepositoryClient,
|
StreamsSupertestRepositoryClient,
|
||||||
createStreamsRepositoryAdminClient,
|
createStreamsRepositoryAdminClient,
|
||||||
} from './helpers/repository_client';
|
} from './helpers/repository_client';
|
||||||
import { disableStreams, enableStreams, fetchDocument, indexDocument } from './helpers/requests';
|
import { fetchDocument, indexDocument } from './helpers/requests';
|
||||||
|
|
||||||
export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
||||||
const roleScopedSupertest = getService('roleScopedSupertest');
|
const roleScopedSupertest = getService('roleScopedSupertest');
|
||||||
|
@ -27,11 +27,6 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
||||||
describe('Classic streams', () => {
|
describe('Classic streams', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
apiClient = await createStreamsRepositoryAdminClient(roleScopedSupertest);
|
apiClient = await createStreamsRepositoryAdminClient(roleScopedSupertest);
|
||||||
await enableStreams(apiClient);
|
|
||||||
});
|
|
||||||
|
|
||||||
after(async () => {
|
|
||||||
await disableStreams(apiClient);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('non-wired data streams', async () => {
|
it('non-wired data streams', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue