import type { DeployServices } from "../serviceFactory.js"; import type { ECSServiceInfo, EcsServicesDescription } from "../../services/infrastructure/EcsService.js"; import type { LambdaFunctionImage } from "../../services/infrastructure/LambdaService.js"; export interface RolledEcsService { readonly serviceName: string; readonly clusterArn: string; readonly serviceArn: string; /** The revision the lane registered and pointed the service at. */ readonly taskDefinitionArn: string; readonly imageTag: string; } export interface RolledLambdaFunction { readonly functionName: string; readonly imageKey: string; readonly imageTag: string; readonly repoUri: string; /** The digest the lane applied, exactly as it applied it. */ readonly imageDigest: string; } export interface RollbackRestoreSet { readonly ecs: readonly RolledEcsService[]; readonly lambda: readonly RolledLambdaFunction[]; } /** * Where an entity runs now, against what the lane applied. `from` is what it * runs instead; `reason` is pre-masked at construction. */ export type RolledState = { readonly kind: "unmoved"; } | { readonly kind: "moved"; readonly from: string; } | { readonly kind: "unread"; readonly reason: string; }; /** A function's state, with what a write back needs when it moved. */ export type LambdaRolledState = Exclude | { readonly kind: "moved"; readonly from: string; readonly lastUpdateStatus: "Successful" | "Failed"; readonly revisionId: string; }; export type RolledEntityRead = { readonly kind: "ecs"; readonly service: RolledEcsService; readonly state: RolledState; } | { readonly kind: "lambda"; readonly fn: RolledLambdaFunction; readonly state: LambdaRolledState; }; /** Each entity of a set, services first in the lane's order, then functions. */ export type RolledStateRead = { readonly kind: "read"; readonly entities: readonly RolledEntityRead[]; } | { readonly kind: "cancelled"; }; export type RestoreServices = Pick; /** How a message names the entity. */ export declare function entityLabel(read: RolledEntityRead): string; /** The id CloudFormation's events give it: a service's ARN, a function's name. */ export declare function entityPhysicalId(read: RolledEntityRead): string; /** What the lane applied: a service's revision, a function's digest. */ export declare function laneImage(read: RolledEntityRead): string; /** * Read where each entity of `set` runs now. A failed read is `unread`, never * `unmoved`, and a read the caller's cancel cut short is `cancelled`. */ export declare function readRolledState(services: RestoreServices, set: RollbackRestoreSet, abortSignal: AbortSignal | undefined): Promise; /** One service as ECS described it: by its own ARNs, never by its name. */ export declare function describedService(service: RolledEcsService, description: EcsServicesDescription): ECSServiceInfo | undefined; /** * A function's state from GetFunction. A failed last update is moved, so the * lane's image is applied again. A write back is held to the revision read, * so a function read without one is unread rather than written blind. */ export declare function functionState(fn: RolledLambdaFunction, image: LambdaFunctionImage): LambdaRolledState;