-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a stub endpoint plugin #50082
Add a stub endpoint plugin #50082
Conversation
💔 Build Failed
|
0b4ba3d
to
dad3989
Compare
💔 Build Failed
|
dad3989
to
9299846
Compare
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elastic/kibana-platform could someone review/approve #50286 ?
I think we should separate core & plugin changes
"id": "endpoint", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"configPath": ["x-pack", "endpoint"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--- x-pack
+++ xpack
async function greetingIndex(...passedArgs: [unknown, unknown, KibanaResponseFactory]) { | ||
const [, , response] = passedArgs; | ||
return response.ok({ | ||
body: JSON.stringify({ hello: 'world' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't think JSON.stringify
is necessary
); | ||
} | ||
|
||
async function greetingIndex(...passedArgs: [unknown, unknown, KibanaResponseFactory]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use RequestHandler
as a more descriptive type. We will remove the required types from the generic soon.
import { RequestHandler } from 'src/core/server';
export const greetingIndex: RequestHandler<any, any, any> = async (context, request, response) => {
schema: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), | ||
}; | ||
|
||
export function plugin() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFYI PluginInitializerContext also passed to the plugin factory
export const plugin = (initializerContext: PluginInitializerContext) => new EndpointPlugin(initializerContext)
import { schema } from '@kbn/config-schema'; | ||
import { EndpointPlugin } from './plugin'; | ||
|
||
export const config = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config schema defined only on the server. lets remove it
export function addRoutes(router: IRouter) { | ||
router.get( | ||
{ | ||
path: '/endpoint/hello-world', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFYI: by convention API endpoints are prefixed with api/
yes. |
Sorry if I confused things. I was just pulling your commits in to see if they would fix my tests (they did.) I can close this PR until your PR is merged. |
@oatkiller #50286 merged |
Summary
This PR adds a basic (useless) endpoint plugin and Endpoint app. My assumption is that the Endpoint team will work merge their work into master. Up until the product is ready for release, the plugin will be disabled. When the app is release ready, we will make the plugin enabled by default and our commits will be added to a release branch.
TODO
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers