-
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
Prepare the Security domain HTTP APIs for Serverless #162087
Changes from 8 commits
f7ba619
5203a0b
08146f0
c10abc7
dc727cd
70f06f7
8b0c93d
7a346b6
04f1c92
6c53a54
4f20016
a44549d
8f20ee0
994654c
aa8c78e
e4f60db
131a771
e3bb1be
8bb3ca2
074c0cc
2997135
78da626
ee8a12c
a366b54
6cb21ba
252cd72
d0b2364
452ad5a
d1c3bdf
a63d67b
14c00ae
9f0606d
ecb595c
4682542
182273f
e7eec38
0e43706
5e54975
f69ff2f
8018d63
cf5dae0
100ced7
b94cc86
0e291c6
3608f85
b81b484
3478460
24e21f4
95b2f12
1edb353
727b393
6ece943
761f23b
f0fbfdf
65c23e4
3c24c33
0d22303
5c535d6
a979e58
051cf71
4ca4924
305aa70
ba78385
d2ee490
c552a53
084e495
d0292f8
e8b0bef
5e953fa
573a552
710ca09
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ import type { ConfigType } from './config'; | |
import { DefaultSpaceService } from './default_space'; | ||
import { initSpacesRequestInterceptors } from './lib/request_interceptors'; | ||
import { createSpacesTutorialContextFactory } from './lib/spaces_tutorial_context_factory'; | ||
import { initExternalSpacesApi } from './routes/api/external'; | ||
import { initConfigurableSpacesApi, initPublicSpacesApi } from './routes/api/external'; | ||
import { initInternalSpacesApi } from './routes/api/internal'; | ||
import { initSpacesViewsRoutes } from './routes/views'; | ||
import { SpacesSavedObjectsService } from './saved_objects'; | ||
|
@@ -103,7 +103,7 @@ export class SpacesPlugin | |
|
||
private defaultSpaceService?: DefaultSpaceService; | ||
|
||
constructor(initializerContext: PluginInitializerContext) { | ||
constructor(private readonly initializerContext: PluginInitializerContext) { | ||
this.config$ = initializerContext.config.create<ConfigType>(); | ||
this.log = initializerContext.logger.get(); | ||
this.spacesService = new SpacesService(); | ||
|
@@ -148,18 +148,28 @@ export class SpacesPlugin | |
logger: this.log, | ||
}); | ||
|
||
const externalRouter = core.http.createRouter<SpacesRequestHandlerContext>(); | ||
jeramysoucy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
initExternalSpacesApi({ | ||
externalRouter, | ||
const buildFlavor = this.initializerContext.env.packageInfo.buildFlavor; | ||
const router = core.http.createRouter<SpacesRequestHandlerContext>(); | ||
if (buildFlavor !== 'serverless') { | ||
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 opted to make decisions as high-level as possible so we don't have to dig into each route to understand the impact of the build flavor. 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. ++, over time, if we still use |
||
initPublicSpacesApi({ | ||
router, | ||
log: this.log, | ||
getStartServices: core.getStartServices, | ||
getSpacesService, | ||
usageStatsServicePromise, | ||
}); | ||
} | ||
const configuredAccess = buildFlavor === 'serverless' ? 'internal' : 'public'; | ||
initConfigurableSpacesApi({ | ||
jeramysoucy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
router, | ||
log: this.log, | ||
getStartServices: core.getStartServices, | ||
getSpacesService, | ||
usageStatsServicePromise, | ||
access: configuredAccess, | ||
}); | ||
|
||
const internalRouter = core.http.createRouter<SpacesRequestHandlerContext>(); | ||
initInternalSpacesApi({ | ||
internalRouter, | ||
router, | ||
getSpacesService, | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,21 +21,28 @@ import { initPutSpacesApi } from './put'; | |
import { initUpdateObjectsSpacesApi } from './update_objects_spaces'; | ||
|
||
export interface ExternalRouteDeps { | ||
externalRouter: SpacesRouter; | ||
router: SpacesRouter; | ||
getStartServices: CoreSetup['getStartServices']; | ||
getSpacesService: () => SpacesServiceStart; | ||
usageStatsServicePromise: Promise<UsageStatsServiceSetup>; | ||
log: Logger; | ||
} | ||
|
||
export function initExternalSpacesApi(deps: ExternalRouteDeps) { | ||
export interface ConfigurableRouteDeps extends ExternalRouteDeps { | ||
access: 'internal' | 'public'; | ||
} | ||
|
||
export function initPublicSpacesApi(deps: ExternalRouteDeps) { | ||
initDeleteSpacesApi(deps); | ||
initGetSpaceApi(deps); | ||
initGetAllSpacesApi(deps); | ||
initPostSpacesApi(deps); | ||
initPutSpacesApi(deps); | ||
initCopyToSpacesApi(deps); | ||
initUpdateObjectsSpacesApi(deps); | ||
initGetShareableReferencesApi(deps); | ||
initDisableLegacyUrlAliasesApi(deps); | ||
} | ||
|
||
export function initConfigurableSpacesApi(deps: ConfigurableRouteDeps) { | ||
initGetSpaceApi(deps); | ||
initGetAllSpacesApi(deps); | ||
initPutSpacesApi(deps); | ||
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. note: iirc, we don't need |
||
} |
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.
This will be present once #162149 is merged to main.
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.
Aaaand, it has been merged!
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.
And reverted .... https://github.com/elastic/kibana/pull/163296/files
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.
The revert was closed and not merged.