Check Point Management API Wrapper - Elixir v1.0.1 CpMgmt.Network View Source

This module manages simple network functions with the Web API

Link to this section Summary

Functions

Creates a Network via the API

Removes a Network

Shows a Network

Shows all Networks with the same information as show

Link to this section Functions

Link to this function add(name, subnet, subnet_mask, options \\ []) View Source

Creates a Network via the API

Examples

iex> CpMgmt.Network.add("some-network", "10.0.0.0", "255.255.255.0", ["nat-settings": %{"auto-rule": true}])
{:ok,
  %CpMgmt.Network{
    data: %{
      "broadcast" => "allow",
      "color" => "black",
      "comments" => "",
      "domain" => %{
        "domain-type" => "domain",
        "name" => "SMC User",
        "uid" => "41e821a0-3720-11e3-aa6e-0800200c9fde"
      },
      "groups" => [],
      "icon" => "NetworkObjects/network",
      "mask-length4" => 24,
      "meta-info" => %{
        "creation-time" => %{
          "iso-8601" => "2018-11-14T11:12-0600",
          "posix" => 1542215568367
        },
        "creator" => "admin",
        "last-modifier" => "admin",
        "last-modify-time" => %{
          "iso-8601" => "2018-11-14T11:12-0600",
          "posix" => 1542215568367
        },
        "lock" => "unlocked",
        "validation-state" => "ok"
      },
      "name" => "some-network",
      "nat-settings" => %{"auto-rule" => false},
      "read-only" => true,
      "subnet-mask" => "255.255.255.0",
      "subnet4" => "10.0.1.0",
      "tags" => [],
      "type" => "network",
      "uid" => "458c0e7b-e546-46f1-98f5-f92178b1b49b"
    },
    status: 200
  }}
iex> CpMgmt.Network.add("some-network", "10.0.0.0", "255.255.255.0")
{:error, %Cpmgmt.Nework{status: 402, data: %{error_data}}}

Removes a Network

Examples

iex> CpMgmt.Network.remove("some-network")
:ok, %CpMgmt.Network{data: %{"message" => "OK"}, status: 200}}

iex> CpMgmt.Network.remove("some-network")
{:error, %Cpmgmt.Nework{status: 402, data: %{error_data}}}

Shows a Network

Examples

iex> CpMgmt.Network.show("some-network")
{:ok,
  %CpMgmt.Network{
    data: %{
      "broadcast" => "allow",
      "color" => "black",
      "comments" => "",
      "domain" => %{
        "domain-type" => "domain",
        "name" => "SMC User",
        "uid" => "41e821a0-3720-11e3-aa6e-0800200c9fde"
      },
      "groups" => [],
      "icon" => "NetworkObjects/network",
      "mask-length4" => 24,
      "meta-info" => %{
        "creation-time" => %{
          "iso-8601" => "2018-11-14T11:22-0600",
          "posix" => 1542216156432
        },
        "creator" => "admin",
        "last-modifier" => "admin",
        "last-modify-time" => %{
          "iso-8601" => "2018-11-14T11:22-0600",
          "posix" => 1542216156432
        },
        "lock" => "unlocked",
        "validation-state" => "ok"
      },
      "name" => "some-network",
      "nat-settings" => %{"auto-rule" => false},
      "read-only" => false,
      "subnet-mask" => "255.255.255.0",
      "subnet4" => "10.0.0.0",
      "tags" => [],
      "type" => "network",
      "uid" => "d65e5f3d-24e3-442b-94a0-3659a67ec27d"
    },
    status: 200
  }}

iex> CpMgmt.Network.show("some-network")
{:error, %Cpmgmt.Nework{status: 402, data: %{error_data}}}

Shows all Networks with the same information as show