Extract interface
Signed-off-by: Julio Zynger <julio.zynger@soundcloud.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
7235b16054
commit
9e04715967
@@ -33,7 +33,37 @@ type PeriskopInstance = {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class PeriskopApi {
|
||||
export interface PeriskopApi {
|
||||
/**
|
||||
* Returns the list of registered Periskop instance names.
|
||||
*/
|
||||
getInstanceNames(): string[];
|
||||
|
||||
/**
|
||||
* For the given instance and service, returns the URL pointing to the specific error instance occurrence.
|
||||
* Note: This method might point to an external route.
|
||||
*/
|
||||
getErrorInstanceUrl(
|
||||
instanceName: string,
|
||||
serviceName: string,
|
||||
error: AggregatedError,
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Fetches all errors for the given service from the specified Periskop instance, given its name.
|
||||
*/
|
||||
getErrors(
|
||||
instanceName: string,
|
||||
serviceName: string,
|
||||
): Promise<AggregatedError[] | NotFoundInInstance>;
|
||||
}
|
||||
|
||||
/**
|
||||
* API implementation to interact with Periskop's backends.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class PeriskopClient implements PeriskopApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly instances: PeriskopInstance[];
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
createPlugin,
|
||||
createApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { PeriskopApi } from './api';
|
||||
import { PeriskopApi, PeriskopClient } from './api';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -40,7 +40,7 @@ export const periskopPlugin = createPlugin({
|
||||
api: periskopApiRef,
|
||||
deps: { configApi: configApiRef, discoveryApi: discoveryApiRef },
|
||||
factory: ({ configApi, discoveryApi }) =>
|
||||
new PeriskopApi({ configApi, discoveryApi }),
|
||||
new PeriskopClient({ configApi, discoveryApi }),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user