Check Point Management API Wrapper - Elixir v1.0.0-rc0 CpMgmt View Source

This module manages simple functions with the Web API

Link to this section Summary

Functions

Installs the specified policy package on the specified gateway or gatewayas

Checks to see if the sid is currently stored. If not, issues login

Runs the login function to the management API, sets env for :sid and :uid as well and returns sid to be used in the CpMgmt.logged_in?/0 function. Uses the user and password provided via the config params

Runs the logout function to the management API. Unregisters the :sid and :uid from the env

Checks to see if the request was successful. If it was publishes changes to the management server. If not does nothing

Takes CpMgmt.transform_response/1 and the given struct, then converts it to the struct for the calling module

Transforms the Tesla response to a filtered version for use with CpMgmt.to_struct/1

Runs verification on the specified policy package

Link to this section Functions

Link to this function install_policy(package, gateways) View Source

Installs the specified policy package on the specified gateway or gatewayas.

Examples

Specifing a single gateway to install on.
iex> CpMgmt.install_policy("policy-package-name", "someGW")

You can also specify a list of gateways to install on
iex> CpMgmt.install_policy("policy-package-name", ["someGW", "someOtherGW", "yetAnotherGW"])

iex> CpMgmt.install_policy("policy-package-name", "someGW")
{:error, %{error}}

Checks to see if the sid is currently stored. If not, issues login

Runs the login function to the management API, sets env for :sid and :uid as well and returns sid to be used in the CpMgmt.logged_in?/0 function. Uses the user and password provided via the config params.

Examples

iex> CpMgmt.login
{:ok, "some_sid"}

iex> CpMgmt.login
{:error,
  %{
    body: %{
      "code" => "err_login_failed",
      "message" => "Authentication to server failed."
    },
    status: 403
  }}

iex> CpMgmt.login
{:error, some_network_error}

Runs the logout function to the management API. Unregisters the :sid and :uid from the env.

Examples

iex> CpMgmt.logout
{:ok, %{body: %{"message" => "OK"}, status: 200}}

iex> CpMgmt.logout
{:error, %{error}}

Checks to see if the request was successful. If it was publishes changes to the management server. If not does nothing

Link to this function to_struct(data, module_struct) View Source

Takes CpMgmt.transform_response/1 and the given struct, then converts it to the struct for the calling module

Link to this function transform_response(response) View Source

Transforms the Tesla response to a filtered version for use with CpMgmt.to_struct/1

Runs verification on the specified policy package.

Examples

iex> CpMgmt.verify_policy("policy-package-name")

iex> CpMgmt.verify_policy("policy-package-name")
{:error, %{error}}