Skip to content

tmarshall98/gofortiadc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gofortiadc

A FortiADC API client enabling Go programs to interact with a Fortiadc server

GoDoc Go Report Card GitHub issues

NOTE

Tested with Fortiadc 5.4 API

Example

package main

import (
	"crypto/tls"
	"log"
	"net/http"
	"net/http/cookiejar"

	"github.com/Ouest-France/gofortiadc"
)

func main() {

	// Construct an http client with cookies
	cookieJar, _ := cookiejar.New(nil)
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{},
	}
	httpClient := &http.Client{
		Jar:       cookieJar,
		Transport: tr,
	}

	// Construct new forti Client instance
	fortiClient := Client{
		Client:   httpClient,
		Address:  "https://myfortiadc.example.com",
		Username: "fortiuser",
		Password: "fortipassword",
	}

	// Send auth request to get authorization token
	err := fortiClient.Login()
	if err != nil {
		log.Fatal(err)
	}

	// Get the list of all virtual servers
	res, err := fortiClient.LoadbalanceGetVirtualServers()
	if err != nil {
		log.Print(err)
	}
}

About

FortiADC API Golang client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%