import { createApiRef } from '@backstage/core-plugin-api'; export interface DeploymentSpec { name: string; namespace: string; source: { type: 'git' | 'image'; repository?: string; branch?: string; image?: string; tag?: string; }; resources: { cpu: string; memory: string; }; environment: Record; domain?: string; backup?: { enabled: boolean; schedule?: string; }; cluster?: string; } export interface Deployment { metadata: { name: string; namespace: string; creationTimestamp: string; }; spec: DeploymentSpec; status: { phase: 'Pending' | 'Running' | 'Failed' | 'Succeeded'; conditions: Array<{ type: string; status: string; reason?: string; message?: string; }>; ready: boolean; replicas?: number; readyReplicas?: number; }; } export interface ContainerMomApi { getDeployments(namespace?: string): Promise; getDeployment(namespace: string, name: string): Promise; createDeployment(spec: DeploymentSpec): Promise; updateDeployment(namespace: string, name: string, spec: DeploymentSpec): Promise; deleteDeployment(namespace: string, name: string): Promise; getLogs(namespace: string, name: string, container?: string): Promise; getTemplates(): Promise; } export interface Template { name: string; description: string; parameters: TemplateParameter[]; spec: Partial; } export interface TemplateParameter { name: string; type: 'string' | 'number' | 'boolean' | 'select'; description: string; required: boolean; default?: any; options?: string[]; } export const containerMomApiRef = createApiRef({ id: 'plugin.deployments.api', });