/**
 * Mutating serverless (Vapor-style) operations for the management cockpit:
 * redeploy, rollback, maintenance mode, Aurora scaling, CloudFront asset
 * invalidation, SQS queue purge, dead-letter-queue viewing + redrive, and
 * Secrets Manager editing.
 *
 * The catalog (`buildServerlessOperations`) is derived purely from the cloud
 * config + resolved dashboard data so it is trivially unit-testable; the runner
 * dispatches each op to the existing serverless-app helpers (which perform the
 * real AWS calls) and returns a structured result (never throws on a remote
 * failure). DLQ + secrets are exposed as dedicated helpers because they carry
 * their own payloads (messages / values) rather than a fixed confirm token.
 */
import type { CloudConfig, EnvironmentType } from '@ts-cloud/core';
export type ServerlessOperationGroup = 'deploy' | 'maintenance' | 'assets' | 'database' | 'queue';
export interface ServerlessOperationInput {
    name: string;
    label: string;
    placeholder?: string;
}
export interface ServerlessOperation {
    id: string;
    label: string;
    group: ServerlessOperationGroup;
    target: string;
    mutates: boolean;
    /** Token the operator must type to run a mutating operation. */
    confirm: string;
    /** Destructive operations rendered with a danger affordance. */
    danger?: boolean;
    /** Extra operator-supplied inputs (e.g. Aurora min/max ACUs). */
    inputs?: ServerlessOperationInput[];
}
export interface ServerlessOperationResult {
    operation: string;
    command?: string;
    ok: boolean;
    stdout?: string;
    error?: string;
}
/**
 * Build the serverless operation catalog from config + live data. Pure: every
 * operation here is runnable by {@link runServerlessOperation}.
 */
export declare function buildServerlessOperations(config: CloudConfig, environment: EnvironmentType, data: Record<string, any>): ServerlessOperation[];
export declare function resolveServerlessOperation(id: string, config: CloudConfig, environment: EnvironmentType, data: Record<string, any>): ServerlessOperation | undefined;
export interface RunServerlessOperationOptions {
    /** For db:scale — the requested Aurora min/max ACUs. */
    min?: number;
    max?: number;
}
/**
 * Run a serverless operation over the live AWS environment. Returns a structured
 * result; a remote failure is captured as `{ ok: false, error }` rather than
 * thrown, so the cockpit always renders an outcome.
 */
export declare function runServerlessOperation(config: CloudConfig, environment: EnvironmentType, operation: ServerlessOperation, options?: RunServerlessOperationOptions): Promise<ServerlessOperationResult>;
/** Run an arbitrary app command via the CLI function (Vapor-style command runner). */
export declare function runServerlessCommand(config: CloudConfig, environment: EnvironmentType, command: string): Promise<ServerlessOperationResult>;
export interface DlqMessage {
    id: string;
    receiptHandle: string;
    body: string;
}
/** Peek at DLQ messages (visibility restored quickly so they aren't consumed). */
export declare function listDlqMessages(config: CloudConfig, environment: EnvironmentType, max?: number): Promise<{
    ok: boolean;
    messages: DlqMessage[];
    error?: string;
}>;
/**
 * Redrive up to `max` messages from the DLQ back onto a source queue (receive →
 * send → delete). `targetQueue` is a configured queue short-name; it defaults to
 * the first resolved queue for the app.
 */
export declare function redriveDlq(config: CloudConfig, environment: EnvironmentType, opts?: {
    max?: number;
    targetQueue?: string;
}): Promise<ServerlessOperationResult>;
/** Purge every message from the DLQ (destructive). */
export declare function purgeDlq(config: CloudConfig, environment: EnvironmentType): Promise<ServerlessOperationResult>;
/** The Secrets Manager ids the app references (from `app.secrets`). */
export declare function configuredSecretIds(config: CloudConfig, environment: EnvironmentType): Array<{
    key: string;
    secretId: string;
}>;
/**
 * Set (create or update) a Secrets Manager value. The change takes effect on the
 * next deploy (function env is injected at deploy time), so the caller should
 * surface that redeploy hint.
 */
export declare function setServerlessSecret(config: CloudConfig, environment: EnvironmentType, secretId: string, value: string): Promise<ServerlessOperationResult>;
/** Delete a Secrets Manager entry (scheduled deletion; recoverable for 7 days). */
export declare function deleteServerlessSecret(config: CloudConfig, environment: EnvironmentType, secretId: string): Promise<ServerlessOperationResult>;
/**
 * Update a function's memory and/or timeout. `mode` is one of the app's function
 * modes (http/queue/cli). Memory takes effect immediately; the change is also
 * re-applied on the next deploy from config.
 */
export declare function updateFunctionConfig(config: CloudConfig, environment: EnvironmentType, mode: string, opts: {
    memory?: number;
    timeout?: number;
}): Promise<ServerlessOperationResult>;
export interface AlarmMetricPreset {
    key: string;
    label: string;
    namespace: string;
    metricName: string;
    statistic: 'Sum' | 'Average' | 'Maximum' | 'Minimum';
    comparison: string;
    /** Function mode this metric attaches to (http/queue/cli), or undefined for account-wide. */
    fnMode?: 'http' | 'queue' | 'cli';
    unit: string;
}
/** The alarm metrics an operator can arm from the dashboard. */
export declare const ALARM_PRESETS: AlarmMetricPreset[];
export declare function resolveAlarmPreset(key: string): AlarmMetricPreset | undefined;
/** List the alarms ts-cloud manages for this environment (name-prefixed). */
export declare function listAlarms(config: CloudConfig, environment: EnvironmentType): Promise<{
    ok: boolean;
    alarms: any[];
    presets: AlarmMetricPreset[];
    error?: string;
}>;
/** Create (or update) an alarm from a preset + threshold. */
export declare function createAlarm(config: CloudConfig, environment: EnvironmentType, presetKey: string, threshold: number): Promise<ServerlessOperationResult>;
/** Delete an alarm by name (guarded to this project's prefix). */
export declare function deleteAlarm(config: CloudConfig, environment: EnvironmentType, alarmName: string): Promise<ServerlessOperationResult>;
export interface ShapedTrace {
    id: string;
    timestamp?: string;
    durationMs: number;
    responseMs: number;
    status: 'ok' | 'error' | 'fault' | 'throttle';
    method: string;
    url: string;
    httpStatus: number;
}
/**
 * List recent X-Ray trace summaries for the app's HTTP function (falling back to
 * all traces in the window when the service filter returns nothing). Requires
 * tracing to be enabled on the functions; returns an empty, ok:false result with
 * a hint otherwise.
 */
export declare function listTraces(config: CloudConfig, environment: EnvironmentType, minutes?: number): Promise<{
    ok: boolean;
    traces: ShapedTrace[];
    error?: string;
}>;
/** Enable, disable, or run-now the serverless scheduler. */
export declare function controlScheduler(config: CloudConfig, environment: EnvironmentType, action: 'enable' | 'disable' | 'run'): Promise<ServerlessOperationResult>;
