UNPKG

@pagerduty/backstage-plugin

Version:
309 lines (297 loc) 11.7 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 * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api'; import { PagerDutySetting, PagerDutyEnhancedEntityMappingsResponse, PagerDutyServiceResponse, PagerDutyIncidentsResponse, PagerDutyChangeEventsResponse, PagerDutyService, PagerDutyTeam, PagerDutyServiceStandardsResponse, PagerDutyServiceMetricsResponse, PagerDutyUser, AutoMatchStartResponse, AutoMatchStatusResponse } from '@pagerduty/backstage-plugin-common'; export { AutoMatchBackstageComponent, AutoMatchEntityMapping, AutoMatchEntityMappingsResponse, AutoMatchPagerDutyService, AutoMatchScoreBreakdown, AutoMatchStatistics } 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 & { entity: Entity; 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 | null; /** @public */ declare const EntityPagerDutySmallCard: (props: EntityPagerDutySmallCardProps) => react_jsx_runtime.JSX.Element | null; /** @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 entity mappings with pagination and search support. * */ getEntityMappingsWithPagination(options: { offset: number; limit: number; filters?: { name?: string; serviceName?: string; status?: string; teamName?: string; }; sort?: { column: string; direction: 'ascending' | 'descending'; }; account?: string; }): Promise<PagerDutyEnhancedEntityMappingsResponse>; /** * Stores the service mapping in the database. * */ storeServiceMapping(serviceId: string, integrationKey: string, entityRef: string, account: string): Promise<Response>; /** * Fetches the service mapping for a specific entity. * */ getEntityMapping(entityRef: string): Promise<{ mapping: { serviceId: string; integrationKey: string; entityRef: string; account: string; }; }>; /** * Removes the service mapping for an entity by setting entityRef to empty string. * Uses the same approach as the admin page "None" option. * */ removeServiceMapping(entityRef: string): Promise<boolean>; /** * Stores multiple service mappings in the database. * */ storeBulkServiceMappings(mappings: Array<{ 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 PagerDuty services. * */ getAllServices(): Promise<PagerDutyService[]>; /** * Fetches a list of PagerDuty teams. * * @param account - The account ID to filter teams by */ getAllTeams(account?: string): Promise<PagerDutyTeam[]>; /** * Fetches a filtered list of PagerDuty services. * * @param teamIds - Optional array of team IDs to filter by * @param query - Optional search query for service name or ID * @param limit - Optional maximum number of results (default: 100) * @param account - The account ID to filter services by */ getFilteredServices(teamIds?: string[], query?: string, limit?: number, account?: string): Promise<PagerDutyService[]>; /** * 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>; /** * Starts an async auto-match job and returns a jobId to poll. */ startAutoMatchEntityMappings(options: { team?: string; threshold: number; account?: string; }): Promise<AutoMatchStartResponse>; /** * Fetches the current status (and result, when complete) of an auto-match job. */ getAutoMatchStatus(jobId: string): Promise<AutoMatchStatusResponse>; /** * Fetches the list of configured PagerDuty accounts. */ getAccounts(): Promise<Array<{ id: string; isDefault: boolean; }>>; } /** @public */ type PagerDutyClientApiDependencies = { discoveryApi: DiscoveryApi; fetchApi: FetchApi; }; /** @public */ type PagerDutyClientApiConfig = PagerDutyClientApiDependencies & { eventsBaseUrl?: string; }; /** @public */ declare class UnauthorizedError extends Error { } /** @public */ declare const pagerDutyApiRef: _backstage_frontend_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>; getEntityMappingsWithPagination(options: { offset: number; limit: number; filters?: { name?: string; serviceName?: string; status?: string; teamName?: string; }; sort?: { column: string; direction: 'ascending' | 'descending'; }; account?: string; }): Promise<PagerDutyEnhancedEntityMappingsResponse>; getAllServices(): Promise<PagerDutyService[]>; getAllTeams(account?: string): Promise<PagerDutyTeam[]>; getFilteredServices(teamIds?: string[], query?: string, limit?: number, account?: string): Promise<PagerDutyService[]>; storeServiceMapping(serviceId: string, integrationKey: string, backstageEntityRef: string, account: string): Promise<Response>; getEntityMapping(entityRef: string): Promise<{ mapping: { serviceId: string; integrationKey: string; entityRef: string; account: string; }; }>; storeBulkServiceMappings(mappings: Array<{ serviceId: string; integrationKey: string; entityRef: string; account: string; }>): Promise<Response>; removeServiceMapping(entityRef: string): Promise<boolean>; 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>; startAutoMatchEntityMappings(options: { team?: string; threshold: number; account?: string; }): Promise<AutoMatchStartResponse>; getAutoMatchStatus(jobId: string): Promise<AutoMatchStatusResponse>; getAccounts(): Promise<Array<{ id: string; isDefault: boolean; }>>; private findByUrl; private request; } /** * @public * @deprecated Please use EntityPagerDutyCard */ declare const PagerDutyCard: (props: EntityPagerDutyCardProps) => react_jsx_runtime.JSX.Element | null; /** * @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 };