Debian Codegraph @

pkg/shell/machines/machines.d.ts

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 import { EventSource, EventMap } from "cockpit";
3
4 import { Manifests } from "../manifests";
5
6 export function generate_connection_string(user: string | null, port: string | null, addr: string) : string;
7 export function split_connection_string (conn_to: string) : { address: string, user?: string, port?: number };
8 export function get_init_superuser_for_options (options: {[key: string]: string }) : string | null;
9 export function host_superuser_storage_key (host?: string): string | null;
10
11 export interface Machine {
12 key: string;
13 connection_string: string;
14 address: string;
15 user?: string;
16 port?: number;
17 label: string;
18 color?: string;
19 state: null | "failed" | "connecting" | "connected";
20 manifests?: Manifests;
21 checksum?: string;
22 visible?: boolean;
23 problem: string | null;
24 restarting?: boolean;
25 }
26
27 interface MachinesEvents extends EventMap {
28 ready: () => void;
29 added: (machine: Machine) => void;
30 removed: (machine: Machine) => void;
31 updated: (machine: Machine) => void;
32 }
33
34 export interface Machines extends EventSource<MachinesEvents> {
35 ready: boolean;
36
37 lookup: (conection_string: string) => Machine;
38 list: Machine[];
39 change: (key: string, props: Partial<Machine>) => void;
40 }
41
42 interface Loader {
43 connect: (connection_string: string) => void;
44 expect_restart: (connection_string: string) => void;
45 }
46
47 export const machines: {
48 instance: () => Machines;
49 loader: (machines: Machines) => Loader;
50 };