-
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
[HTTP/OAS] Make SO CRUD and resolve APIs internal
on serverless
#184408
Changes from 6 commits
eafb16b
454edfb
9268761
8166ec4
76691f3
629fd36
bd8aa8a
3ea77ab
3f02c23
fba5c73
dcb6b3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,10 @@ export const registerExportRoute = ( | |
router.post( | ||
{ | ||
path: '/_export', | ||
options: { | ||
access: 'public', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description: `Export saved objects`, | ||
}, | ||
validate: { | ||
body: schema.object({ | ||
type: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ export const registerImportRoute = ( | |
{ | ||
path: '/_import', | ||
options: { | ||
access: 'public', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description: `Import saved objects`, | ||
body: { | ||
maxBytes: maxImportPayloadBytes, | ||
output: 'stream', | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -41,6 +41,7 @@ export function registerRoutes({ | |||
migratorPromise, | ||||
kibanaVersion, | ||||
kibanaIndex, | ||||
isServerless, | ||||
}: { | ||||
http: InternalHttpServiceSetup; | ||||
coreUsageData: InternalCoreUsageDataSetup; | ||||
|
@@ -49,20 +50,30 @@ export function registerRoutes({ | |||
migratorPromise: Promise<IKibanaMigrator>; | ||||
kibanaVersion: string; | ||||
kibanaIndex: string; | ||||
isServerless: boolean; | ||||
}) { | ||||
const router = | ||||
http.createRouter<InternalSavedObjectsRequestHandlerContext>('/api/saved_objects/'); | ||||
registerGetRoute(router, { config, coreUsageData, logger }); | ||||
registerResolveRoute(router, { config, coreUsageData, logger }); | ||||
registerCreateRoute(router, { config, coreUsageData, logger }); | ||||
registerDeleteRoute(router, { config, coreUsageData, logger }); | ||||
registerFindRoute(router, { config, coreUsageData, logger }); | ||||
registerUpdateRoute(router, { config, coreUsageData, logger }); | ||||
registerBulkGetRoute(router, { config, coreUsageData, logger }); | ||||
registerBulkCreateRoute(router, { config, coreUsageData, logger }); | ||||
registerBulkResolveRoute(router, { config, coreUsageData, logger }); | ||||
registerBulkUpdateRoute(router, { config, coreUsageData, logger }); | ||||
registerBulkDeleteRoute(router, { config, coreUsageData, logger }); | ||||
|
||||
const internalOnServerless = isServerless ? 'internal' : 'public'; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no. We cannot use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 , this is only used for the APIs documented as public, but that we want internal on serverless. I can add a comment to that effect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jloleysens I'll approve this PR as long as we're not contradicting our public docs that clearly state which APIs are deprecated. |
||||
|
||||
registerGetRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no |
||||
registerResolveRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerCreateRoute(router, { | ||||
config, | ||||
coreUsageData, | ||||
logger, | ||||
access: internalOnServerless, | ||||
}); | ||||
registerDeleteRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerFindRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerUpdateRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerBulkGetRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerBulkCreateRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerBulkResolveRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerBulkUpdateRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
registerBulkDeleteRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not add tests for the existing public behaviour as I assume these tests already give us that coverage:
|
||||
|
||||
registerExportRoute(router, { config, coreUsageData }); | ||||
registerImportRoute(router, { config, coreUsageData }); | ||||
registerResolveImportErrorsRoute(router, { config, coreUsageData }); | ||||
|
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.
@jloleysens Unless I'm missing some intricate detail,
access
will beinternal
according to https://github.com/elastic/kibana/pull/184408/files#diff-311e61dcad4f336ae3320406e2a114cc844823d4526d9c52c35c022d47516843R144.The PR title had me worried you were making ALL the SO APIs public!
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.
Access will be set dynamically based on build flavour. Serverless will remain internal and stateful will remain public. This pr just brings those to bear in the code.