plus

package
v1.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const APIVersion = 2

APIVersion is a version of NGINX Plus API

Variables

This section is empty.

Functions

This section is empty.

Types

type NginxAPIController

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

func NewNginxAPIController

func NewNginxAPIController(httpClient *http.Client, endpoint string, local bool) (*NginxAPIController, error)

func (*NginxAPIController) UpdateServers

func (nginx *NginxAPIController) UpdateServers(upstream string, servers []string, config ServerConfig) error

type NginxClient

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

NginxClient lets you add/remove servers to/from NGINX Plus via its API

func NewNginxClient

func NewNginxClient(httpClient *http.Client, apiEndpoint string) (*NginxClient, error)

NewNginxClient creates an NginxClient.

func (*NginxClient) AddHTTPServer

func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error

AddHTTPServer adds the server to the upstream.

func (*NginxClient) CheckIfUpstreamExists

func (client *NginxClient) CheckIfUpstreamExists(upstream string) error

CheckIfUpstreamExists checks if the upstream exists in NGINX. If the upstream doesn't exist, it returns the error.

func (*NginxClient) DeleteHTTPServer

func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error

DeleteHTTPServer the server from the upstream.

func (*NginxClient) GetHTTPServers

func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, error)

GetHTTPServers returns the servers of the upsteam from NGINX.

func (*NginxClient) UpdateHTTPServers

func (client *NginxClient) UpdateHTTPServers(upstream string, servers []UpstreamServer) ([]UpstreamServer, []UpstreamServer, error)

UpdateHTTPServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX.

type ServerConfig added in v1.2.0

type ServerConfig struct {
	MaxFails    int64
	FailTimeout string
	SlowStart   string
}

type UpstreamServer added in v1.2.0

type UpstreamServer struct {
	ID          int64  `json:"id,omitempty"`
	Server      string `json:"server"`
	MaxFails    int64  `json:"max_fails"`
	FailTimeout string `json:"fail_timeout,omitempty"`
	SlowStart   string `json:"slow_start,omitempty"`
}

Jump to

Keyboard shortcuts

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