[Assets] Creating Assets data access plugin (#182108)

Create an empty assets data access plugin so we can start registering
the services(APIs) that will be used to fetch assets type documents.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Cauê Marcondes 2024-04-30 16:15:23 +01:00 committed by GitHub
parent ad81f857e9
commit 97e0f419bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 129 additions and 0 deletions

1
.github/CODEOWNERS vendored
View file

@ -52,6 +52,7 @@ packages/kbn-apm-utils @elastic/obs-ux-infra_services-team
test/plugin_functional/plugins/app_link_test @elastic/kibana-core
x-pack/test/usage_collection/plugins/application_usage_test @elastic/kibana-core
x-pack/plugins/observability_solution/asset_manager @elastic/obs-knowledge-team
x-pack/plugins/observability_solution/assets_data_access @elastic/obs-knowledge-team
x-pack/test/security_api_integration/plugins/audit_log @elastic/kibana-security
packages/kbn-axe-config @elastic/kibana-qa
packages/kbn-babel-preset @elastic/kibana-operations

View file

@ -466,6 +466,10 @@ The plugin exposes the static DefaultEditorController class to consume.
|This plugin provides access to observed asset data, such as information about hosts, pods, containers, services, and more.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/assets_data_access[assetsDataAccess]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/x-pack/plugins/banners/README.md[banners]
|Allow to add a header banner that will be displayed on every page of the Kibana application

View file

@ -174,6 +174,7 @@
"@kbn/app-link-test-plugin": "link:test/plugin_functional/plugins/app_link_test",
"@kbn/application-usage-test-plugin": "link:x-pack/test/usage_collection/plugins/application_usage_test",
"@kbn/assetManager-plugin": "link:x-pack/plugins/observability_solution/asset_manager",
"@kbn/assets-data-access-plugin": "link:x-pack/plugins/observability_solution/assets_data_access",
"@kbn/audit-log-plugin": "link:x-pack/test/security_api_integration/plugins/audit_log",
"@kbn/banners-plugin": "link:x-pack/plugins/banners",
"@kbn/bfetch-error": "link:packages/kbn-bfetch-error",

View file

@ -98,6 +98,8 @@
"@kbn/application-usage-test-plugin/*": ["x-pack/test/usage_collection/plugins/application_usage_test/*"],
"@kbn/assetManager-plugin": ["x-pack/plugins/observability_solution/asset_manager"],
"@kbn/assetManager-plugin/*": ["x-pack/plugins/observability_solution/asset_manager/*"],
"@kbn/assets-data-access-plugin": ["x-pack/plugins/observability_solution/assets_data_access"],
"@kbn/assets-data-access-plugin/*": ["x-pack/plugins/observability_solution/assets_data_access/*"],
"@kbn/audit-log-plugin": ["x-pack/test/security_api_integration/plugins/audit_log"],
"@kbn/audit-log-plugin/*": ["x-pack/test/security_api_integration/plugins/audit_log/*"],
"@kbn/axe-config": ["packages/kbn-axe-config"],

View file

@ -0,0 +1,14 @@
/*
* 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.
*/
const path = require('path');
module.exports = {
preset: '@kbn/test',
rootDir: path.resolve(__dirname, '../../../..'),
roots: ['<rootDir>/x-pack/plugins/observability_solution/assets_data_access'],
};

View file

@ -0,0 +1,13 @@
{
"type": "plugin",
"id": "@kbn/assets-data-access-plugin",
"owner": "@elastic/obs-knowledge-team",
"plugin": {
"id": "assetsDataAccess",
"server": true,
"browser": false,
"requiredPlugins": [],
"optionalPlugins": [],
"requiredBundles": []
}
}

View file

@ -0,0 +1,16 @@
/*
* 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 type { PluginInitializerContext } from '@kbn/core/server';
import type { AssetsDataAccessPluginSetup, AssetsDataAccessPluginStart } from './plugin';
export type { AssetsDataAccessPluginSetup, AssetsDataAccessPluginStart };
export async function plugin(initializerContext: PluginInitializerContext) {
const { AssetsDataAccessPlugin } = await import('./plugin');
return new AssetsDataAccessPlugin(initializerContext);
}

View file

@ -0,0 +1,37 @@
/*
* 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 type {
CoreSetup,
CoreStart,
Logger,
Plugin,
PluginInitializerContext,
} from '@kbn/core/server';
import { registerServices } from './services/register_services';
import { AssetsPluginStartDeps } from './types';
export type AssetsDataAccessPluginSetup = ReturnType<AssetsDataAccessPlugin['setup']>;
export type AssetsDataAccessPluginStart = ReturnType<AssetsDataAccessPlugin['start']>;
export class AssetsDataAccessPlugin implements Plugin {
private readonly logger: Logger;
constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
}
public setup(core: CoreSetup) {}
public start(core: CoreStart, plugins: AssetsPluginStartDeps) {
const services = registerServices({
logger: this.logger,
deps: {},
});
return { services };
}
}

View file

@ -0,0 +1,17 @@
/*
* 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 { Logger } from '@kbn/core/server';
export interface RegisterServicesParams {
logger: Logger;
deps: {};
}
export function registerServices(params: RegisterServicesParams) {
return {};
}

View file

@ -0,0 +1,9 @@
/*
* 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.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AssetsPluginStartDeps {}

View file

@ -0,0 +1,11 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types"
},
"include": ["common/**/*", "server/**/*", "jest.config.js"],
"exclude": ["target/**/*"],
"kbn_references": [
"@kbn/core",
]
}

View file

@ -3246,6 +3246,10 @@
version "0.0.0"
uid ""
"@kbn/assets-data-access-plugin@link:x-pack/plugins/observability_solution/assets_data_access":
version "0.0.0"
uid ""
"@kbn/audit-log-plugin@link:x-pack/test/security_api_integration/plugins/audit_log":
version "0.0.0"
uid ""