Merge pull request #13252 from backstage/freben/api-well-ok-then
When the 🧹 s go marching in
This commit is contained in:
@@ -12,62 +12,207 @@ import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "EntitySplunkOnCallCardProps" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "EntitySplunkOnCallCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type ClientApiConfig = {
|
||||
eventsRestEndpoint: string | null;
|
||||
discoveryApi: DiscoveryApi;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const EntitySplunkOnCallCard: (
|
||||
props: EntitySplunkOnCallCardProps,
|
||||
) => JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "isSplunkOnCallAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type EntitySplunkOnCallCardProps = {
|
||||
readOnly?: boolean;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EscalationPolicyInfo = {
|
||||
policy: EscalationPolicySummary;
|
||||
team?: EscalationPolicyTeam;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EscalationPolicyResponse = {
|
||||
policies: EscalationPolicyInfo[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EscalationPolicySummary = {
|
||||
name: string;
|
||||
slug: string;
|
||||
_selfUrl: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EscalationPolicyTeam = {
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type Incident = {
|
||||
incidentNumber?: string;
|
||||
startTime?: string;
|
||||
currentPhase: IncidentPhase;
|
||||
entityState?: string;
|
||||
entityType?: string;
|
||||
routingKey?: string;
|
||||
alertCount?: number;
|
||||
lastAlertTime?: string;
|
||||
lastAlertId?: string;
|
||||
entityId: string;
|
||||
host?: string;
|
||||
service?: string;
|
||||
pagedUsers?: string[];
|
||||
pagedTeams?: string[];
|
||||
entityDisplayName?: string;
|
||||
pagedPolicies?: EscalationPolicyInfo[];
|
||||
transitions?: IncidentTransition[];
|
||||
firstAlertUuid?: string;
|
||||
monitorName?: string;
|
||||
monitorType?: string;
|
||||
incidentLink?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type IncidentPhase = 'UNACKED' | 'ACKED' | 'RESOLVED';
|
||||
|
||||
// @public (undocumented)
|
||||
export type IncidentsResponse = {
|
||||
incidents: Incident[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type IncidentTransition = {
|
||||
name?: string;
|
||||
at?: string;
|
||||
by?: string;
|
||||
message?: string;
|
||||
manually?: boolean;
|
||||
alertId?: string;
|
||||
alertUrl?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const isSplunkOnCallAvailable: (entity: Entity) => boolean;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "SplunkOnCallApi" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "splunkOnCallApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type ListRoutingKeyResponse = {
|
||||
routingKeys: RoutingKey[];
|
||||
_selfUrl?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type ListUserResponse = {
|
||||
users: User[];
|
||||
_selfUrl?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type MessageType =
|
||||
| 'CRITICAL'
|
||||
| 'WARNING'
|
||||
| 'ACKNOWLEDGEMENT'
|
||||
| 'INFO'
|
||||
| 'RECOVERY';
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCall = {
|
||||
team?: OnCallTeamResource;
|
||||
oncallNow?: OnCallNowResource[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallEscalationPolicyResource = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallNowResource = {
|
||||
escalationPolicy?: OnCallEscalationPolicyResource;
|
||||
users?: OnCallUsersResource[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallsResponse = {
|
||||
teamsOnCall: OnCall[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallTeamResource = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallUser = {
|
||||
username?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type OnCallUsersResource = {
|
||||
onCalluser?: OnCallUser;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type RequestOptions = {
|
||||
method: string;
|
||||
headers: HeadersInit;
|
||||
body?: BodyInit;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type RoutingKey = {
|
||||
routingKey: string;
|
||||
targets: RoutingKeyTarget[];
|
||||
isDefault: boolean;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type RoutingKeyTarget = {
|
||||
policyName: string;
|
||||
policySlug: string;
|
||||
_teamUrl: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface SplunkOnCallApi {
|
||||
getEscalationPolicies(): Promise<EscalationPolicyInfo[]>;
|
||||
getIncidents(): Promise<Incident[]>;
|
||||
getOnCallUsers(): Promise<OnCall[]>;
|
||||
getRoutingKeys(): Promise<RoutingKey[]>;
|
||||
getTeams(): Promise<Team[]>;
|
||||
getUsers(): Promise<User[]>;
|
||||
incidentAction(request: TriggerAlarmRequest): Promise<Response>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export const splunkOnCallApiRef: ApiRef<SplunkOnCallApi>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "SplunkOnCallClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class SplunkOnCallClient implements SplunkOnCallApi {
|
||||
// Warning: (ae-forgotten-export) The symbol "ClientApiConfig" needs to be exported by the entry point index.d.ts
|
||||
constructor(config: ClientApiConfig);
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
configApi: ConfigApi,
|
||||
discoveryApi: DiscoveryApi,
|
||||
): SplunkOnCallClient;
|
||||
// Warning: (ae-forgotten-export) The symbol "EscalationPolicyInfo" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getEscalationPolicies(): Promise<EscalationPolicyInfo[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "Incident" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getIncidents(): Promise<Incident[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "OnCall" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getOnCallUsers(): Promise<OnCall[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "RoutingKey" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getRoutingKeys(): Promise<RoutingKey[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "Team" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getTeams(): Promise<Team[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "User" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
getUsers(): Promise<User[]>;
|
||||
// Warning: (ae-forgotten-export) The symbol "TriggerAlarmRequest" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
incidentAction({
|
||||
routingKey,
|
||||
@@ -79,8 +224,6 @@ export class SplunkOnCallClient implements SplunkOnCallApi {
|
||||
}: TriggerAlarmRequest): Promise<Response>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "SplunkOnCallPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const SplunkOnCallPage: {
|
||||
({ title, subtitle, pageTitle }: SplunkOnCallPageProps): JSX.Element;
|
||||
@@ -91,8 +234,13 @@ export const SplunkOnCallPage: {
|
||||
};
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "splunkOnCallPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type SplunkOnCallPageProps = {
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
pageTitle?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
const splunkOnCallPlugin: BackstagePlugin<
|
||||
{
|
||||
@@ -104,12 +252,42 @@ const splunkOnCallPlugin: BackstagePlugin<
|
||||
export { splunkOnCallPlugin as plugin };
|
||||
export { splunkOnCallPlugin };
|
||||
|
||||
// Warning: (ae-missing-release-tag) "UnauthorizedError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type Team = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
memberCount?: number;
|
||||
version?: number;
|
||||
isDefaultTeam?: boolean;
|
||||
_selfUrl?: string;
|
||||
_policiesUrl?: string;
|
||||
_membersUrl?: string;
|
||||
_adminsUrl?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type TriggerAlarmRequest = {
|
||||
routingKey?: string;
|
||||
incidentType: MessageType;
|
||||
incidentId?: string;
|
||||
incidentDisplayName?: string;
|
||||
incidentMessage?: string;
|
||||
incidentStartTime?: number;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export class UnauthorizedError extends Error {}
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/plugin.d.ts:7:5 - (ae-forgotten-export) The symbol "SplunkOnCallPageProps" needs to be exported by the entry point index.d.ts
|
||||
// @public (undocumented)
|
||||
export type User = {
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
displayName?: string;
|
||||
username?: string;
|
||||
email?: string;
|
||||
createdAt?: string;
|
||||
passwordLastUpdated?: string;
|
||||
verified?: boolean;
|
||||
_selfUrl?: string;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -39,12 +39,15 @@ import {
|
||||
ConfigApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export class UnauthorizedError extends Error {}
|
||||
|
||||
/** @public */
|
||||
export const splunkOnCallApiRef = createApiRef<SplunkOnCallApi>({
|
||||
id: 'plugin.splunk-on-call.api',
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export class SplunkOnCallClient implements SplunkOnCallApi {
|
||||
static fromConfig(configApi: ConfigApi, discoveryApi: DiscoveryApi) {
|
||||
const eventsRestEndpoint: string | null =
|
||||
|
||||
@@ -19,4 +19,4 @@ export {
|
||||
splunkOnCallApiRef,
|
||||
UnauthorizedError,
|
||||
} from './client';
|
||||
export type { SplunkOnCallApi } from './types';
|
||||
export * from './types';
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from '../components/types';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
|
||||
/** @public */
|
||||
export type MessageType =
|
||||
| 'CRITICAL'
|
||||
| 'WARNING'
|
||||
@@ -31,6 +32,7 @@ export type MessageType =
|
||||
| 'INFO'
|
||||
| 'RECOVERY';
|
||||
|
||||
/** @public */
|
||||
export type TriggerAlarmRequest = {
|
||||
routingKey?: string;
|
||||
incidentType: MessageType;
|
||||
@@ -40,6 +42,7 @@ export type TriggerAlarmRequest = {
|
||||
incidentStartTime?: number;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export interface SplunkOnCallApi {
|
||||
/**
|
||||
* Fetches a list of incidents
|
||||
@@ -77,33 +80,40 @@ export interface SplunkOnCallApi {
|
||||
getEscalationPolicies(): Promise<EscalationPolicyInfo[]>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export type EscalationPolicyResponse = {
|
||||
policies: EscalationPolicyInfo[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type ListUserResponse = {
|
||||
users: User[];
|
||||
_selfUrl?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type ListRoutingKeyResponse = {
|
||||
routingKeys: RoutingKey[];
|
||||
_selfUrl?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type IncidentsResponse = {
|
||||
incidents: Incident[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallsResponse = {
|
||||
teamsOnCall: OnCall[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type ClientApiConfig = {
|
||||
eventsRestEndpoint: string | null;
|
||||
discoveryApi: DiscoveryApi;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type RequestOptions = {
|
||||
method: string;
|
||||
headers: HeadersInit;
|
||||
|
||||
@@ -99,6 +99,7 @@ export const MissingEventsRestEndpoint = () => (
|
||||
</CardContent>
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const isSplunkOnCallAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_TEAM]) ||
|
||||
Boolean(entity.metadata.annotations?.[SPLUNK_ON_CALL_ROUTING_KEY]);
|
||||
|
||||
@@ -31,6 +31,7 @@ const useStyles = makeStyles(() => ({
|
||||
},
|
||||
}));
|
||||
|
||||
/** @public */
|
||||
export type SplunkOnCallPageProps = {
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type { SplunkOnCallPageProps } from './SplunkOnCallPage';
|
||||
export type { EntitySplunkOnCallCardProps } from './EntitySplunkOnCallCard';
|
||||
export { isSplunkOnCallAvailable } from './EntitySplunkOnCallCard';
|
||||
export * from './types';
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** @public */
|
||||
export type Team = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
@@ -26,34 +27,41 @@ export type Team = {
|
||||
_adminsUrl?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCall = {
|
||||
team?: OnCallTeamResource;
|
||||
oncallNow?: OnCallNowResource[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallTeamResource = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallNowResource = {
|
||||
escalationPolicy?: OnCallEscalationPolicyResource;
|
||||
users?: OnCallUsersResource[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallEscalationPolicyResource = {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallUsersResource = {
|
||||
onCalluser?: OnCallUser;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type OnCallUser = {
|
||||
username?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type User = {
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
@@ -66,8 +74,10 @@ export type User = {
|
||||
_selfUrl?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type IncidentPhase = 'UNACKED' | 'ACKED' | 'RESOLVED';
|
||||
|
||||
/** @public */
|
||||
export type Incident = {
|
||||
incidentNumber?: string;
|
||||
startTime?: string;
|
||||
@@ -92,11 +102,13 @@ export type Incident = {
|
||||
incidentLink?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EscalationPolicyInfo = {
|
||||
policy: EscalationPolicySummary;
|
||||
team?: EscalationPolicyTeam;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type IncidentTransition = {
|
||||
name?: string;
|
||||
at?: string;
|
||||
@@ -107,23 +119,27 @@ export type IncidentTransition = {
|
||||
alertUrl?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EscalationPolicySummary = {
|
||||
name: string;
|
||||
slug: string;
|
||||
_selfUrl: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EscalationPolicyTeam = {
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type RoutingKey = {
|
||||
routingKey: string;
|
||||
targets: RoutingKeyTarget[];
|
||||
isDefault: boolean;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type RoutingKeyTarget = {
|
||||
policyName: string;
|
||||
policySlug: string;
|
||||
|
||||
@@ -26,9 +26,5 @@ export {
|
||||
splunkOnCallPlugin as plugin,
|
||||
SplunkOnCallPage,
|
||||
} from './plugin';
|
||||
export { isSplunkOnCallAvailable } from './components/EntitySplunkOnCallCard';
|
||||
export {
|
||||
SplunkOnCallClient,
|
||||
splunkOnCallApiRef,
|
||||
UnauthorizedError,
|
||||
} from './api/client';
|
||||
export * from './components';
|
||||
export * from './api';
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
|
||||
export const rootRouteRef = createRouteRef({ id: 'splunk-on-call' });
|
||||
|
||||
/** @public */
|
||||
export const splunkOnCallPlugin = createPlugin({
|
||||
id: 'splunk-on-call',
|
||||
apis: [
|
||||
@@ -41,6 +42,7 @@ export const splunkOnCallPlugin = createPlugin({
|
||||
},
|
||||
});
|
||||
|
||||
/** @public */
|
||||
export const SplunkOnCallPage = splunkOnCallPlugin.provide(
|
||||
createRoutableExtension({
|
||||
name: 'SplunkOnCallPage',
|
||||
@@ -50,6 +52,7 @@ export const SplunkOnCallPage = splunkOnCallPlugin.provide(
|
||||
}),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export const EntitySplunkOnCallCard = splunkOnCallPlugin.provide(
|
||||
createComponentExtension({
|
||||
name: 'EntitySplunkOnCallCard',
|
||||
|
||||
Reference in New Issue
Block a user