diff --git a/plugins/periskop/src/api/index.ts b/plugins/periskop/src/api/index.ts index c935733a1e..0afbe9abd9 100644 --- a/plugins/periskop/src/api/index.ts +++ b/plugins/periskop/src/api/index.ts @@ -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; +} + +/** + * API implementation to interact with Periskop's backends. + * + * @public + */ +export class PeriskopClient implements PeriskopApi { private readonly discoveryApi: DiscoveryApi; private readonly instances: PeriskopInstance[]; diff --git a/plugins/periskop/src/plugin.ts b/plugins/periskop/src/plugin.ts index 6a99980263..0fb0c2bede 100644 --- a/plugins/periskop/src/plugin.ts +++ b/plugins/periskop/src/plugin.ts @@ -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 }), }), ], });