2026-07-29 13:47:45 +00:00
|
|
|
// Connection configuration types
|
|
|
|
|
|
2026-07-29 18:27:27 +00:00
|
|
|
export type AuthMode = 'password' | 'token'
|
|
|
|
|
|
2026-08-13 01:02:33 +00:00
|
|
|
/** The kind of server a connection targets. Absent on persisted old
|
|
|
|
|
* connections, where it is treated as 'pve'. */
|
|
|
|
|
export type ServerType = 'pve' | 'pbs'
|
|
|
|
|
|
2026-07-29 13:47:45 +00:00
|
|
|
export interface ConnectionConfig {
|
|
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
primary: EndpointConfig
|
|
|
|
|
fallbacks: EndpointConfig[]
|
|
|
|
|
certFingerprint?: string
|
|
|
|
|
trusted: boolean
|
2026-08-09 23:01:51 +00:00
|
|
|
acceptUntrusted?: boolean
|
2026-07-29 13:47:45 +00:00
|
|
|
status: ConnectionStatus
|
|
|
|
|
clusterName?: string
|
2026-08-09 23:01:51 +00:00
|
|
|
clusterId?: string
|
2026-07-29 13:47:45 +00:00
|
|
|
isCluster: boolean
|
2026-07-29 18:27:27 +00:00
|
|
|
authMode: AuthMode
|
|
|
|
|
username?: string
|
2026-08-13 01:02:33 +00:00
|
|
|
/** The kind of server this connection targets ('pve' when absent). */
|
|
|
|
|
serverType?: ServerType
|
2026-08-09 23:01:51 +00:00
|
|
|
/** Nodes discovered in the cluster this connection is anchored on. */
|
|
|
|
|
nodes?: DiscoveredNode[]
|
|
|
|
|
/** The endpoint currently serving this connection (after failover). */
|
|
|
|
|
currentEndpointUrl?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A node discovered in the cluster connected through a connection. */
|
|
|
|
|
export interface DiscoveredNode {
|
|
|
|
|
name: string
|
|
|
|
|
url: string
|
|
|
|
|
status: 'online' | 'offline'
|
|
|
|
|
isPrimary: boolean
|
|
|
|
|
local: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** The outcome of a connect attempt, returned by `connect_to_server`. */
|
|
|
|
|
export interface ConnectResult {
|
|
|
|
|
connectionId: string
|
|
|
|
|
mergedInto: string | null
|
|
|
|
|
status: 'connected' | 'failover' | 'failed'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A snapshot of a connection's runtime state, returned by `get_connection_status`. */
|
|
|
|
|
export interface ConnectionStatusInfo {
|
|
|
|
|
connectionId: string
|
|
|
|
|
status: 'connected' | 'failover' | 'failed' | 'disconnected'
|
|
|
|
|
primaryUrl: string
|
|
|
|
|
currentEndpointUrl: string
|
|
|
|
|
nodes: DiscoveredNode[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface LoadConnectionsResult {
|
|
|
|
|
activeConnectionId: string | null
|
|
|
|
|
connections: ConnectionConfig[]
|
2026-07-29 13:47:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface EndpointConfig {
|
|
|
|
|
url: string // e.g., "https://192.168.1.10:8006"
|
|
|
|
|
node?: string // Node name (for display)
|
|
|
|
|
token?: string // API token (stored in keyring, not in config)
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-29 18:27:27 +00:00
|
|
|
export type ConnectionStatus =
|
2026-07-29 13:47:45 +00:00
|
|
|
| 'disconnected'
|
|
|
|
|
| 'connecting'
|
|
|
|
|
| 'connected'
|
|
|
|
|
| 'failed'
|
|
|
|
|
| 'failover'
|
|
|
|
|
|
|
|
|
|
export interface CertificateInfo {
|
|
|
|
|
fingerprint: string
|
|
|
|
|
issuer: string
|
|
|
|
|
subject: string
|
|
|
|
|
validFrom: string
|
|
|
|
|
validTo: string
|
|
|
|
|
selfSigned: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ConnectionCredentials {
|
|
|
|
|
connectionId: string
|
|
|
|
|
apiToken: string
|
|
|
|
|
}
|
2026-07-29 18:27:27 +00:00
|
|
|
|
|
|
|
|
export interface LoginResult {
|
|
|
|
|
connectionId: string
|
|
|
|
|
ticket: string
|
|
|
|
|
csrfToken: string
|
|
|
|
|
}
|