Skip to content

Commit

Permalink
Merge branch 'main' into api-docs-review-timeline-35
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha-moore-elastic authored Sep 13, 2024
2 parents 5fdcdd9 + 3cc99fc commit 0fc23a5
Show file tree
Hide file tree
Showing 85 changed files with 980 additions and 1,738 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ src/plugins/image_embeddable @elastic/appex-sharedux
packages/kbn-import-locator @elastic/kibana-operations
packages/kbn-import-resolver @elastic/kibana-operations
x-pack/plugins/index_lifecycle_management @elastic/kibana-management
x-pack/packages/index-management @elastic/kibana-management
x-pack/plugins/index_management @elastic/kibana-management
x-pack/packages/index-management/index_management_shared_types @elastic/kibana-management
test/plugin_functional/plugins/index_patterns @elastic/kibana-data-discovery
x-pack/packages/ml/inference_integration_flyout @elastic/ml-ui
x-pack/plugins/inference @elastic/appex-ai-infra
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@
"@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded",
"@kbn/image-embeddable-plugin": "link:src/plugins/image_embeddable",
"@kbn/index-lifecycle-management-plugin": "link:x-pack/plugins/index_lifecycle_management",
"@kbn/index-management": "link:x-pack/packages/index-management",
"@kbn/index-management-plugin": "link:x-pack/plugins/index_management",
"@kbn/index-management-shared-types": "link:x-pack/packages/index-management/index_management_shared_types",
"@kbn/index-patterns-test-plugin": "link:test/plugin_functional/plugins/index_patterns",
"@kbn/inference-plugin": "link:x-pack/plugins/inference",
"@kbn/inference_integration_flyout": "link:x-pack/packages/ml/inference_integration_flyout",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-mock-idp-plugin/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const config = {
// The plugin should only be enabled in Serverless.
enabled: offeringBasedSchema({
serverless: schema.boolean({ defaultValue: true }),
traditional: schema.boolean({ defaultValue: false }),
options: { defaultValue: false },
}),
}),
Expand Down
37 changes: 21 additions & 16 deletions packages/kbn-mock-idp-plugin/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import type { PluginInitializer, Plugin } from '@kbn/core-plugins-server';
import { schema } from '@kbn/config-schema';
import type { TypeOf } from '@kbn/config-schema';
import { MOCK_IDP_LOGIN_PATH, MOCK_IDP_LOGOUT_PATH, createSAMLResponse } from '@kbn/mock-idp-utils';
import { SERVERLESS_ROLES_ROOT_PATH, readRolesFromResource } from '@kbn/es';
import {
SERVERLESS_ROLES_ROOT_PATH,
STATEFUL_ROLES_ROOT_PATH,
readRolesFromResource,
} from '@kbn/es';
import { resolve } from 'path';
import { CloudSetup } from '@kbn/cloud-plugin/server';

Expand Down Expand Up @@ -42,6 +46,11 @@ const readServerlessRoles = (projectType: string) => {
}
};

const readStatefulRoles = () => {
const rolesResourcePath = resolve(STATEFUL_ROLES_ROOT_PATH, 'roles.yml');
return readRolesFromResource(rolesResourcePath);
};

export type CreateSAMLResponseParams = TypeOf<typeof createSAMLResponseSchema>;

export const plugin: PluginInitializer<
Expand Down Expand Up @@ -73,22 +82,18 @@ export const plugin: PluginInitializer<
options: { authRequired: false },
},
(context, request, response) => {
const projectType = plugins.cloud.serverless?.projectType;
if (!projectType) {
return response.customError({ statusCode: 500, body: 'projectType is not defined' });
} else {
try {
if (roles.length === 0) {
roles.push(...readServerlessRoles(projectType));
}
return response.ok({
body: {
roles,
},
});
} catch (err) {
return response.customError({ statusCode: 500, body: err.message });
try {
if (roles.length === 0) {
const projectType = plugins.cloud?.serverless?.projectType;
roles.push(...(projectType ? readServerlessRoles(projectType) : readStatefulRoles()));
}
return response.ok({
body: {
roles,
},
});
} catch (err) {
return response.customError({ statusCode: 500, body: err.message });
}
}
);
Expand Down
21 changes: 21 additions & 0 deletions packages/kbn-router-to-openapispec/src/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
getXsrfHeaderForMethod,
mergeResponseContent,
prepareRoutes,
getPathParameters,
} from './util';
import { assignToPaths, extractTags } from './util';

Expand Down Expand Up @@ -230,3 +231,23 @@ describe('getXsrfHeaderForMethod', () => {
expect(getXsrfHeaderForMethod(method as RouteMethod, options)).toEqual(expected);
});
});

describe('getPathParameters', () => {
test.each([
['', {}],
['/', {}],
['{}', {}],
['{{}', {}],
['{badinput', {}],
['{ok}', { ok: { optional: false } }],
['{ok?}', { ok: { optional: true } }],
['{ok??}', {}],
['/api/{path}/is/{cool}', { path: { optional: false }, cool: { optional: false } }],
[
'/{required}/and/{optional?}',
{ required: { optional: false }, optional: { optional: true } },
],
])('%s', (input, output) => {
expect(getPathParameters(input)).toEqual(output);
});
});
2 changes: 1 addition & 1 deletion packages/kbn-router-to-openapispec/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const buildGlobalTags = (paths: OpenAPIV3.PathsObject, additionalTags: st
};

export const getPathParameters = (path: string): KnownParameters => {
return Array.from(path.matchAll(/\{(.+?)\}/g)).reduce<KnownParameters>((acc, [_, key]) => {
return Array.from(path.matchAll(/\{([^{}?]+\??)\}/g)).reduce<KnownParameters>((acc, [_, key]) => {
const optional = key.endsWith('?');
acc[optional ? key.slice(0, key.length - 1) : key] = { optional };
return acc;
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { CoreStart } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { AggregateQuery } from '@kbn/es-query';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';

export interface TextBasedLanguagesEditorProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@kbn/data-plugin",
"@kbn/expressions-plugin",
"@kbn/data-views-plugin",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/code-editor",
"@kbn/shared-ux-markdown",
"@kbn/fields-metadata-plugin",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/public/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BehaviorSubject } from 'rxjs';
import type { CoreStart } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';

export let core: CoreStart;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Plugin, CoreStart, CoreSetup } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@kbn/core",
"@kbn/expressions-plugin",
"@kbn/data-views-plugin",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/i18n",
"@kbn/config-schema",
"@kbn/esql-utils",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,10 @@
"@kbn/import-resolver/*": ["packages/kbn-import-resolver/*"],
"@kbn/index-lifecycle-management-plugin": ["x-pack/plugins/index_lifecycle_management"],
"@kbn/index-lifecycle-management-plugin/*": ["x-pack/plugins/index_lifecycle_management/*"],
"@kbn/index-management": ["x-pack/packages/index-management"],
"@kbn/index-management/*": ["x-pack/packages/index-management/*"],
"@kbn/index-management-plugin": ["x-pack/plugins/index_management"],
"@kbn/index-management-plugin/*": ["x-pack/plugins/index_management/*"],
"@kbn/index-management-shared-types": ["x-pack/packages/index-management/index_management_shared_types"],
"@kbn/index-management-shared-types/*": ["x-pack/packages/index-management/index_management_shared_types/*"],
"@kbn/index-patterns-test-plugin": ["test/plugin_functional/plugins/index_patterns"],
"@kbn/index-patterns-test-plugin/*": ["test/plugin_functional/plugins/index_patterns/*"],
"@kbn/inference_integration_flyout": ["x-pack/packages/ml/inference_integration_flyout"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @kbn/index-management
# @kbn/index-management-shared-types

Contains types and functions used and exported by the index management plugin. Primarily used to avoid cyclical dependencies.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/packages/index-management'],
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/index-management/index_management_shared_types'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/index-management",
"id": "@kbn/index-management-shared-types",
"owner": "@elastic/kibana-management"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kbn/index-management",
"name": "@kbn/index-management-shared-types",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { DataPublicPluginStart } from '@kbn/data-plugin/public';

import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import { IndexMappingProps } from '@kbn/index-management';
import { IndexMappingProps } from '@kbn/index-management-shared-types';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { MlPluginStart } from '@kbn/ml-plugin/public';
import { ELASTICSEARCH_URL_PLACEHOLDER } from '@kbn/search-api-panels/constants';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
import { i18n } from '@kbn/i18n';
import type { IndexManagementPluginStart } from '@kbn/index-management';
import type { IndexManagementPluginStart } from '@kbn/index-management-shared-types';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import { MlPluginStart } from '@kbn/ml-plugin/public';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@kbn/search-playground",
"@kbn/search-inference-endpoints",
"@kbn/utility-types",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/deeplinks-search",
"@kbn/react-kibana-context-theme",
"@kbn/search-types",
Expand Down
15 changes: 15 additions & 0 deletions x-pack/plugins/fleet/common/constants/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,18 @@ export const OUTPUT_TYPES_WITH_PRESET_SUPPORT: Array<ValueOf<OutputType>> = [
];

export const OUTPUT_HEALTH_DATA_STREAM = 'logs-fleet_server.output_health-default';

export const LOGSTASH_API_KEY_CLUSTER_PERMISSIONS = ['monitor', 'manage_own_api_key'];

export const LOGSTASH_API_KEY_INDICES_PRIVILEGES = ['auto_configure', 'create_doc'];

export const LOGSTASH_API_KEY_INDICES = [
'logs-*-*',
'metrics-*-*',
'traces-*-*',
'synthetics-*-*',
'.logs-endpoint.diagnostic.collection-*',
'.logs-endpoint.action.responses-*',
'profiling-*',
'.profiling-*',
];

This file was deleted.

Loading

0 comments on commit 0fc23a5

Please sign in to comment.