UNPKG

@pagerduty/backstage-plugin

Version:

A Backstage plugin that integrates towards PagerDuty

183 lines (171 loc) 7.3 kB
import * as _backstage_plugin_home_react from '@backstage/plugin-home-react'; import { Entity } from '@backstage/catalog-model'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as _backstage_core_plugin_api from '@backstage/core-plugin-api'; import { DiscoveryApi, FetchApi, ConfigApi } from '@backstage/core-plugin-api'; import { ReactNode } from 'react'; import { PagerDutySetting, PagerDutyEntityMappingsResponse, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, PagerDutyServiceStandardsResponse, PagerDutyServiceMetricsResponse, PagerDutyUser } from '@pagerduty/backstage-plugin-common'; /** @public */ declare const isPluginApplicableToEntity$1: (entity: Entity) => boolean; /** @public */ type EntityPagerDutySmallCardProps = { readOnly?: boolean; disableInsights?: boolean; disableOnCall?: boolean; }; /** @public */ declare const isPluginApplicableToEntity: (entity: Entity) => boolean; /** @public */ type EntityPagerDutyCardProps = { readOnly?: boolean; disableChangeEvents?: boolean; disableOnCall?: boolean; }; /** @public */ type PagerDutyEntity = { integrationKey?: string; serviceId?: string; account?: string; name: string; }; /** @public */ type HomePagePagerDutyCardProps = PagerDutyEntity & { readOnly?: boolean; }; /** @public */ declare const pagerDutyPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>; /** @public */ declare const PagerDutyPage: () => react_jsx_runtime.JSX.Element; /** @public */ declare const EntityPagerDutyCard: (props: EntityPagerDutyCardProps) => react_jsx_runtime.JSX.Element; /** @public */ declare const EntityPagerDutySmallCard: (props: EntityPagerDutySmallCardProps) => react_jsx_runtime.JSX.Element; /** @public */ declare const HomePagePagerDutyCard: (props: _backstage_plugin_home_react.CardExtensionProps<HomePagePagerDutyCardProps>) => react_jsx_runtime.JSX.Element; /** @public */ declare function PagerDutyIcon(): react_jsx_runtime.JSX.Element; /** @public */ declare function TriggerButton(props: { children?: ReactNode; }): react_jsx_runtime.JSX.Element; /** @public */ type PagerDutyTriggerAlarmRequest = { integrationKey: string; source: string; description: string; userName: string; }; /** @public */ interface PagerDutyApi { /** * Fetches PagerDuty setting from store. * */ getSetting(id: string): Promise<PagerDutySetting>; /** * Stores PagerDuty setting in the database. * */ storeSettings(settings: PagerDutySetting[]): Promise<Response>; /** * Fetches all entity mappings. * */ getEntityMappings(): Promise<PagerDutyEntityMappingsResponse>; /** * Stores the service mapping in the database. * */ storeServiceMapping(serviceId: string, integrationKey: string, entityRef: string, account: string): Promise<Response>; /** * Fetches the service for the provided pager duty Entity. * */ getServiceByPagerDutyEntity(pagerDutyEntity: PagerDutyEntity): Promise<PagerDutyServiceResponse>; /** * Fetches the service for the provided Entity. * */ getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse>; /** * Fetches service with the provided service id. * */ getServiceById(serviceId: string, account?: string): Promise<PagerDutyServiceResponse>; /** * Fetches a list of incidents a provided service has. * */ getIncidentsByServiceId(serviceId: string, account?: string): Promise<PagerDutyIncidentsResponse>; /** * Fetches a list of change events a provided service has. * */ getChangeEventsByServiceId(serviceId: string, account?: string): Promise<PagerDutyChangeEventsResponse>; /** * Fetches a list of standards for a provided service. * */ getServiceStandardsByServiceId(serviceId: string, account?: string): Promise<PagerDutyServiceStandardsResponse>; /** * Fetches a list of metrics for a provided service. * */ getServiceMetricsByServiceId(serviceId: string, account?: string): Promise<PagerDutyServiceMetricsResponse>; /** * Fetches the list of users in an escalation policy. * */ getOnCallByPolicyId(policyId: string, account?: string): Promise<PagerDutyUser[]>; /** * Triggers an incident to whoever is on-call. */ triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response>; } /** @public */ type PagerDutyClientApiDependencies = { discoveryApi: DiscoveryApi; fetchApi: FetchApi; }; /** @public */ type PagerDutyClientApiConfig = PagerDutyClientApiDependencies & { eventsBaseUrl?: string; }; /** @public */ declare class UnauthorizedError extends Error { } /** @public */ declare const pagerDutyApiRef: _backstage_core_plugin_api.ApiRef<PagerDutyApi>; /** @public */ declare class PagerDutyClient implements PagerDutyApi { private readonly config; static fromConfig(configApi: ConfigApi, dependencies: PagerDutyClientApiDependencies): PagerDutyClient; constructor(config: PagerDutyClientApiConfig); getServiceByPagerDutyEntity(pagerDutyEntity: PagerDutyEntity): Promise<PagerDutyServiceResponse>; getSetting(id: string): Promise<PagerDutySetting>; storeSettings(settings: PagerDutySetting[]): Promise<Response>; getEntityMappings(): Promise<PagerDutyEntityMappingsResponse>; storeServiceMapping(serviceId: string, integrationKey: string, backstageEntityRef: string, account: string): Promise<Response>; getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse>; getServiceById(serviceId: string, account?: string): Promise<PagerDutyServiceResponse>; getIncidentsByServiceId(serviceId: string, account?: string): Promise<PagerDutyIncidentsResponse>; getChangeEventsByServiceId(serviceId: string, account?: string): Promise<PagerDutyChangeEventsResponse>; getServiceStandardsByServiceId(serviceId: string, account?: string): Promise<PagerDutyServiceStandardsResponse>; getServiceMetricsByServiceId(serviceId: string, account?: string): Promise<PagerDutyServiceMetricsResponse>; getOnCallByPolicyId(policyId: string, account?: string): Promise<PagerDutyUser[]>; triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response>; private findByUrl; private request; } /** * @public * @deprecated Please use EntityPagerDutyCard */ declare const PagerDutyCard: (props: EntityPagerDutyCardProps) => react_jsx_runtime.JSX.Element; /** * @public * @deprecated Please use EntityPagerDutyCardProps */ type PagerDutyCardProps = EntityPagerDutyCardProps; export { EntityPagerDutyCard, EntityPagerDutySmallCard, HomePagePagerDutyCard, PagerDutyCard, PagerDutyClient, PagerDutyIcon, PagerDutyPage, TriggerButton, UnauthorizedError, isPluginApplicableToEntity as isPagerDutyAvailable, isPluginApplicableToEntity$1 as isPagerDutySmallCardAvailable, isPluginApplicableToEntity, pagerDutyApiRef, pagerDutyPlugin, pagerDutyPlugin as plugin }; export type { EntityPagerDutyCardProps, EntityPagerDutySmallCardProps, HomePagePagerDutyCardProps, PagerDutyApi, PagerDutyCardProps, PagerDutyClientApiConfig, PagerDutyClientApiDependencies, PagerDutyEntity, PagerDutyTriggerAlarmRequest };