backend-plugin-api: export healthCheckConfig fn

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2024-05-17 11:34:55 +02:00
parent 8bbbc314f1
commit 14e982e8d3
3 changed files with 9 additions and 0 deletions
@@ -26,6 +26,11 @@ export interface HttpRouterServiceAuthPolicy {
allow: 'unauthenticated' | 'user-cookie';
}
/** @public */
export interface HttpRouterHealthCheckConfig {
handler: () => Promise<any>;
}
/**
* Allows plugins to register HTTP routes.
*
@@ -40,6 +45,8 @@ export interface HttpRouterService {
*/
use(handler: Handler): void;
healthCheckConfig(healthCheckOptions: HttpRouterHealthCheckConfig): void;
/**
* Adds an auth policy to the router. This is used to allow unauthenticated or
* cookie based access to parts of a plugin's API.
@@ -35,6 +35,7 @@ export type { DiscoveryService } from './DiscoveryService';
export type {
HttpRouterService,
HttpRouterServiceAuthPolicy,
HttpRouterHealthCheckConfig,
} from './HttpRouterService';
export type { HttpAuthService } from './HttpAuthService';
export type {
@@ -348,6 +348,7 @@ export namespace mockServices {
export const factory = httpRouterServiceFactory;
export const mock = simpleMock(coreServices.httpRouter, () => ({
use: jest.fn(),
healthCheckConfig: jest.fn(),
addAuthPolicy: jest.fn(),
}));
}