Documentation
¶
Overview ¶
Package pfsenseapi provides the api client for calling the pfsense api
Index ¶
- type Client
- type Config
- type Interface
- type InterfaceBridge
- type InterfaceBridgeRequest
- type InterfaceGroup
- type InterfaceGroupRequest
- type InterfaceRequest
- type InterfaceService
- func (s InterfaceService) Apply(ctx context.Context) error
- func (s InterfaceService) CreateInterface(ctx context.Context, newInterface InterfaceRequest) (*Interface, error)
- func (s InterfaceService) CreateInterfaceBridge(ctx context.Context, newBridge InterfaceBridgeRequest) (*InterfaceBridge, error)
- func (s InterfaceService) CreateInterfaceGroup(ctx context.Context, newGroup InterfaceGroupRequest) (*InterfaceGroup, error)
- func (s InterfaceService) CreateVLAN(ctx context.Context, newVLAN VLANRequest) (*VLAN, error)
- func (s InterfaceService) DeleteInterface(ctx context.Context, interfaceID string) error
- func (s InterfaceService) DeleteInterfaceBridge(ctx context.Context, idToDelete string) error
- func (s InterfaceService) DeleteInterfaceGroup(ctx context.Context, idToDelete int) error
- func (s InterfaceService) DeleteVLAN(ctx context.Context, idToDelete int) error
- func (s InterfaceService) GetInterface(ctx context.Context, interfaceID string) (*Interface, error)
- func (s InterfaceService) GetInterfaceBridge(ctx context.Context, id string) (*InterfaceBridge, error)
- func (s InterfaceService) GetInterfaceGroup(ctx context.Context, id int) (*InterfaceGroup, error)
- func (s InterfaceService) GetVLAN(ctx context.Context, id int) (*VLAN, error)
- func (s InterfaceService) ListInterfaceBridges(ctx context.Context) ([]*InterfaceBridge, error)
- func (s InterfaceService) ListInterfaceGroups(ctx context.Context) ([]*InterfaceGroup, error)
- func (s InterfaceService) ListInterfaces(ctx context.Context) ([]*Interface, error)
- func (s InterfaceService) ListVLANs(ctx context.Context) ([]*VLAN, error)
- func (s InterfaceService) PutInterfaceGroups(ctx context.Context, groups []*InterfaceGroupRequest) ([]*InterfaceGroup, error)
- func (s InterfaceService) UpdateInterface(ctx context.Context, idToUpdate string, interfaceData InterfaceRequest) (*Interface, error)
- func (s InterfaceService) UpdateInterfaceBridge(ctx context.Context, idToUpdate string, bridgeData InterfaceBridgeRequest) (*InterfaceBridge, error)
- func (s InterfaceService) UpdateInterfaceGroup(ctx context.Context, idToUpdate int, groupData InterfaceGroupRequest) (*InterfaceGroup, error)
- func (s InterfaceService) UpdateVLAN(ctx context.Context, idToUpdate int, vlanData VLANRequest) (*VLAN, error)
- type VLAN
- type VLANRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Cfg Config Interface *InterfaceService // contains filtered or unexported fields }
Client provides client Methods
func NewClientWithJWTAuth ¶
NewClientWithJWTAuth constructs a new Client using JWT token authentication. The username and password provided here will be used to generate JWT tokens for authentication.
func NewClientWithLocalAuth ¶
NewClientWithLocalAuth constructs a new Client using Local username/password authentication
func NewClientWithNoAuth ¶
NewClientWithNoAuth constructs a new Client using defaults for everything except the host
func NewClientWithTokenAuth ¶
NewClientWithTokenAuth constructs a new Client using token authentication
type Config ¶
type Config struct { Host string LocalAuthEnabled bool User string Password string JWTAuthEnabled bool JWTToken string TokenAuthEnabled bool ApiClientID string ApiClientToken string SkipTLS bool Timeout time.Duration }
Config provides configuration for the client. These values are only read in when NewClient is called.
type Interface ¶
type Interface struct { InterfaceRequest Id string `json:"id"` }
type InterfaceBridge ¶
type InterfaceBridge struct { InterfaceBridgeRequest Id string `json:"id"` }
InterfaceBridge represents a single bridge.
type InterfaceBridgeRequest ¶
type InterfaceBridgeRequest struct { Members []string `json:"members"` Descr string `json:"descr"` Bridgeif string `json:"bridgeif"` }
InterfaceBridgeRequest represents the request to create or update a bridge.
type InterfaceGroup ¶
type InterfaceGroup struct { InterfaceGroupRequest Id int `json:"id"` }
type InterfaceGroupRequest ¶
type InterfaceGroupRequest struct { Ifname string `json:"ifname"` Members []string `json:"members"` Descr string `json:"descr"` }
InterfaceGroupRequest represents the request to create or update an interface group.
type InterfaceRequest ¶
type InterfaceRequest struct { If string `json:"if"` Enable *optional.Bool `json:"enable,omitempty"` Descr string `json:"descr"` Spoofmac *optional.String `json:"spoofmac,omitempty"` Mtu *optional.Int32 `json:"mtu,omitempty"` Mss *optional.Int32 `json:"mss,omitempty"` Media *optional.String `json:"media,omitempty"` Mediaopt *optional.String `json:"mediaopt,omitempty"` Blockpriv *optional.Bool `json:"blockpriv,omitempty"` Blockbogons *optional.Bool `json:"blockbogons,omitempty"` Typev4 string `json:"typev4"` Ipaddr string `json:"ipaddr"` Subnet int32 `json:"subnet"` Gateway *optional.String `json:"gateway,omitempty"` AliasSubnet *optional.Int32 `json:"alias_subnet,omitempty"` AdvDhcpPtTimeout *optional.Int32 `json:"adv_dhcp_pt_timeout,omitempty"` AdvDhcpPtRetry *optional.Int32 `json:"adv_dhcp_pt_retry,omitempty"` AdvDhcpPtSelectTimeout *optional.Int32 `json:"adv_dhcp_pt_select_timeout,omitempty"` AdvDhcpPtReboot *optional.Int32 `json:"adv_dhcp_pt_reboot,omitempty"` AdvDhcpPtBackoffCutoff *optional.Int32 `json:"adv_dhcp_pt_backoff_cutoff,omitempty"` AdvDhcpPtInitialInterval *optional.Int32 `json:"adv_dhcp_pt_initial_interval,omitempty"` AdvDhcpSendOptions *optional.String `json:"adv_dhcp_send_options,omitempty"` AdvDhcpRequestOptions *optional.String `json:"adv_dhcp_request_options,omitempty"` AdvDhcpRequiredOptions *optional.String `json:"adv_dhcp_required_options,omitempty"` AdvDhcpOptionModifiers *optional.String `json:"adv_dhcp_option_modifiers,omitempty"` AdvDhcpConfigFileOverridePath *optional.String `json:"adv_dhcp_config_file_override_path,omitempty"` Typev6 *optional.String `json:"typev6,omitempty"` Ipaddrv6 string `json:"ipaddrv6"` Subnetv6 int32 `json:"subnetv6"` Gatewayv6 *optional.String `json:"gatewayv6,omitempty"` Prefix6Rd string `json:"prefix_6rd"` Gateway6Rd string `json:"gateway_6rd"` Prefix6RdV4Plen int32 `json:"prefix_6rd_v4plen"` Track6Interface string `json:"track6_interface"` }
type InterfaceService ¶
type InterfaceService service
InterfaceService provides interface API methods
func (InterfaceService) Apply ¶
func (s InterfaceService) Apply(ctx context.Context) error
Apply applies pending interface changes
func (InterfaceService) CreateInterface ¶
func (s InterfaceService) CreateInterface( ctx context.Context, newInterface InterfaceRequest, ) (*Interface, error)
CreateInterface creates a new interface.
func (InterfaceService) CreateInterfaceBridge ¶
func (s InterfaceService) CreateInterfaceBridge( ctx context.Context, newBridge InterfaceBridgeRequest, ) (*InterfaceBridge, error)
CreateInterfaceBridge creates a new bridge.
func (InterfaceService) CreateInterfaceGroup ¶
func (s InterfaceService) CreateInterfaceGroup( ctx context.Context, newGroup InterfaceGroupRequest, ) (*InterfaceGroup, error)
CreateInterfaceGroup creates a new interface group.
func (InterfaceService) CreateVLAN ¶
func (s InterfaceService) CreateVLAN( ctx context.Context, newVLAN VLANRequest, ) (*VLAN, error)
CreateVLAN creates a new VLAN.
func (InterfaceService) DeleteInterface ¶
func (s InterfaceService) DeleteInterface(ctx context.Context, interfaceID string) error
DeleteInterface deletes the interface. The interfaceID can be specified in either the interface's descriptive name, the pfSense ID (wan, lan, optx), or the physical interface id (e.g. igb0).
func (InterfaceService) DeleteInterfaceBridge ¶
func (s InterfaceService) DeleteInterfaceBridge(ctx context.Context, idToDelete string) error
DeleteInterfaceBridge deletes a bridge.
func (InterfaceService) DeleteInterfaceGroup ¶
func (s InterfaceService) DeleteInterfaceGroup(ctx context.Context, idToDelete int) error
DeleteInterfaceGroup deletes an interface group.
func (InterfaceService) DeleteVLAN ¶
func (s InterfaceService) DeleteVLAN(ctx context.Context, idToDelete int) error
DeleteVLAN deletes a VLAN.
func (InterfaceService) GetInterface ¶
GetInterface returns a single interface.
func (InterfaceService) GetInterfaceBridge ¶
func (s InterfaceService) GetInterfaceBridge(ctx context.Context, id string) (*InterfaceBridge, error)
GetInterfaceBridge returns the bridge with the given ID.
func (InterfaceService) GetInterfaceGroup ¶
func (s InterfaceService) GetInterfaceGroup(ctx context.Context, id int) (*InterfaceGroup, error)
GetInterfaceGroup returns the interface group with the given ID.
func (InterfaceService) ListInterfaceBridges ¶
func (s InterfaceService) ListInterfaceBridges(ctx context.Context) ([]*InterfaceBridge, error)
ListInterfaceBridges returns the bridges.
func (InterfaceService) ListInterfaceGroups ¶
func (s InterfaceService) ListInterfaceGroups(ctx context.Context) ([]*InterfaceGroup, error)
ListInterfaceGroups returns the interface groups.
func (InterfaceService) ListInterfaces ¶
func (s InterfaceService) ListInterfaces(ctx context.Context) ([]*Interface, error)
ListInterfaces returns a list of the interfaces.
func (InterfaceService) ListVLANs ¶
func (s InterfaceService) ListVLANs(ctx context.Context) ([]*VLAN, error)
ListVLANs returns the VLANs
func (InterfaceService) PutInterfaceGroups ¶
func (s InterfaceService) PutInterfaceGroups(ctx context.Context, groups []*InterfaceGroupRequest) ([]*InterfaceGroup, error)
PutInterfaceGroups replaces all interface groups with the given list.
func (InterfaceService) UpdateInterface ¶
func (s InterfaceService) UpdateInterface( ctx context.Context, idToUpdate string, interfaceData InterfaceRequest, ) (*Interface, error)
UpdateInterface modifies an existing interface.
func (InterfaceService) UpdateInterfaceBridge ¶
func (s InterfaceService) UpdateInterfaceBridge( ctx context.Context, idToUpdate string, bridgeData InterfaceBridgeRequest, ) (*InterfaceBridge, error)
UpdateInterfaceBridge updates an existing bridge.
func (InterfaceService) UpdateInterfaceGroup ¶
func (s InterfaceService) UpdateInterfaceGroup( ctx context.Context, idToUpdate int, groupData InterfaceGroupRequest, ) (*InterfaceGroup, error)
UpdateInterfaceGroup updates an existing interface group.
func (InterfaceService) UpdateVLAN ¶
func (s InterfaceService) UpdateVLAN( ctx context.Context, idToUpdate int, vlanData VLANRequest, ) (*VLAN, error)
UpdateVLAN modifies an existing VLAN.