Skip to content

Node network

Mounted at client.nodes.network.

barbara.resources.network.NodeNetworkResource

NodeNetworkResource(client: BarbaraClient)

get

get(node_id: str) -> NodeNetwork

Snapshot of every physical interface plus VPN/Proxy state — the data behind the Networking card as a whole.

get_hostname

get_hostname(node_id: str) -> str

No dedicated GET endpoint for the hostname alone — reads it back from the node's own document (same one client.nodes.get() returns) and decodes the base64 the wire uses for this field.

set_hostname

set_hostname(node_id: str, hostname: str) -> None

Academy: "Adjust the hostname".

update_ethernet_interface

update_ethernet_interface(
    node_id: str,
    iface_name: str,
    *,
    dhcp: Optional[bool] = None,
    ip: Optional[str] = None,
    gateway: Optional[str] = None,
    auto_dns: Optional[bool] = None,
    dns: Optional[str] = None,
    ip_aliases: Optional[List[str]] = None,
    dns_aliases: Optional[List[str]] = None,
    metric: Optional[int] = None,
    rollback: bool = True,
) -> None

Academy: "Adjust a physical interface" > "Ethernet". Only the parameters given are changed — anything left as None keeps its current value.

update_wifi_interface

update_wifi_interface(
    node_id: str,
    iface_name: str,
    *,
    ssid: str,
    psk: str,
    hidden: bool,
    dhcp: bool,
    ip: str,
    gateway: str,
    dns: str,
    auto_dns: bool,
    ip_aliases: List[str],
    dns_aliases: List[str],
    metric: int,
    rollback: bool = True,
) -> None

Academy: "Adjust a physical interface" > "WiFi (WLAN)". Unlike Ethernet/Mobile, the API requires the full configuration on every call — there's no partial-update form for this endpoint. psk is base64-encoded internally.

update_mobile_interface

update_mobile_interface(
    node_id: str,
    iface_name: str,
    *,
    apn: Optional[str] = None,
    user: Optional[str] = None,
    password: Optional[str] = None,
    metric: Optional[int] = None,
    rollback: bool = True,
) -> None

Academy: "Adjust a physical interface" > "Mobile". password is base64-encoded internally. Only the parameters given are changed.

create_vlan_interface

create_vlan_interface(
    node_id: str,
    parent_iface_name: str,
    *,
    vlan_id: int,
    name: str,
    dhcp: bool,
    ip: str,
    dns: str,
    gateway: str,
    metric: int,
    auto_dns: bool,
    ip_aliases: List[str],
    dns_aliases: List[str],
    mtu: Optional[int] = None,
    reorder_headers: Optional[bool] = None,
    loose_binding: Optional[bool] = None,
    gvrp: Optional[bool] = None,
    mvrp: Optional[bool] = None,
    rollback: bool = True,
) -> None

Configures a VLAN. parent_iface_name is the physical Ethernet interface (e.g. "eno1") the VLAN sits on — it is both the URL path segment and the request body's eth field. vlan_id is the VLAN ID (1-4094). name is the new VLAN interface's own display name (letters/digits only, no spaces or special characters, per Panel's own field hint) — this is what vlan_interface_exists/delete_vlan_interface later take, not parent_iface_name: the two methods key off different things, despite both being "the path segment" on the wire.

delete_vlan_interface

delete_vlan_interface(
    node_id: str, name: str, *, rollback: bool = True
) -> None

name is the VLAN interface's own name, as given to create_vlan_interface's name argument — not the parent's.

vlan_interface_exists

vlan_interface_exists(node_id: str, name: str) -> bool

name is the VLAN interface's own name (see delete_vlan_interface).

enable_proxy

enable_proxy(
    node_id: str,
    *,
    url: str,
    user: Optional[str] = None,
    password: Optional[str] = None,
    rollback: bool = True,
) -> None

Academy: "Enable the proxy". Only HTTP and Socks5 are supported. Takes effect after the node reboots. user/password are base64-encoded internally; both required by the wire, so empty string is sent when not given.

disable_proxy

disable_proxy(
    node_id: str, *, rollback: bool = True
) -> None

Academy: "Disable the proxy". Takes effect after the node reboots.

enable_vpn

enable_vpn(node_id: str) -> None

Provisions the node's VPN identity. Academy: "Activate the VPN" (the one-time activation step) — must be called once before start_vpn/stop_vpn.

start_vpn

start_vpn(node_id: str) -> None

Academy: the VPN ON/OFF toggle in the Advanced section, set to ON.

stop_vpn

stop_vpn(node_id: str) -> None

Academy: the VPN ON/OFF toggle in the Advanced section, set to OFF.

enable_standalone_mode

enable_standalone_mode(
    node_id: str,
    *,
    ip: str,
    netmask: str,
    metric: int,
    iface_name: str = "",
    gateway: str = "",
    dns: str = "",
    ssid: str = "",
    psk: str = "",
    hidden: bool = False,
    enable_network: bool = True,
    rollback: bool = True,
) -> None

Academy: "Configure and enable Standalone Mode". iface_name empty means "Any Interface"; ssid/psk empty means no WiFi (Ethernet-only). Unlike the WiFi interface's psk, this one is sent as plain text (see module docstring).

disable_standalone_mode

disable_standalone_mode(
    node_id: str, *, rollback: bool = True
) -> None

Academy: "Disable Standalone Mode".

renew_standalone_credentials

renew_standalone_credentials(node_id: str) -> None

Academy: "Regenerate" button next to the Standalone Mode credentials (Show Credentials popup).

get_iptables

get_iptables(node_id: str) -> Dict[str, Any]

No dedicated GET endpoint — reads it back from the node's own document, decoding iptablesConf from base64. iptables_id is "000000000000000000000000" when no custom rules have ever been set, not None or absent — pass it straight through to update_iptables either way.

update_iptables

update_iptables(
    node_id: str,
    *,
    iptables_conf: str,
    iptables_id: Optional[str] = None,
    rollback: bool = True,
) -> None

Academy: "Configure IPTables". iptables_conf is the raw iptables rules text, base64-encoded internally. iptables_id is an existing config's id, when replacing one rather than setting it for the first time.

create_ntp_server

create_ntp_server(node_id: str, server: str) -> None

server is the NTP server address/hostname, base64-encoded internally. The response doesn't include the created entry's id — read it back from client.nodes.get(node_id) if you need it (see module docstring).

barbara.resources.network.AsyncNodeNetworkResource

AsyncNodeNetworkResource(client: AsyncBarbaraClient)