ExIncus.Networks (ex_incus v1.0.0)

Copy Markdown

Manage networks (bridges, OVN networks, ...).

{:ok, networks} = ExIncus.Networks.list(client)

{:ok, _} =
  ExIncus.Networks.create(client, %{
    "name" => "testbr0",
    "config" => %{
      "ipv4.address" => "10.140.100.1/24",
      "ipv4.nat" => "true",
      "ipv6.address" => "none"
    }
  })

{:ok, leases} = ExIncus.Networks.leases(client, "testbr0")

Summary

Functions

Creates a network from a NetworksPost params map (needs "name").

Fetches a single network.

Lists the DHCP leases of a network.

Lists networks (full objects by default).

Partially updates the network configuration (PATCH).

Fetches the runtime state of a network (addresses, counters, ...).

Replaces the network configuration (PUT).

Types

result()

@type result() :: {:ok, term()} | {:error, ExIncus.Error.t()}

Functions

create(client, params, opts \\ [])

@spec create(ExIncus.Client.t(), map(), keyword()) :: result()

Creates a network from a NetworksPost params map (needs "name").

delete(client, name, opts \\ [])

@spec delete(ExIncus.Client.t(), String.t(), keyword()) :: result()

Deletes a network.

get(client, name, opts \\ [])

@spec get(ExIncus.Client.t(), String.t(), keyword()) :: result()

Fetches a single network.

leases(client, name, opts \\ [])

@spec leases(ExIncus.Client.t(), String.t(), keyword()) :: result()

Lists the DHCP leases of a network.

list(client, opts \\ [])

@spec list(
  ExIncus.Client.t(),
  keyword()
) :: result()

Lists networks (full objects by default).

patch(client, name, params, opts \\ [])

@spec patch(ExIncus.Client.t(), String.t(), map(), keyword()) :: result()

Partially updates the network configuration (PATCH).

rename(client, name, new_name, opts \\ [])

@spec rename(ExIncus.Client.t(), String.t(), String.t(), keyword()) :: result()

Renames a network.

state(client, name, opts \\ [])

@spec state(ExIncus.Client.t(), String.t(), keyword()) :: result()

Fetches the runtime state of a network (addresses, counters, ...).

update(client, name, params, opts \\ [])

@spec update(ExIncus.Client.t(), String.t(), map(), keyword()) :: result()

Replaces the network configuration (PUT).