UniFi Network API — traffic matching lists.
Lists available traffic matching definitions used in firewall and ACL rules.
Types
PORTS— port-based matchingIPV4_ADDRESSES— IPv4 address matchingIPV6_ADDRESSES— IPv6 address matching
Summary
Functions
Lists all traffic matching lists on a site.
Returns a lazy stream that auto-paginates through all traffic matching lists.
Functions
@spec list(Req.Request.t(), String.t(), keyword()) :: {:ok, term()} | {:error, UnifiApi.Error.t()}
Lists all traffic matching lists on a site.
Options
Supports pagination: :offset, :limit, :filter.
Examples
{:ok, lists} = UnifiApi.Network.TrafficMatching.list(client, site_id)
# => [%{"id" => "...", "type" => "PORTS", "name" => "HTTP/HTTPS"}]
@spec stream(Req.Request.t(), String.t(), keyword()) :: Enumerable.t()
Returns a lazy stream that auto-paginates through all traffic matching lists.
Error contract
A mid-stream error does not raise by default: the stream halts and
yields {:error, %UnifiApi.StreamError{}, last_offset} as its final
element, so the enumerable is heterogeneous. Match the tail:
case Enum.to_list(stream) do
items when is_list(items) ->
case List.last(items) do
{:error, error, cursor} -> {:error, error, cursor}
_ -> {:ok, items}
end
endPass raise_errors: true to raise UnifiApi.StreamError instead.
Options
:max_pages— halt after this many successful pages (default: unbounded).:max_items— halt once this many items have been yielded (default: unbounded).:raise_errors— raiseUnifiApi.StreamErroron error instead of yielding the error tuple (default:false).
Examples
UnifiApi.Network.TrafficMatching.stream(client, site_id)
|> Enum.to_list()