diff --git a/plugins/lighthouse-backend/api-report.md b/plugins/lighthouse-backend/api-report.md index fe8aa19966..48251e3f6e 100644 --- a/plugins/lighthouse-backend/api-report.md +++ b/plugins/lighthouse-backend/api-report.md @@ -1,286 +1,27 @@ -## API Report File for "@backstage/plugin-kubernetes-common" +## API Report File for "@backstage/plugin-lighthouse-backend" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { Entity } from '@backstage/catalog-model'; -import type { JsonObject } from '@backstage/types'; -import { PodStatus } from '@kubernetes/client-node'; -import { V1ConfigMap } from '@kubernetes/client-node'; -import { V1CronJob } from '@kubernetes/client-node'; -import { V1DaemonSet } from '@kubernetes/client-node'; -import { V1Deployment } from '@kubernetes/client-node'; -import { V1HorizontalPodAutoscaler } from '@kubernetes/client-node'; -import { V1Ingress } from '@kubernetes/client-node'; -import { V1Job } from '@kubernetes/client-node'; -import { V1LimitRange } from '@kubernetes/client-node'; -import { V1Pod } from '@kubernetes/client-node'; -import { V1ReplicaSet } from '@kubernetes/client-node'; -import { V1Service } from '@kubernetes/client-node'; -import { V1StatefulSet } from '@kubernetes/client-node'; +import { CatalogClient } from '@backstage/catalog-client'; +import { Config } from '@backstage/config'; +import { Logger } from 'winston'; +import { PluginTaskScheduler } from '@backstage/backend-tasks'; // @public (undocumented) -export type AuthProviderType = 'google' | 'serviceAccount' | 'aws' | 'azure'; +export function create(options: Options): Promise; // @public (undocumented) -export interface ClientContainerStatus { +export interface Options { // (undocumented) - container: string; + catalogClient: CatalogClient; // (undocumented) - cpuUsage: ClientCurrentResourceUsage; + config: Config; // (undocumented) - memoryUsage: ClientCurrentResourceUsage; + logger: Logger; + // (undocumented) + scheduler?: PluginTaskScheduler; } -// @public (undocumented) -export interface ClientCurrentResourceUsage { - // (undocumented) - currentUsage: number | string; - // (undocumented) - limitTotal: number | string; - // (undocumented) - requestTotal: number | string; -} - -// @public (undocumented) -export interface ClientPodStatus { - // (undocumented) - containers: ClientContainerStatus[]; - // (undocumented) - cpu: ClientCurrentResourceUsage; - // (undocumented) - memory: ClientCurrentResourceUsage; - // (undocumented) - pod: V1Pod; -} - -// @public (undocumented) -export interface ClusterAttributes { - dashboardApp?: string; - dashboardParameters?: JsonObject; - dashboardUrl?: string; - name: string; -} - -// @public (undocumented) -export interface ClusterObjects { - // (undocumented) - cluster: ClusterAttributes; - // (undocumented) - errors: KubernetesFetchError[]; - // (undocumented) - podMetrics: ClientPodStatus[]; - // (undocumented) - resources: FetchResponse[]; -} - -// @public (undocumented) -export interface ConfigMapFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'configmaps'; -} - -// @public (undocumented) -export interface CronJobsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'cronjobs'; -} - -// @public (undocumented) -export interface CustomObjectsByEntityRequest { - // (undocumented) - auth: KubernetesRequestAuth; - // (undocumented) - customResources: CustomResourceMatcher[]; - // (undocumented) - entity: Entity; -} - -// @public (undocumented) -export interface CustomResourceFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'customresources'; -} - -// @public (undocumented) -export interface CustomResourceMatcher { - // (undocumented) - apiVersion: string; - // (undocumented) - group: string; - // (undocumented) - plural: string; -} - -// @public (undocumented) -export interface DaemonSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'daemonsets'; -} - -// @public (undocumented) -export interface DeploymentFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'deployments'; -} - -// @public (undocumented) -export type FetchResponse = - | PodFetchResponse - | ServiceFetchResponse - | ConfigMapFetchResponse - | DeploymentFetchResponse - | LimitRangeFetchReponse - | ReplicaSetsFetchResponse - | HorizontalPodAutoscalersFetchResponse - | JobsFetchResponse - | CronJobsFetchResponse - | IngressesFetchResponse - | CustomResourceFetchResponse - | StatefulSetsFetchResponse - | DaemonSetsFetchResponse - | PodStatusFetchResponse; - -// @public (undocumented) -export interface HorizontalPodAutoscalersFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'horizontalpodautoscalers'; -} - -// @public (undocumented) -export interface IngressesFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'ingresses'; -} - -// @public (undocumented) -export interface JobsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'jobs'; -} - -// @public (undocumented) -export type KubernetesErrorTypes = - | 'BAD_REQUEST' - | 'UNAUTHORIZED_ERROR' - | 'NOT_FOUND' - | 'SYSTEM_ERROR' - | 'UNKNOWN_ERROR'; - -// @public (undocumented) -export type KubernetesFetchError = StatusError | RawFetchError; - -// @public (undocumented) -export interface KubernetesRequestAuth { - // (undocumented) - google?: string; - // (undocumented) - oidc?: { - [key: string]: string; - }; -} - -// @public (undocumented) -export interface KubernetesRequestBody { - // (undocumented) - auth?: KubernetesRequestAuth; - // (undocumented) - entity: Entity; -} - -// @public (undocumented) -export interface LimitRangeFetchReponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'limitranges'; -} - -// @public (undocumented) -export interface ObjectsByEntityResponse { - // (undocumented) - items: ClusterObjects[]; -} - -// @public (undocumented) -export interface PodFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'pods'; -} - -// @public (undocumented) -export interface PodStatusFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'podstatus'; -} - -// @public (undocumented) -export interface RawFetchError { - // (undocumented) - errorType: 'FETCH_ERROR'; - // (undocumented) - message: string; -} - -// @public (undocumented) -export interface ReplicaSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'replicasets'; -} - -// @public (undocumented) -export interface ServiceFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'services'; -} - -// @public (undocumented) -export interface StatefulSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'statefulsets'; -} - -// @public (undocumented) -export interface StatusError { - // (undocumented) - errorType: KubernetesErrorTypes; - // (undocumented) - resourcePath?: string; - // (undocumented) - statusCode?: number; -} - -// @public (undocumented) -export interface WorkloadsByEntityRequest { - // (undocumented) - auth: KubernetesRequestAuth; - // (undocumented) - entity: Entity; -} +// (No @packageDocumentation comment for this package) ``` diff --git a/plugins/lighthouse-backend/src/service/plugin.ts b/plugins/lighthouse-backend/src/service/plugin.ts index 8a89a9f18b..c2baf9fbf5 100644 --- a/plugins/lighthouse-backend/src/service/plugin.ts +++ b/plugins/lighthouse-backend/src/service/plugin.ts @@ -25,14 +25,14 @@ import { LighthouseRestApi } from '@backstage/plugin-lighthouse-common'; import { stringifyEntityRef } from '@backstage/catalog-model'; import { LighthouseAuditScheduleImpl } from '../config'; -export interface RouterOptions { +export interface Options { logger: Logger; config: Config; scheduler?: PluginTaskScheduler; catalogClient: CatalogClient; } -export async function create(options: RouterOptions) { +export async function create(options: Options) { const { logger, scheduler, catalogClient, config } = options; const lighthouseApi = LighthouseRestApi.fromConfig(config); diff --git a/plugins/lighthouse-common/api-report.md b/plugins/lighthouse-common/api-report.md index fe8aa19966..8589c20d2a 100644 --- a/plugins/lighthouse-common/api-report.md +++ b/plugins/lighthouse-common/api-report.md @@ -1,286 +1,161 @@ -## API Report File for "@backstage/plugin-kubernetes-common" +## API Report File for "@backstage/plugin-lighthouse-common" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts -import { Entity } from '@backstage/catalog-model'; -import type { JsonObject } from '@backstage/types'; -import { PodStatus } from '@kubernetes/client-node'; -import { V1ConfigMap } from '@kubernetes/client-node'; -import { V1CronJob } from '@kubernetes/client-node'; -import { V1DaemonSet } from '@kubernetes/client-node'; -import { V1Deployment } from '@kubernetes/client-node'; -import { V1HorizontalPodAutoscaler } from '@kubernetes/client-node'; -import { V1Ingress } from '@kubernetes/client-node'; -import { V1Job } from '@kubernetes/client-node'; -import { V1LimitRange } from '@kubernetes/client-node'; -import { V1Pod } from '@kubernetes/client-node'; -import { V1ReplicaSet } from '@kubernetes/client-node'; -import { V1Service } from '@kubernetes/client-node'; -import { V1StatefulSet } from '@kubernetes/client-node'; +import { Config } from '@backstage/config'; // @public (undocumented) -export type AuthProviderType = 'google' | 'serviceAccount' | 'aws' | 'azure'; +export type Audit = AuditRunning | AuditFailed | AuditCompleted; // @public (undocumented) -export interface ClientContainerStatus { +export interface AuditBase { // (undocumented) - container: string; + id: string; // (undocumented) - cpuUsage: ClientCurrentResourceUsage; + timeCreated: string; // (undocumented) - memoryUsage: ClientCurrentResourceUsage; + url: string; } // @public (undocumented) -export interface ClientCurrentResourceUsage { +export interface AuditCompleted extends AuditBase { // (undocumented) - currentUsage: number | string; + categories: Record; // (undocumented) - limitTotal: number | string; + report: Object; // (undocumented) - requestTotal: number | string; + status: 'COMPLETED'; + // (undocumented) + timeCompleted: string; } // @public (undocumented) -export interface ClientPodStatus { +export interface AuditFailed extends AuditBase { // (undocumented) - containers: ClientContainerStatus[]; + status: 'FAILED'; // (undocumented) - cpu: ClientCurrentResourceUsage; - // (undocumented) - memory: ClientCurrentResourceUsage; - // (undocumented) - pod: V1Pod; + timeCompleted: string; } // @public (undocumented) -export interface ClusterAttributes { - dashboardApp?: string; - dashboardParameters?: JsonObject; - dashboardUrl?: string; - name: string; +export interface AuditRunning extends AuditBase { + // (undocumented) + status: 'RUNNING'; } // @public (undocumented) -export interface ClusterObjects { +export class FetchError extends Error { // (undocumented) - cluster: ClusterAttributes; + static forResponse(resp: Response): Promise; // (undocumented) - errors: KubernetesFetchError[]; - // (undocumented) - podMetrics: ClientPodStatus[]; - // (undocumented) - resources: FetchResponse[]; + get name(): string; } // @public (undocumented) -export interface ConfigMapFetchResponse { +export type FormFactor = 'mobile' | 'desktop'; + +// @public (undocumented) +export interface LASListRequest { // (undocumented) - resources: Array; + limit?: number; // (undocumented) - type: 'configmaps'; + offset?: number; } // @public (undocumented) -export interface CronJobsFetchResponse { +export interface LASListResponse { // (undocumented) - resources: Array; + items: Item[]; // (undocumented) - type: 'cronjobs'; + limit: number; + // (undocumented) + offset: number; + // (undocumented) + total: number; } // @public (undocumented) -export interface CustomObjectsByEntityRequest { +export type LighthouseApi = { + url: string; + getWebsiteList: (listOptions: LASListRequest) => Promise; + getWebsiteForAuditId: (auditId: string) => Promise; + triggerAudit: (payload: TriggerAuditPayload) => Promise; + getWebsiteByUrl: (websiteUrl: string) => Promise; +}; + +// @public (undocumented) +export interface LighthouseCategoryAbbr { // (undocumented) - auth: KubernetesRequestAuth; + id: LighthouseCategoryId; // (undocumented) - customResources: CustomResourceMatcher[]; + score: number; // (undocumented) - entity: Entity; + title: string; } // @public (undocumented) -export interface CustomResourceFetchResponse { +export type LighthouseCategoryId = + | 'pwa' + | 'seo' + | 'performance' + | 'accessibility' + | 'best-practices'; + +// @public (undocumented) +export type LighthouseConfigSettings = { + formFactor: FormFactor; + screenEmulation: + | { + mobile: boolean; + width: number; + height: number; + deviceScaleFactor: number; + disabled: boolean; + } + | undefined; + emulatedFormFactor: FormFactor; +}; + +// @public (undocumented) +export class LighthouseRestApi implements LighthouseApi { + constructor(url: string); // (undocumented) - resources: Array; + static fromConfig(config: Config): LighthouseRestApi; // (undocumented) - type: 'customresources'; + getWebsiteByUrl(websiteUrl: string): Promise; + // (undocumented) + getWebsiteForAuditId(auditId: string): Promise; + // (undocumented) + getWebsiteList(options?: LASListRequest): Promise; + // (undocumented) + triggerAudit(payload: TriggerAuditPayload): Promise; + // (undocumented) + url: string; } // @public (undocumented) -export interface CustomResourceMatcher { +export interface TriggerAuditPayload { // (undocumented) - apiVersion: string; - // (undocumented) - group: string; - // (undocumented) - plural: string; -} - -// @public (undocumented) -export interface DaemonSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'daemonsets'; -} - -// @public (undocumented) -export interface DeploymentFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'deployments'; -} - -// @public (undocumented) -export type FetchResponse = - | PodFetchResponse - | ServiceFetchResponse - | ConfigMapFetchResponse - | DeploymentFetchResponse - | LimitRangeFetchReponse - | ReplicaSetsFetchResponse - | HorizontalPodAutoscalersFetchResponse - | JobsFetchResponse - | CronJobsFetchResponse - | IngressesFetchResponse - | CustomResourceFetchResponse - | StatefulSetsFetchResponse - | DaemonSetsFetchResponse - | PodStatusFetchResponse; - -// @public (undocumented) -export interface HorizontalPodAutoscalersFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'horizontalpodautoscalers'; -} - -// @public (undocumented) -export interface IngressesFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'ingresses'; -} - -// @public (undocumented) -export interface JobsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'jobs'; -} - -// @public (undocumented) -export type KubernetesErrorTypes = - | 'BAD_REQUEST' - | 'UNAUTHORIZED_ERROR' - | 'NOT_FOUND' - | 'SYSTEM_ERROR' - | 'UNKNOWN_ERROR'; - -// @public (undocumented) -export type KubernetesFetchError = StatusError | RawFetchError; - -// @public (undocumented) -export interface KubernetesRequestAuth { - // (undocumented) - google?: string; - // (undocumented) - oidc?: { - [key: string]: string; + options: { + lighthouseConfig: { + settings: LighthouseConfigSettings; + }; }; + // (undocumented) + url: string; } // @public (undocumented) -export interface KubernetesRequestBody { +export interface Website { // (undocumented) - auth?: KubernetesRequestAuth; + audits: Audit[]; // (undocumented) - entity: Entity; + lastAudit: Audit; + // (undocumented) + url: string; } // @public (undocumented) -export interface LimitRangeFetchReponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'limitranges'; -} - -// @public (undocumented) -export interface ObjectsByEntityResponse { - // (undocumented) - items: ClusterObjects[]; -} - -// @public (undocumented) -export interface PodFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'pods'; -} - -// @public (undocumented) -export interface PodStatusFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'podstatus'; -} - -// @public (undocumented) -export interface RawFetchError { - // (undocumented) - errorType: 'FETCH_ERROR'; - // (undocumented) - message: string; -} - -// @public (undocumented) -export interface ReplicaSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'replicasets'; -} - -// @public (undocumented) -export interface ServiceFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'services'; -} - -// @public (undocumented) -export interface StatefulSetsFetchResponse { - // (undocumented) - resources: Array; - // (undocumented) - type: 'statefulsets'; -} - -// @public (undocumented) -export interface StatusError { - // (undocumented) - errorType: KubernetesErrorTypes; - // (undocumented) - resourcePath?: string; - // (undocumented) - statusCode?: number; -} - -// @public (undocumented) -export interface WorkloadsByEntityRequest { - // (undocumented) - auth: KubernetesRequestAuth; - // (undocumented) - entity: Entity; -} +export type WebsiteListResponse = LASListResponse; ```