Documentation ¶
Index ¶
- func FindAPI(a string, list []Data) (bool, int)
- func GetKongAdminURL(namespace string) string
- type API
- type APIPluginData
- type APIPlugins
- type APIS
- type Consumer
- type ConsumerTPR
- type Consumers
- type Data
- type JWTCred
- type JWTCreds
- type KeyCred
- type KeyCreds
- type Kong
- func (k *Kong) ConsumerExists(username string) bool
- func (k *Kong) CreateAPI(api Data) error
- func (k *Kong) CreateConsumer(consumer ConsumerTPR) error
- func (k *Kong) DeleteAPI(name string) error
- func (k *Kong) DeleteConsumer(consumer Consumer) error
- func (k *Kong) DeletePlugin(apiName, pluginID string) error
- func (k *Kong) EnablePlugin(plugin Plugin)
- func (k *Kong) GetAPIs() APIS
- func (k *Kong) GetConsumers() Consumers
- func (k *Kong) GetJWTPluginCreds(username string) JWTCreds
- func (k *Kong) GetKeyPluginCreds(username string) KeyCreds
- func (k *Kong) GetPlugins() APIPlugins
- func (k *Kong) IsPluginExisting(plugin Plugin) (bool, APIPluginData)
- func (k *Kong) Ready(timeout chan bool, ready chan bool)
- func (k *Kong) UpdateAPI(name, upstream string, hosts []string) error
- func (k *Kong) UpdatePlugin(plugin Plugin, ID string)
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKongAdminURL ¶
Types ¶
type API ¶
type API struct { Name string `json:"name"` Upstream string `json:"upstream_url"` Hosts string `json:"hosts"` }
API represents the object required to create an API in Kong
type APIPluginData ¶
type APIPluginData struct { ID string `json:"id"` APIId string `json:"api_id"` Name string `json:"name"` Enabled bool `json:"enabled"` CreatedAt int `json:"created_at"` }
APIPluginData represents data response from /apis/{name}/plugins/
func RemovePlugin ¶
func RemovePlugin(s []APIPluginData, id string) []APIPluginData
RemovePlugin takes an item out of the data array
type APIPlugins ¶
type APIPlugins struct { Total int `json:"total"` Data []APIPluginData `json:"data"` }
APIPlugins represents response from /apis/{name}/plugins/
type Consumer ¶
Consumer represents a user of the API
func RemoveConsumer ¶
RemoveConsumer takes an item out of the data array
type ConsumerTPR ¶
type ConsumerTPR struct { Username string `json:"username"` CustomID string `json:"custom_id"` MaxNumCreds int `json:"maxNumCreds"` }
ConsumerTPR represents a user of the API
func FindConsumer ¶
func FindConsumer(a string, list []ConsumerTPR) (bool, ConsumerTPR)
FindConsumer finds item in existing consumers
type Data ¶
type Data struct { ID string `json:"id"` Name string `json:"name"` CreatedAt time.Duration `json:"created_at"` Hosts []string `json:"hosts"` HTTPIfTerminated bool `json:"http_if_terminated"` HTTPSOnly bool `json:"https_only"` PreserveHost bool `json:"preserve_host"` Retries int `json:"retries"` StripURI bool `json:"strip_uri"` UpstreamConnectTimeout int `json:"upstream_connect_timeout"` UpstreamReadTimeout int `json:"upstream_read_timeout"` UpstreamSendTimeout int `json:"upstream_send_timeout"` UpstreamURL string `json:"upstream_url"` }
Data represents an api
type JWTCred ¶
type JWTCred struct { ConsumerID string `json:"consumer_id"` Algorithm string `json:"algorithm"` CreatedAt int `json:"created_at"` ID string `json:"id"` Key string `json:"key"` Secret string `json:"secret"` }
JWTCred represents jwt cred object
type KeyCred ¶
type KeyCred struct { ConsumerID string `json:"consumer_id"` CreatedAt int `json:"created_at"` ID string `json:"id"` Key string `json:"key"` }
KeyCred represents jwt cred object
type Kong ¶
type Kong struct { KongAdminURL string // contains filtered or unexported fields }
Kong struct
func (*Kong) ConsumerExists ¶
ConsumerExists checks if a consumer exists already
func (*Kong) CreateConsumer ¶
func (k *Kong) CreateConsumer(consumer ConsumerTPR) error
CreateConsumer creates a consumer
func (*Kong) DeleteConsumer ¶
DeleteConsumer deletes a consumer
func (*Kong) DeletePlugin ¶
DeletePlugin deletes Kong plugin
func (*Kong) EnablePlugin ¶
EnablePlugin enables a plugin
func (*Kong) GetConsumers ¶
GetConsumers gets list of consumers
func (*Kong) GetJWTPluginCreds ¶
GetJWTPluginCreds gets creds for
func (*Kong) GetKeyPluginCreds ¶
GetKeyPluginCreds gets creds for
func (*Kong) GetPlugins ¶
func (k *Kong) GetPlugins() APIPlugins
GetPlugins gets list of plugins enabled by api
func (*Kong) IsPluginExisting ¶
func (k *Kong) IsPluginExisting(plugin Plugin) (bool, APIPluginData)
IsPluginExisting determines if a plugin is already existing
func (*Kong) UpdatePlugin ¶
UpdatePlugin updates a plugin
type Plugin ¶
type Plugin struct { // Name of the plugin Name string `json:"name"` // Array of config items to setup plugin Config map[string]string `json:"config"` // Apis to apply the plugin Apis []string `json:"apis"` // Consumers define what users can access the API Consumers []Consumer `json:"consumers"` }
Plugin identifies a kong plugin