go-fortigate-client

command module
v0.0.0-...-24a86a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

go-fortigate-client

Fortigate GO API client. Supports operations on "firewall", "certificate" and "vpn" for now.

How to use:

import "github.com/Nexinto/go-fortigate-client/fortigate"

c := fortigate.NewWebClient(fortigate.WebClient{
	URL: os.Getenv("FORTIGATE_URL"),
	ApiKey: os.Getenv("FORTIGATE_API_KEY")})

vip := &fortigate.VIP{
		Name:            "myvip",
		Type:            fortigate.VIPTypeServerLoadBalance,
		LdbMethod:       fortigate.VIPLdbMethodRoundRobin,
		PortmappingType: fortigate.VIPPortmappingType1To1,
		Extintf:         "any",
		ServerType:      fortigate.VIPServerTypeTcp,
		Comment:         "my service",
		Extip:           "10.90.250.1",
		Extport:         "80",
		Realservers: []fortigate.VIPRealservers{
			{Ip: "10.90.251.1", Port: 80},
			{Ip: "10.90.251.2", Port: 80},
			{Ip: "10.90.251.3", Port: 80},
			{Ip: "10.90.251.4", Port: 80},
		},
	}
	
id, err := c.CreateVIP(vip)

...

err = c.UpdateVIP(vip)

...

err := c.DeleteVIP(id)

See fgcmd.go for more examples.

Create a Fake client for testing:


c := fortigate.NewFakeClient()

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL