kong

package
v0.0.0-...-50af7b8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Message string `json:"message"`
}

type ApiHandler

type ApiHandler struct {
	Client *sling.Sling
	Kong   *Kong
}

ApiHandler is our object to interface with the Plugin side of the kong API.

func (*ApiHandler) Add

func (ah *ApiHandler) Add(api *data.Api) (*data.Api, error)

Add will create a new api resource on Kong & Handle any conflicts.

func (*ApiHandler) Delete

func (ah *ApiHandler) Delete(params *data.ApiRequestParams) error

Delete will make a DELETE request to remove an api from the Kong service

func (*ApiHandler) List

func (ah *ApiHandler) List(params *data.ApiRequestParams) (*data.ApiList, error)

List will make a GET request with our request params and return a ApiList which contains the number of apis, a list of the apis fetched and a reference to the next page.

func (*ApiHandler) Retrieve

func (ah *ApiHandler) Retrieve(params *data.ApiRequestParams) (*data.Api, error)

Retrieve will make a GET request to fetch a single Api by Name or ID which will be provided in the params

func (*ApiHandler) Update

func (ah *ApiHandler) Update(params *data.ApiRequestParams, updatedData *data.Api) (*data.Api, error)

Update will make a PUT request to update an existing api stored in the Kong service

type Kong

type Kong struct {
	Config *config.Config
	Client *sling.Sling
	Host   string
}

Kong is a type which we'll use to interact with the Kong service & store any state information about our client.

func NewKong

func NewKong(host string, c *config.Config) (*Kong, error)

NewKong should return a new instance of Kong which we can use to interact with the API of the service.

func (*Kong) Apis

func (k *Kong) Apis() *ApiHandler

Apis returns the api handler for the Kong client. This should be a handler which can interact with a running Kong API.

func (*Kong) Ping

func (k *Kong) Ping() error

Ping makes a single GET request to the base host of our Kong service to ensure that the host is reachable.

func (*Kong) Plugins

func (k *Kong) Plugins() *PluginHandler

Plugins returns the plugin handler for the Kong client. This should be a handler which can interact with a running Kong API.

type PluginApiError

type PluginApiError struct {
	ConfigPath      string `json:"config.path,omitempty"`
	ConfigWhitelist string `json:"config.whitelist,omitempty"`
}

PluginApiError should represent the error responses we may get back from Kong

type PluginHandler

type PluginHandler struct {
	Client *sling.Sling
	Kong   *Kong
}

PluginHandler is our object to interface with the Plugin side of the kong API.

func (*PluginHandler) Add

func (ph *PluginHandler) Add(plugin *data.Plugin) (*data.Plugin, error)

Add will create a new plugin resource on Kong & Handle any conflicts.

func (*PluginHandler) Delete

func (ph *PluginHandler) Delete(params *data.PluginRequestParams) error

Delete will make a DELETE request to remove a plugin from the Kong service

func (*PluginHandler) List

List will make a GET request with our request params and return a PluginList which contains the number of plugins, a list of the plugins fetched and a reference to the next page.

func (*PluginHandler) Retrieve

func (ph *PluginHandler) Retrieve(params *data.PluginRequestParams) (*data.Plugin, error)

Retrieve will make a GET request to fetch a single plugin by Name or ID which will be provided in the params

func (*PluginHandler) Update

func (ph *PluginHandler) Update(params *data.PluginRequestParams, updatedData *data.Plugin) (*data.Plugin, error)

Update will make a PUT request to update an existing plugin stored in the Kong service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳