Documentation ¶
Index ¶
- Constants
- type NginxAPIController
- type NginxClient
- func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error
- func (client *NginxClient) CheckIfUpstreamExists(upstream string) error
- func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error
- func (client *NginxClient) GetHTTPServers(upstream string) ([]UpstreamServer, error)
- func (client *NginxClient) UpdateHTTPServers(upstream string, servers []UpstreamServer) ([]UpstreamServer, []UpstreamServer, error)
- type ServerConfig
- type UpstreamServer
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 (*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
Click to show internal directories.
Click to hide internal directories.