f5

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2016 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package f5 provides a client for using the F5 API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRequestError

func IsRequestError(err error) bool

IsRequestError reports whether err is a RequestError.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client manages communication with the F5 API.

func NewBasicClient

func NewBasicClient(baseURL, user, password string) (*Client, error)

NewBasicClient creates a new F5 client with HTTP Basic Authentication.

baseURL is the base URL of the F5 API server.

func NewTokenClient

func NewTokenClient(baseURL, user, password, loginRef string, sslCheck bool) (*Client, error)

NewTokenClient creates a new F5 client with token based authentication.

baseURL is the base URL of the F5 API server.

func (*Client) DisableCertCheck

func (c *Client) DisableCertCheck()

DisableCertCheck disables certificate verification, meaning that insecure certificate will not cause any error.

func (Client) Do

func (c Client) Do(req *http.Request) (*http.Response, error)

Do sends an HTTP request and returns an HTTP response. It is just a wrapper arround http.Client Do method.

Callers should close resp.Body when done reading from it.

See http package documentation for more information:

https://golang.org/pkg/net/http/#Client.Do

func (Client) MakeRequest

func (c Client) MakeRequest(method, restPath string, data interface{}) (*http.Request, error)

MakeRequest creates a request with headers appropriately set to make authenticated requests. This method must be called for every new request.

func (Client) ModQuery

func (c Client) ModQuery(method, restPath string, inputData interface{}) error

ModQuery performs a modification query such as POST, PUT or DELETE.

func (Client) ReadError

func (c Client) ReadError(resp *http.Response) error

ReadError checks if a HTTP response contains an error and returns it.

func (Client) ReadQuery

func (c Client) ReadQuery(restPath string, outputData interface{}) error

ReadQuery performs a GET query and unmarshal the response (from JSON) into outputData.

outputData must be a pointer.

func (Client) SendRequest

func (c Client) SendRequest(method, restPath string, data interface{}) (*http.Response, error)

SendRequest is a shortcut for MakeRequest() + Do() + ReadError().

type RequestError

type RequestError struct {
	Code     int      `json:"code,omitempty"`
	Message  string   `json:"message,omitempty"`
	ErrStack []string `json:"errorStack,omitempty"`
}

A RequestError is returned as a HTTP Response by the F5 Big IP server in case of error.

func NewRequestError

func NewRequestError(body io.Reader) (*RequestError, error)

NewRequestError unmarshal a RequestError from a HTTP response body.

func (RequestError) Error

func (err RequestError) Error() string

Error implements the errors.Error interface

func (RequestError) String

func (err RequestError) String() string

Directories

Path Synopsis
Package ltm provides a REST client for the /tm/ltm F5 BigIP API.
Package ltm provides a REST client for the /tm/ltm F5 BigIP API.

Jump to

Keyboard shortcuts

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