Documentation
¶
Overview ¶
internal/models/health_models.go
internal/models/models.go
internal/models/ssh_models.go
internal/models/user_models.go
Index ¶
- type CACreateRequest
- type CPUMetrics
- type CaptureCloseAllResponse
- type CapturePacketflixRequest
- type CapturePacketflixResponse
- type CapturePacketflixURI
- type CaptureTarget
- type CaptureWiresharkVncCreateResponse
- type CaptureWiresharkVncReadyResponse
- type CaptureWiresharkVncRequest
- type CaptureWiresharkVncSession
- type CertResponse
- type CertSignRequest
- type ClabContainerInfo
- type ClabExecInternalResult
- type ClabInspectInterfacesOutput
- type ClabInspectOutput
- type ClabInspectOutputDetails
- type ContainerLogInfo
- type CustomIconInfo
- type CustomNodeDefaultRequest
- type CustomNodeTemplate
- type CustomNodesReplaceRequest
- type CustomNodesResponse
- type DeployRequest
- type DisableTxOffloadRequest
- type DiskMetrics
- type DrawioGenerateRequest
- type DrawioGenerateResponse
- type EdgeSharkStatusResponse
- type ErrorResponse
- type EventAttributes
- type EventResponse
- type ExecRequest
- type ExecResponse
- type FcliCommandRequest
- type FcliCommandResponse
- type GenerateNodeTier
- type GenerateRequest
- type GenerateResponse
- type GenericSuccessResponse
- type HealthResponse
- type IconListResponse
- type IconReconcileRequest
- type IconUploadRequest
- type IconUploadResponse
- type ImportTopologyFromURLRequest
- type ImportTopologyFromURLResponse
- type InterfaceInfo
- type InterfaceStatsAttributes
- type InterfaceStatsEvent
- type LogLine
- type LoginRequest
- type LoginResponse
- type LogsResponse
- type MemMetrics
- type Metrics
- type MetricsResponse
- type NetemInterfaceInfo
- type NetemResetRequest
- type NetemSetRequest
- type NetemShowResponse
- type NodeBrowserPort
- type NodeBrowserPortsResponse
- type NodeInterfaceInfo
- type PasswordChangeRequest
- type RedeployRequest
- type RuntimeImageActionResponse
- type RuntimeImagePullRequest
- type RuntimeImageSummary
- type RuntimeImagesResponse
- type SSHAccessRequest
- type SSHAccessResponse
- type SSHSessionInfo
- type SaveConfigResponse
- type ServerInfo
- type ShareToolResponse
- type SimpleSuccessResponse
- type TerminalProtocol
- type TerminalSessionInfo
- type TerminalSessionRequest
- type TerminalSessionResponse
- type TopologyDocEventResponse
- type TopologyEntry
- type TopologyFileRenameRequest
- type UserCreateRequest
- type UserDetails
- type UserUpdateRequest
- type VersionCheckResponse
- type VersionResponse
- type VethCreateRequest
- type VxlanCreateRequest
- type WorkspaceDirectoryRequest
- type WorkspaceFileEntry
- type WorkspaceFileEventResponse
- type WorkspaceFileRenameRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CACreateRequest ¶
type CACreateRequest struct {
Name string `json:"name,omitempty" example:"my-root-ca"` // Defaults to "ca" if empty
Expiry string `json:"expiry,omitempty" example:"8760h"` // Duration string, defaults to "87600h" (10 years)
CommonName string `json:"commonName,omitempty" example:"ca.example.com"` // Defaults to "containerlab.dev"
Country string `json:"country,omitempty" example:"US"` // Defaults to "Internet"
Locality string `json:"locality,omitempty" example:"City"` // Defaults to "Server"
Organization string `json:"organization,omitempty" example:"MyOrg"` // Defaults to "Containerlab"
OrgUnit string `json:"orgUnit,omitempty" example:"IT"` // Defaults to "Containerlab Tools"
}
CACreateRequest mirrors flags for `clab tools cert ca create`
type CPUMetrics ¶ added in v0.1.4
type CPUMetrics struct {
UsagePercent float64 `json:"usagePercent"` // Overall CPU usage percentage
NumCPU int `json:"numCPU"` // Number of CPUs/cores
LoadAvg1 float64 `json:"loadAvg1,omitempty"` // 1-minute load average
LoadAvg5 float64 `json:"loadAvg5,omitempty"` // 5-minute load average
LoadAvg15 float64 `json:"loadAvg15,omitempty"` // 15-minute load average
ProcessPercent float64 `json:"processPercent,omitempty"` // This process's CPU usage
}
CPUMetrics represents CPU usage information
type CaptureCloseAllResponse ¶ added in v0.3.0
type CapturePacketflixRequest ¶ added in v0.3.0
type CapturePacketflixRequest struct {
Targets []CaptureTarget `json:"targets" binding:"required,min=1"`
RemoteHostname string `json:"remoteHostname,omitempty"`
}
type CapturePacketflixResponse ¶ added in v0.3.0
type CapturePacketflixResponse struct {
Captures []CapturePacketflixURI `json:"captures"`
}
type CapturePacketflixURI ¶ added in v0.3.0
type CaptureTarget ¶ added in v0.3.0
type CaptureWiresharkVncCreateResponse ¶ added in v0.3.0
type CaptureWiresharkVncCreateResponse struct {
Sessions []CaptureWiresharkVncSession `json:"sessions"`
}
type CaptureWiresharkVncReadyResponse ¶ added in v0.3.0
type CaptureWiresharkVncRequest ¶ added in v0.3.0
type CaptureWiresharkVncRequest struct {
Targets []CaptureTarget `json:"targets" binding:"required,min=1"`
Theme string `json:"theme,omitempty"`
}
type CaptureWiresharkVncSession ¶ added in v0.3.0
type CaptureWiresharkVncSession struct {
SessionID string `json:"sessionId"`
LabName string `json:"labName"`
ContainerName string `json:"containerName"`
InterfaceNames []string `json:"interfaceNames"`
VncPath string `json:"vncPath"`
ShowVolumeTip bool `json:"showVolumeTip"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
type CertResponse ¶
type CertResponse struct {
Message string `json:"message"`
CertPath string `json:"certPath,omitempty"` // e.g., "my-root-ca/my-root-ca.pem" or "my-root-ca/node1.example.com.pem"
KeyPath string `json:"keyPath,omitempty"` // e.g., "my-root-ca/my-root-ca.key" or "my-root-ca/node1.example.com.key"
CSRPath string `json:"csrPath,omitempty"` // e.g., "my-root-ca/my-root-ca.csr" or "my-root-ca/node1.example.com.csr"
}
CertResponse provides paths to the generated certificate files (relative to user's cert dir)
type CertSignRequest ¶
type CertSignRequest struct {
Name string `json:"name" binding:"required" example:"node1.example.com"` // Required
Hosts []string `json:"hosts" binding:"required"` // SANs (DNS names or IPs), comma-separated in clab, array here
CaName string `json:"caName" binding:"required" example:"my-root-ca"` // Name of the CA cert/key files (without .pem/.key) previously generated
CommonName string `json:"commonName,omitempty" example:"node1.example.com"` // Defaults to Name if empty
Country string `json:"country,omitempty" example:"US"` // Defaults to "Internet"
Locality string `json:"locality,omitempty" example:"City"` // Defaults to "Server"
Organization string `json:"organization,omitempty" example:"MyOrg"` // Defaults to "Containerlab"
OrgUnit string `json:"orgUnit,omitempty" example:"Nodes"` // Defaults to "Containerlab Tools"
KeySize int `json:"keySize,omitempty" example:"4096"` // Defaults to 2048
}
CertSignRequest mirrors flags for `clab tools cert sign`
type ClabContainerInfo ¶
type ClabContainerInfo struct {
Name string `json:"name"` // Name of the container node (e.g., "lab01-client1")
ContainerID string `json:"container_id"` // Docker container ID (short)
Image string `json:"image"` // Container image used
Kind string `json:"kind"` // e.g., "linux", "nokia_srlinux"
State string `json:"state"` // e.g., "running"
Status string `json:"status"` // e.g., "Up 18 hours"
IPv4Address string `json:"ipv4_address"` // Management IPv4 Address/Mask
IPv6Address string `json:"ipv6_address"` // Management IPv6 Address/Mask
LabName string `json:"lab_name"` // Name of the lab this node belongs to (redundant with map key but present)
NodeName string `json:"nodeName"` // Topology node name from containerlab labels
LabPath string `json:"labPath"` // Path to the topology file used (relative)
AbsLabPath string `json:"absLabPath"` // Absolute path to topology file
Group string `json:"group"` // Group assigned in topology (Might not always be present)
Owner string `json:"owner"` // OS user from clab inspect output (Used for authorization)
}
ClabContainerInfo matches the structure of each item in the "Containers" array
type ClabExecInternalResult ¶
type ClabExecInternalResult struct {
Cmd []string `json:"cmd"` // The command and its arguments as executed
ReturnCode int `json:"return-code"` // Exit code of the command inside the container
Stdout string `json:"stdout"` // Standard output of the command
Stderr string `json:"stderr"` // Standard error of the command
}
ClabExecInternalResult matches the structure within the array in clab's JSON output. It contains details about a single command execution attempt on a node.
type ClabInspectInterfacesOutput ¶
type ClabInspectInterfacesOutput []NodeInterfaceInfo
ClabInspectInterfacesOutput is the top-level array structure
type ClabInspectOutput ¶
type ClabInspectOutput map[string][]ClabContainerInfo
ClabInspectOutput matches the top-level structure of `clab inspect --all --format json`
type ClabInspectOutputDetails ¶ added in v0.1.1
type ClabInspectOutputDetails map[string][]json.RawMessage
type ContainerLogInfo ¶ added in v0.1.10
ContainerLogInfo contains information about a container needed for logs retrieval
type CustomIconInfo ¶ added in v0.3.0
type CustomIconInfo struct {
Name string `json:"name"`
Source string `json:"source" example:"global"`
DataURI string `json:"dataUri"`
Format string `json:"format" example:"svg"`
}
CustomIconInfo describes a custom icon exposed to the TopoViewer UI.
type CustomNodeDefaultRequest ¶ added in v0.3.0
type CustomNodeDefaultRequest struct {
Name string `json:"name" binding:"required"`
}
CustomNodeDefaultRequest selects the default custom node template by name.
type CustomNodeTemplate ¶ added in v0.3.0
type CustomNodeTemplate map[string]interface{}
CustomNodeTemplate stores a user-defined TopoViewer node template. It intentionally allows additional arbitrary fields so advanced node template settings survive round-trips through the API.
type CustomNodesReplaceRequest ¶ added in v0.3.0
type CustomNodesReplaceRequest struct {
CustomNodes []CustomNodeTemplate `json:"customNodes"`
}
CustomNodesReplaceRequest replaces the full custom node template collection.
type CustomNodesResponse ¶ added in v0.3.0
type CustomNodesResponse struct {
CustomNodes []CustomNodeTemplate `json:"customNodes"`
DefaultNode string `json:"defaultNode"`
}
CustomNodesResponse returns the current custom node template set and the derived default node name.
type DeployRequest ¶
type DeployRequest struct {
// Option 1: Direct Topology Content.
// Provide the full containerlab topology YAML as a json string.
// If this is provided, 'topologySourceUrl' MUST be empty.
// {
// "topologyContent": {
// "name": "your-lab-name",
// "topology": {
// "kinds": {
// "nokia_srlinux": {
// "type": "ixrd3",
// "image": "ghcr.io/nokia/srlinux"
// }
// },
// "nodes": {
// "srl1": {
// "kind": "nokia_srlinux"
// },
// "srl2": {
// "kind": "nokia_srlinux"
// }
// },
// "links": [
// {
// "endpoints": [
// "srl1:e1-1",
// "srl2:e1-1"
// ]
// }
// ]
// }
// }
// }
TopologyContent json.RawMessage `json:"topologyContent" swaggertype:"object"`
// Option 2: Remote Topology Source URL.
// Provide a URL to a Git repository, a specific .clab.yml file in Git (github/gitlab), or a raw HTTP(S) URL.
// If this is provided, 'topologyContent' MUST be empty.
TopologySourceUrl string `json:"topologySourceUrl,omitempty"`
}
DeployRequest represents the payload for deploying a lab. Provide EITHER 'topologyContent' OR 'topologySourceUrl', but not both.
type DisableTxOffloadRequest ¶
type DisableTxOffloadRequest struct {
ContainerName string `json:"containerName" binding:"required" example:"clab-my-lab-srl1"`
}
DisableTxOffloadRequest represents the payload for disabling TX offload.
type DiskMetrics ¶ added in v0.1.4
type DiskMetrics struct {
Path string `json:"path"` // Mount path (usually "/")
TotalDisk uint64 `json:"totalDisk"` // Total disk space in bytes
UsedDisk uint64 `json:"usedDisk"` // Used disk space in bytes
FreeDisk uint64 `json:"freeDisk"` // Free disk space in bytes
UsagePercent float64 `json:"usagePercent"` // Disk usage percentage
}
DiskMetrics represents disk usage information
type DrawioGenerateRequest ¶ added in v0.3.0
type DrawioGenerateResponse ¶ added in v0.3.0
type EdgeSharkStatusResponse ¶ added in v0.3.0
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error" example:"Invalid credentials or user not in allowed group"`
}
ErrorResponse represents a standard error message format
type EventAttributes ¶ added in v0.2.0
type EventAttributes struct {
// Container name
Name string `json:"name,omitempty" example:"clab-mylab-srl1"`
// Lab name this event belongs to
Lab string `json:"lab,omitempty" example:"mylab"`
// Alternative lab name field (containerlab label)
Containerlab string `json:"containerlab,omitempty" example:"mylab"`
// Node name within the lab
NodeName string `json:"clab-node-name,omitempty" example:"srl1"`
// Node kind (e.g., nokia_srlinux, linux)
NodeKind string `json:"clab-node-kind,omitempty" example:"nokia_srlinux"`
// Node type
NodeType string `json:"clab-node-type,omitempty" example:"ixrd3"`
// Container image
Image string `json:"image,omitempty" example:"ghcr.io/nokia/srlinux:latest"`
// Exit code (for stop/die events)
ExitCode string `json:"exitCode,omitempty" example:"0"`
}
EventAttributes contains the details of a containerlab event.
type EventResponse ¶ added in v0.2.0
type EventResponse struct {
// Unix timestamp when the event occurred
Time int64 `json:"time" example:"1706918400"`
// Type of event (e.g., "container", "interface-stats")
Type string `json:"type" example:"container"`
// Event action (e.g., "start", "stop", "die", "stats")
Action string `json:"action" example:"start"`
// Event attributes containing details about the event
Attributes EventAttributes `json:"attributes"`
}
EventResponse represents a single containerlab event in JSON format. Events are streamed as newline-delimited JSON (NDJSON).
type ExecRequest ¶
type ExecRequest struct {
Command string `json:"command" binding:"required" example:"ip addr show eth1"`
}
ExecRequest represents the payload for executing a command on lab nodes.
type ExecResponse ¶
type ExecResponse map[string][]ClabExecInternalResult // <--- Changed value to []ClabExecInternalResult
ExecResponse represents the structured output (JSON format) from the exec command. The keys are the container names. Values are arrays of results (usually one element per array).
type FcliCommandRequest ¶ added in v0.3.0
type FcliCommandRequest struct {
Command string `json:"command" binding:"required"`
}
type FcliCommandResponse ¶ added in v0.3.0
type GenerateNodeTier ¶
type GenerateNodeTier struct {
Count int `json:"count" binding:"required,min=1" example:"4"` // Number of nodes in this tier
Kind string `json:"kind,omitempty" example:"nokia_srlinux"` // Node kind (defaults to 'srl'/'nokia_srlinux' if omitted)
Type string `json:"type,omitempty" example:"ixrd3"` // Node type within the kind
}
GenerateNodeTier defines a tier in the CLOS topology for generation.
type GenerateRequest ¶
type GenerateRequest struct {
Name string `json:"name" binding:"required" example:"3-tier-clos"`
Tiers []GenerateNodeTier `json:"tiers" binding:"required,min=1"`
DefaultKind string `json:"defaultKind,omitempty" example:"nokia_srlinux"`
Images map[string]string `json:"images" example:"nokia_srlinux:ghcr.io/nokia/srlinux:latest"`
Licenses map[string]string `json:"licenses,omitempty" example:"nokia_srlinux:/opt/licenses/srl.lic"`
NodePrefix string `json:"nodePrefix,omitempty" example:"clos-node"`
GroupPrefix string `json:"groupPrefix,omitempty" example:"clos-tier"`
ManagementNetwork string `json:"managementNetwork,omitempty" example:"clos-mgmt"`
IPv4Subnet string `json:"ipv4Subnet,omitempty" example:"172.20.20.0/24"`
IPv6Subnet string `json:"ipv6Subnet,omitempty" example:"2001:172:20:20::/64"`
Deploy bool `json:"deploy,omitempty" example:"true"`
MaxWorkers int `json:"maxWorkers,omitempty" example:"4"`
OutputFile string `json:"outputFile,omitempty" example:"clos.yml"`
}
GenerateRequest represents the payload for generating a topology file.
type GenerateResponse ¶
type GenerateResponse struct {
// Message indicating success or failure.
Message string `json:"message"`
// The generated topology YAML (only if Deploy=false and OutputFile is empty).
TopologyYAML string `json:"topologyYaml,omitempty"`
// The output from the deploy command (only if Deploy=true). JSON object keyed by lab name.
// Use swaggertype:"object" to represent json.RawMessage in Swagger.
DeployOutput json.RawMessage `json:"deployOutput,omitempty" swaggertype:"object"`
// Path where the file was saved (if Deploy=true, it's the path in the user's managed lab directory; if Deploy=false, it's the OutputFile path if provided).
SavedFilePath string `json:"savedFilePath,omitempty"`
}
GenerateResponse represents the result of the generate command.
type GenericSuccessResponse ¶
type GenericSuccessResponse struct {
Message string `json:"message"`
}
GenericSuccessResponse for simple success messages
type HealthResponse ¶ added in v0.1.4
type HealthResponse struct {
Status string `json:"status"` // "healthy" or other status indicators
Uptime string `json:"uptime"` // Human-readable uptime
StartTime time.Time `json:"startTime"` // When the server started
Version string `json:"version,omitempty"` // API server version
}
HealthResponse represents basic health information about the API server
type IconListResponse ¶ added in v0.3.0
type IconListResponse struct {
Icons []CustomIconInfo `json:"icons"`
}
IconListResponse returns a list of custom icons.
type IconReconcileRequest ¶ added in v0.3.0
type IconReconcileRequest struct {
UsedIcons []string `json:"usedIcons"`
}
IconReconcileRequest describes the custom icon names currently used by a lab.
type IconUploadRequest ¶ added in v0.3.0
type IconUploadRequest struct {
FileName string `json:"fileName" binding:"required" example:"my-router.svg"`
ContentType string `json:"contentType,omitempty" example:"image/svg+xml"`
DataBase64 string `json:"dataBase64" binding:"required"`
}
IconUploadRequest uploads a new global custom icon.
type IconUploadResponse ¶ added in v0.3.0
type IconUploadResponse struct {
Success bool `json:"success" example:"true"`
IconName string `json:"iconName" example:"my-router"`
}
IconUploadResponse reports the final stored icon name after upload.
type ImportTopologyFromURLRequest ¶ added in v0.3.0
type ImportTopologyFromURLRequest struct {
TopologySourceUrl string `json:"topologySourceUrl" binding:"required"`
}
ImportTopologyFromURLRequest describes an undeployed topology import from a remote source URL.
type ImportTopologyFromURLResponse ¶ added in v0.3.0
type ImportTopologyFromURLResponse struct {
Success bool `json:"success"`
LabName string `json:"labName"`
FileName string `json:"fileName"`
Topology TopologyEntry `json:"topology"`
}
ImportTopologyFromURLResponse describes the result of an undeployed topology import.
type InterfaceInfo ¶
type InterfaceInfo struct {
Name string `json:"name"` // Interface name (e.g., "eth0", "e1-1")
Alias string `json:"alias"` // Interface alias (e.g., "ethernet-1/1", "" if none)
Mac string `json:"mac"` // MAC Address
IfIndex int `json:"ifindex"` // Interface index
Mtu int `json:"mtu"` // MTU size
Type string `json:"type"` // Interface type (e.g., "veth", "device", "dummy")
State string `json:"state"` // Interface state (e.g., "up", "down", "unknown")
}
InterfaceInfo describes a single network interface
type InterfaceStatsAttributes ¶ added in v0.2.0
type InterfaceStatsAttributes struct {
// Container name
Name string `json:"name" example:"clab-mylab-srl1"`
// Lab name
Lab string `json:"lab" example:"mylab"`
// Interface name
Interface string `json:"interface" example:"e1-1"`
// Bytes received
RxBytes uint64 `json:"rx_bytes" example:"123456"`
// Packets received
RxPackets uint64 `json:"rx_packets" example:"1000"`
// Receive errors
RxErrors uint64 `json:"rx_errors" example:"0"`
// Receive drops
RxDropped uint64 `json:"rx_dropped" example:"0"`
// Bytes transmitted
TxBytes uint64 `json:"tx_bytes" example:"654321"`
// Packets transmitted
TxPackets uint64 `json:"tx_packets" example:"900"`
// Transmit errors
TxErrors uint64 `json:"tx_errors" example:"0"`
// Transmit drops
TxDropped uint64 `json:"tx_dropped" example:"0"`
}
InterfaceStatsAttributes contains interface statistics details.
type InterfaceStatsEvent ¶ added in v0.2.0
type InterfaceStatsEvent struct {
// Unix timestamp when the stats were collected
Time int64 `json:"time" example:"1706918400"`
// Type is always "interface-stats" for this event
Type string `json:"type" example:"interface-stats"`
// Action is always "stats" for this event
Action string `json:"action" example:"stats"`
// Interface statistics attributes
Attributes InterfaceStatsAttributes `json:"attributes"`
}
InterfaceStatsEvent represents interface statistics event in JSON format.
type LoginRequest ¶
type LoginRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
SessionDuration string `json:"sessionDuration,omitempty" example:"24h"`
}
LoginRequest represents the payload for the login endpoint
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNzA2OTIyMDAwfQ.abc123"`
}
LoginResponse represents the payload returned after successful login
type LogsResponse ¶ added in v0.1.10
LogsResponse represents the response for container logs in JSON format
type MemMetrics ¶ added in v0.1.4
type MemMetrics struct {
TotalMem uint64 `json:"totalMem"` // Total physical memory in bytes
UsedMem uint64 `json:"usedMem"` // Used physical memory in bytes
AvailableMem uint64 `json:"availableMem"` // Available memory in bytes
UsagePercent float64 `json:"usagePercent"` // Memory usage percentage
ProcessMemMB float64 `json:"processMemMB,omitempty"` // This process's memory in MB
ProcessMemPct float64 `json:"processMemPct,omitempty"` // This process's memory percentage
}
MemMetrics represents memory usage information
type Metrics ¶ added in v0.1.4
type Metrics struct {
CPU *CPUMetrics `json:"cpu,omitempty"` // CPU usage metrics
Mem *MemMetrics `json:"mem,omitempty"` // Memory usage metrics
Disk *DiskMetrics `json:"disk,omitempty"` // Disk usage metrics
}
Metrics represents system resource usage metrics
type MetricsResponse ¶ added in v0.1.4
type MetricsResponse struct {
ServerInfo ServerInfo `json:"serverInfo"` // Basic server information
Metrics *Metrics `json:"metrics"` // Detailed system metrics
}
MetricsResponse represents detailed system metrics with server info
type NetemInterfaceInfo ¶
type NetemInterfaceInfo struct {
Interface string `json:"interface"` // Interface name
Delay string `json:"delay"` // Duration string or empty
Jitter string `json:"jitter"` // Duration string or empty
PacketLoss float64 `json:"packet_loss"` // Percentage
Rate uint `json:"rate"` // Kbit/s
Corruption float64 `json:"corruption,omitempty"` // Percentage (might be missing in older clab versions)
}
NetemInterfaceInfo holds the netem details for a single interface from `clab tools netem show --format json`
type NetemResetRequest ¶ added in v0.2.0
type NetemResetRequest struct {
// Container/node name to reset impairments on (e.g., "clab-my-lab-srl1").
ContainerName string `json:"containerName" binding:"required" example:"clab-my-lab-srl1"`
// Interface name or interface alias to reset impairments on (e.g., "eth1" or "mgmt0").
Interface string `json:"interface" binding:"required" example:"eth1"`
}
NetemResetRequest represents the parameters for resetting network emulation on an interface.
type NetemSetRequest ¶
type NetemSetRequest struct {
// Container/node name to apply impairments on (e.g., "clab-my-lab-srl1").
ContainerName string `json:"containerName" binding:"required" example:"clab-my-lab-srl1"`
// Interface name or interface alias to apply impairments on (e.g., "eth1" or "mgmt0").
Interface string `json:"interface" binding:"required" example:"eth1"`
Delay string `json:"delay,omitempty" example:"50ms"` // Duration string (e.g., "100ms", "1s")
Jitter string `json:"jitter,omitempty" example:"5ms"` // Duration string, requires Delay
Loss float64 `json:"loss,omitempty" example:"10.5"` // Percentage (0.0 to 100.0)
Rate uint `json:"rate,omitempty" example:"1000"` // Kbit/s (non-negative integer)
Corruption float64 `json:"corruption,omitempty" example:"0.1"` // Percentage (0.0 to 100.0)
}
NetemSetRequest represents the parameters for setting network emulation. Use pointers to distinguish between unset and zero values if necessary, but clab defaults usually handle zero values correctly (meaning "unset").
type NetemShowResponse ¶
type NetemShowResponse map[string][]NetemInterfaceInfo
NetemShowResponse matches the JSON output of `clab tools netem show --format json` It's a map where the key is the node name (container name) and the value is a list of interface details.
type NodeBrowserPort ¶ added in v0.3.0
type NodeBrowserPortsResponse ¶ added in v0.3.0
type NodeBrowserPortsResponse struct {
NodeName string `json:"nodeName"`
ContainerName string `json:"containerName"`
Ports []NodeBrowserPort `json:"ports"`
}
type NodeInterfaceInfo ¶
type NodeInterfaceInfo struct {
NodeName string `json:"name"` // Name of the container node
Interfaces []InterfaceInfo `json:"interfaces"`
}
NodeInterfaceInfo holds interfaces for a single node
type PasswordChangeRequest ¶ added in v0.1.4
type PasswordChangeRequest struct {
CurrentPassword string `json:"currentPassword,omitempty"` // Required if not superuser
NewPassword string `json:"newPassword" binding:"required"`
}
PasswordChangeRequest represents a request to change a user's password
type RedeployRequest ¶
type RedeployRequest struct {
Cleanup bool `json:"cleanup,omitempty"` // Corresponds to --cleanup flag
Graceful bool `json:"graceful,omitempty"` // Corresponds to --graceful flag
Graph bool `json:"graph,omitempty"` // Corresponds to --graph flag
Network string `json:"network,omitempty"` // Corresponds to --network flag
Ipv4Subnet string `json:"ipv4Subnet,omitempty"` // Corresponds to --ipv4-subnet flag
Ipv6Subnet string `json:"ipv6Subnet,omitempty"` // Corresponds to --ipv6-subnet flag
MaxWorkers int `json:"maxWorkers,omitempty"` // Corresponds to --max-workers flag (0 means default)
KeepMgmtNet bool `json:"keepMgmtNet,omitempty"` // Corresponds to --keep-mgmt-net flag
SkipPostDeploy bool `json:"skipPostDeploy,omitempty"` // Corresponds to --skip-post-deploy flag
ExportTemplate string `json:"exportTemplate,omitempty"` // Corresponds to --export-template flag (__full is special)
SkipLabdirAcl bool `json:"skipLabdirAcl,omitempty"` // Corresponds to --skip-labdir-acl flag
}
RedeployRequest represents the payload for redeploying a lab
type RuntimeImageActionResponse ¶ added in v0.3.0
type RuntimeImagePullRequest ¶ added in v0.3.0
type RuntimeImagePullRequest struct {
Image string `json:"image" binding:"required"`
}
type RuntimeImageSummary ¶ added in v0.3.0
type RuntimeImageSummary struct {
ID string `json:"id"`
ShortID string `json:"shortId,omitempty"`
RepoTags []string `json:"repoTags"`
RepoDigests []string `json:"repoDigests"`
CreatedAt string `json:"createdAt,omitempty"`
Size string `json:"size,omitempty"`
VirtualSize string `json:"virtualSize,omitempty"`
}
type RuntimeImagesResponse ¶ added in v0.3.0
type RuntimeImagesResponse struct {
Runtime string `json:"runtime"`
Images []RuntimeImageSummary `json:"images"`
}
type SSHAccessRequest ¶ added in v0.1.4
type SSHAccessRequest struct {
SSHUsername string `json:"sshUsername,omitempty"` // Optional override for container's SSH user
Duration string `json:"duration,omitempty"` // How long the access should be valid for (e.g., "1h", "30m")
}
SSHAccessRequest represents the payload for requesting SSH access to a node
type SSHAccessResponse ¶ added in v0.1.4
type SSHAccessResponse struct {
Port int `json:"port"` // Allocated port on API server
Host string `json:"host"` // API server's hostname or IP
Username string `json:"username"` // Username to use for SSH
Expiration time.Time `json:"expiration"` // When this access expires
Command string `json:"command"` // Example SSH command
}
SSHAccessResponse represents the response with SSH connection details
type SSHSessionInfo ¶ added in v0.1.4
type SSHSessionInfo struct {
Port int `json:"port"` // Allocated port on API server
LabName string `json:"labName"` // Lab name
NodeName string `json:"nodeName"` // Node name
Username string `json:"username"` // SSH username
Expiration time.Time `json:"expiration"` // When this access expires
Created time.Time `json:"created"` // When this access was created
}
SSHSessionInfo represents information about an active SSH session
type SaveConfigResponse ¶
type SaveConfigResponse struct {
// Message indicating overall success.
Message string `json:"message"`
// Detailed output from the 'clab save' command (often from stderr).
Output string `json:"output"`
}
SaveConfigResponse represents the result of the save config command.
type ServerInfo ¶ added in v0.1.4
type ServerInfo struct {
Version string `json:"version"` // API server version
Uptime string `json:"uptime"` // Human-readable uptime
StartTime time.Time `json:"startTime"` // When the server started
}
ServerInfo contains basic server information
type ShareToolResponse ¶ added in v0.3.0
type ShareToolResponse struct {
}
type SimpleSuccessResponse ¶ added in v0.3.0
type SimpleSuccessResponse struct {
Success bool `json:"success" example:"true"`
}
SimpleSuccessResponse for operations that only return a boolean success flag.
type TerminalProtocol ¶ added in v0.3.0
type TerminalProtocol string
const ( TerminalProtocolSSH TerminalProtocol = "ssh" TerminalProtocolShell TerminalProtocol = "shell" TerminalProtocolTelnet TerminalProtocol = "telnet" )
type TerminalSessionInfo ¶ added in v0.3.0
type TerminalSessionInfo struct {
SessionID string `json:"sessionId"`
Username string `json:"username"`
LabName string `json:"labName"`
NodeName string `json:"nodeName"`
Protocol TerminalProtocol `json:"protocol"`
State string `json:"state"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
LastActivity time.Time `json:"lastActivity"`
ExitCode *int `json:"exitCode,omitempty"`
Error string `json:"error,omitempty"`
}
type TerminalSessionRequest ¶ added in v0.3.0
type TerminalSessionRequest struct {
// Protocol selects the terminal transport: ssh, shell, or telnet.
Protocol TerminalProtocol `json:"protocol" binding:"required"`
// Cols is the requested terminal width in characters.
Cols int `json:"cols"`
// Rows is the requested terminal height in characters.
Rows int `json:"rows"`
// SSHUsername optionally overrides the SSH username for protocol=ssh.
SSHUsername string `json:"sshUsername,omitempty"`
// TelnetPort optionally overrides the telnet destination port for protocol=telnet.
TelnetPort int `json:"telnetPort,omitempty"`
}
type TerminalSessionResponse ¶ added in v0.3.0
type TopologyDocEventResponse ¶ added in v0.3.0
type TopologyDocEventResponse struct {
Type string `json:"type" example:"topology-doc"`
LabName string `json:"labName" example:"mylab"`
Path string `json:"path" example:"mylab.clab.yml.annotations.json"`
DocumentKind string `json:"documentKind" example:"annotations"`
Action string `json:"action" example:"change"`
Revision string `json:"revision" example:"yaml=123-456;annotations=78-910"`
}
TopologyDocEventResponse describes a streamed topology document change event.
type TopologyEntry ¶ added in v0.3.0
type TopologyEntry struct {
LabName string `json:"labName"`
YamlFileName string `json:"yamlFileName"`
AnnotationsFileName string `json:"annotationsFileName"`
HasAnnotations bool `json:"hasAnnotations"`
DeploymentState string `json:"deploymentState"` // undeployed (runtime state is derived from events stream)
}
TopologyEntry describes an editable topology file exposed to the standalone UI.
type TopologyFileRenameRequest ¶ added in v0.3.0
type TopologyFileRenameRequest struct {
OldPath string `json:"oldPath" binding:"required" example:"configs/startup.cfg"`
NewPath string `json:"newPath" binding:"required" example:"configs/startup.bak.cfg"`
}
TopologyFileRenameRequest describes a scoped file rename operation inside a lab directory.
type UserCreateRequest ¶ added in v0.1.4
type UserCreateRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
DisplayName string `json:"displayName,omitempty"`
Shell string `json:"shell,omitempty"` // Default to /bin/bash if empty
Groups []string `json:"groups,omitempty"`
IsSuperuser bool `json:"isSuperuser,omitempty"`
}
UserCreateRequest represents a request to create a new system user
type UserDetails ¶ added in v0.1.4
type UserDetails struct {
Username string `json:"username"`
UID string `json:"uid,omitempty"`
GID string `json:"gid,omitempty"`
DisplayName string `json:"displayName,omitempty"` // Full name from GECOS field
HomeDir string `json:"homeDir,omitempty"`
Shell string `json:"shell,omitempty"`
Groups []string `json:"groups,omitempty"`
IsSuperuser bool `json:"isSuperuser,omitempty"`
IsAPIUser bool `json:"isApiUser,omitempty"`
}
UserDetails represents information about a system user
type UserUpdateRequest ¶ added in v0.1.4
type UserUpdateRequest struct {
DisplayName string `json:"displayName,omitempty"`
Shell string `json:"shell,omitempty"`
Groups []string `json:"groups,omitempty"`
IsSuperuser bool `json:"isSuperuser,omitempty"`
}
UserUpdateRequest represents a request to update user information
type VersionCheckResponse ¶
type VersionCheckResponse struct {
// Raw output string from 'clab version check'.
CheckResult string `` /* 240-byte string literal not displayed */
}
VersionCheckResponse holds the output of the 'clab version check' command.
type VersionResponse ¶
type VersionResponse struct {
// Raw output string from 'clab version'.
VersionInfo string `` /* 190-byte string literal not displayed */
}
VersionResponse holds the output of the 'clab version' command.
type VethCreateRequest ¶
type VethCreateRequest struct {
// Endpoint A definition. Format: <node-name>:<interface-name> OR <kind>:<node-name>:<interface-name>
// Example: "clab-demo-node1:eth1" or "bridge:br-1:br-eth1" or "host:veth-eth1"
AEndpoint string `json:"aEndpoint" binding:"required" example:"clab-demo-node1:eth1"`
// Endpoint B definition. Format: <node-name>:<interface-name> OR <kind>:<node-name>:<interface-name>
// Example: "clab-demo-node2:eth1" or "ovs-bridge:ovsbr-1:br-eth1"
BEndpoint string `json:"bEndpoint" binding:"required" example:"clab-demo-node2:eth1"`
// MTU for the vEth pair. Defaults to 9500 if omitted.
Mtu int `json:"mtu,omitempty" example:"1500"` // Use int, convert to string for command
}
VethCreateRequest represents the payload for `clab tools veth create`.
type VxlanCreateRequest ¶
type VxlanCreateRequest struct {
// Remote VTEP IP address.
Remote string `json:"remote" binding:"required" example:"10.0.0.20"`
// Name of the existing interface in the root namespace to bridge traffic with.
Link string `json:"link" binding:"required" example:"srl_e1-1"`
// VxLAN Network Identifier (VNI). Defaults to 10 if omitted.
ID int `json:"id,omitempty" example:"100"`
// UDP port number for the VxLAN tunnel. Defaults to 14789 if omitted.
Port int `json:"port,omitempty" example:"4789"` // Default is 4789 (IANA standard)
// Optional: Linux device to use for the tunnel source. Auto-detected if omitted.
Dev string `json:"dev,omitempty" example:"eth0"`
// Optional: MTU for the VxLAN interface. Auto-calculated if omitted.
Mtu int `json:"mtu,omitempty" example:"1400"`
}
VxlanCreateRequest represents the payload for `clab tools vxlan create`.
type WorkspaceDirectoryRequest ¶ added in v0.3.4
type WorkspaceDirectoryRequest struct {
Path string `json:"path" binding:"required" example:"lab1/configs"`
}
WorkspaceDirectoryRequest describes a scoped workspace directory creation operation.
type WorkspaceFileEntry ¶ added in v0.3.4
type WorkspaceFileEntry struct {
Name string `json:"name"`
Path string `json:"path"`
Kind string `json:"kind"` // file or directory
Size int64 `json:"size"`
ModifiedAt string `json:"modifiedAt"`
HasChildren bool `json:"hasChildren"`
}
WorkspaceFileEntry describes one file or directory inside the user's editable lab workspace.
type WorkspaceFileEventResponse ¶ added in v0.3.4
type WorkspaceFileEventResponse struct {
Type string `json:"type" example:"workspace-file"`
Path string `json:"path" example:"lab1/configs/startup.cfg"`
ParentPath string `json:"parentPath" example:"lab1/configs"`
Kind string `json:"kind,omitempty" example:"file"`
Action string `json:"action" example:"delete"`
}
WorkspaceFileEventResponse describes a streamed workspace filesystem change event.
type WorkspaceFileRenameRequest ¶ added in v0.3.4
type WorkspaceFileRenameRequest struct {
OldPath string `json:"oldPath" binding:"required" example:"lab1/configs/startup.cfg"`
NewPath string `json:"newPath" binding:"required" example:"lab1/configs/startup.bak.cfg"`
}
WorkspaceFileRenameRequest describes a scoped workspace file rename operation.