Documentation ¶
Index ¶
- Variables
- type Certificate
- type CertificatesCollection
- func (k *CertificatesCollection) Add(certificate Certificate) error
- func (k *CertificatesCollection) Delete(ID string) error
- func (k *CertificatesCollection) DeleteByCertKey(cert, key string) error
- func (k *CertificatesCollection) Get(id string) (*Certificate, error)
- func (k *CertificatesCollection) GetAll() ([]*Certificate, error)
- func (k *CertificatesCollection) GetByCertKey(cert, key string) (*Certificate, error)
- func (k *CertificatesCollection) Update(certificate Certificate) error
- type Consumer
- type ConsumersCollection
- func (k *ConsumersCollection) Add(consumer Consumer) error
- func (k *ConsumersCollection) Delete(usernameOrID string) error
- func (k *ConsumersCollection) Get(userNameOrID string) (*Consumer, error)
- func (k *ConsumersCollection) GetAll() ([]*Consumer, error)
- func (k *ConsumersCollection) Update(consumer Consumer) error
- type KongState
- type Meta
- type Plugin
- type PluginsCollection
- func (k *PluginsCollection) Add(plugin Plugin) error
- func (k *PluginsCollection) Delete(nameOrID string) error
- func (k *PluginsCollection) Get(ID string) (*Plugin, error)
- func (k *PluginsCollection) GetAll() ([]*Plugin, error)
- func (k *PluginsCollection) GetAllByConsumerID(id string) ([]*Plugin, error)
- func (k *PluginsCollection) GetAllByName(name string) ([]*Plugin, error)
- func (k *PluginsCollection) GetAllByRouteID(id string) ([]*Plugin, error)
- func (k *PluginsCollection) GetAllByServiceID(id string) ([]*Plugin, error)
- func (k *PluginsCollection) GetByProp(name, serviceName, routeName string, consumerUsername string) (*Plugin, error)
- func (k *PluginsCollection) Update(plugin Plugin) error
- type Route
- type RoutesCollection
- func (k *RoutesCollection) Add(route Route) error
- func (k *RoutesCollection) Delete(nameOrID string) error
- func (k *RoutesCollection) Get(ID string) (*Route, error)
- func (k *RoutesCollection) GetAll() ([]*Route, error)
- func (k *RoutesCollection) GetAllByServiceID(id string) ([]*Route, error)
- func (k *RoutesCollection) GetAllByServiceName(name string) ([]*Route, error)
- func (k *RoutesCollection) Update(route Route) error
- type SNI
- type Service
- type ServicesCollection
- type Target
- type TargetsCollection
- func (k *TargetsCollection) Add(target Target) error
- func (k *TargetsCollection) Delete(nameOrID string) error
- func (k *TargetsCollection) Get(ID string) (*Target, error)
- func (k *TargetsCollection) GetAll() ([]*Target, error)
- func (k *TargetsCollection) GetAllByUpstreamID(id string) ([]*Target, error)
- func (k *TargetsCollection) GetAllByUpstreamName(name string) ([]*Target, error)
- func (k *TargetsCollection) Update(target Target) error
- type Upstream
- type UpstreamsCollection
- func (k *UpstreamsCollection) Add(upstream Upstream) error
- func (k *UpstreamsCollection) Delete(nameOrID string) error
- func (k *UpstreamsCollection) Get(nameOrID string) (*Upstream, error)
- func (k *UpstreamsCollection) GetAll() ([]*Upstream, error)
- func (k *UpstreamsCollection) Update(upstream Upstream) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("entity not found")
ErrNotFound is an error type that is returned when an entity is not found in the state.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate struct { kong.Certificate `yaml:",inline"` Meta }
Certificate represents a upstream in Kong. It adds some helper methods along with Meta to the original Certificate object.
func (*Certificate) Equal ¶
func (c1 *Certificate) Equal(c2 *Certificate) bool
Equal returns true if c1 and c2 are equal.
func (*Certificate) EqualWithOpts ¶
func (c1 *Certificate) EqualWithOpts(c2 *Certificate, ignoreID bool, ignoreTS bool) bool
EqualWithOpts returns true if c1 and c2 are equal. If ignoreID is set to true, IDs will be ignored while comparison. If ignoreTS is set to true, timestamp fields will be ignored.
type CertificatesCollection ¶
type CertificatesCollection struct {
// contains filtered or unexported fields
}
CertificatesCollection stores and indexes Kong Certificates.
func NewCertificatesCollection ¶
func NewCertificatesCollection() (*CertificatesCollection, error)
NewCertificatesCollection instantiates a CertificatesCollection.
func (*CertificatesCollection) Add ¶
func (k *CertificatesCollection) Add(certificate Certificate) error
Add adds a certificate to the collection
func (*CertificatesCollection) Delete ¶
func (k *CertificatesCollection) Delete(ID string) error
Delete deletes a certificate by ID.
func (*CertificatesCollection) DeleteByCertKey ¶
func (k *CertificatesCollection) DeleteByCertKey(cert, key string) error
DeleteByCertKey deletes a certificate by looking up it's cert and key.
func (*CertificatesCollection) Get ¶
func (k *CertificatesCollection) Get(id string) (*Certificate, error)
Get gets a certificate by name or ID.
func (*CertificatesCollection) GetAll ¶
func (k *CertificatesCollection) GetAll() ([]*Certificate, error)
GetAll gets a certificate by name or ID.
func (*CertificatesCollection) GetByCertKey ¶
func (k *CertificatesCollection) GetByCertKey(cert, key string) (*Certificate, error)
GetByCertKey gets a certificate with the same key and cert from the collection.
func (*CertificatesCollection) Update ¶
func (k *CertificatesCollection) Update(certificate Certificate) error
Update udpates an exisitng certificate. It returns an error if the certificate is not already present.
type Consumer ¶
Consumer represents a consumer in Kong. It adds some helper methods along with Meta to the original Consumer object.
type ConsumersCollection ¶
type ConsumersCollection struct {
// contains filtered or unexported fields
}
ConsumersCollection stores and indexes Kong Consumers.
func NewConsumersCollection ¶
func NewConsumersCollection() (*ConsumersCollection, error)
NewConsumersCollection instantiates a ConsumersCollection.
func (*ConsumersCollection) Add ¶
func (k *ConsumersCollection) Add(consumer Consumer) error
Add adds a consumer to the collection
func (*ConsumersCollection) Delete ¶
func (k *ConsumersCollection) Delete(usernameOrID string) error
Delete deletes a consumer by name or ID.
func (*ConsumersCollection) Get ¶
func (k *ConsumersCollection) Get(userNameOrID string) (*Consumer, error)
Get gets a consumer by name or ID.
func (*ConsumersCollection) GetAll ¶
func (k *ConsumersCollection) GetAll() ([]*Consumer, error)
GetAll gets a consumer by name or ID.
func (*ConsumersCollection) Update ¶
func (k *ConsumersCollection) Update(consumer Consumer) error
Update udpates an exisitng consumer. It returns an error if the consumer is not already present.
type KongState ¶
type KongState struct { Services *ServicesCollection Routes *RoutesCollection Upstreams *UpstreamsCollection Targets *TargetsCollection Certificates *CertificatesCollection Plugins *PluginsCollection Consumers *ConsumersCollection }
KongState is an in-memory database representation of Kong's configuration.
func NewKongState ¶
NewKongState creates a new in-memory KongState.
type Meta ¶
type Meta struct {
// contains filtered or unexported fields
}
Meta stores metadata for any entity.
type Plugin ¶
Plugin represents a route in Kong. It adds some helper methods along with Meta to the original Plugin object.
type PluginsCollection ¶
type PluginsCollection struct {
// contains filtered or unexported fields
}
PluginsCollection stores and indexes Kong Services.
func NewPluginsCollection ¶
func NewPluginsCollection() (*PluginsCollection, error)
NewPluginsCollection instantiates a PluginsCollection.
func (*PluginsCollection) Add ¶
func (k *PluginsCollection) Add(plugin Plugin) error
Add adds a plugin to PluginsCollection
func (*PluginsCollection) Delete ¶
func (k *PluginsCollection) Delete(nameOrID string) error
Delete deletes a plugin by name or ID.
func (*PluginsCollection) Get ¶
func (k *PluginsCollection) Get(ID string) (*Plugin, error)
Get gets a plugin by name or ID.
func (*PluginsCollection) GetAll ¶
func (k *PluginsCollection) GetAll() ([]*Plugin, error)
GetAll gets a plugin by name or ID.
func (*PluginsCollection) GetAllByConsumerID ¶
func (k *PluginsCollection) GetAllByConsumerID(id string) ([]*Plugin, error)
GetAllByConsumerID returns all plugins referencing a consumer by its id.
func (*PluginsCollection) GetAllByName ¶
func (k *PluginsCollection) GetAllByName(name string) ([]*Plugin, error)
GetAllByName returns all plugins of a specific type (key-auth, ratelimiting, etc).
func (*PluginsCollection) GetAllByRouteID ¶
func (k *PluginsCollection) GetAllByRouteID(id string) ([]*Plugin, error)
GetAllByRouteID returns all plugins referencing a service by its id.
func (*PluginsCollection) GetAllByServiceID ¶
func (k *PluginsCollection) GetAllByServiceID(id string) ([]*Plugin, error)
GetAllByServiceID returns all plugins referencing a service by its id.
func (*PluginsCollection) GetByProp ¶
func (k *PluginsCollection) GetByProp(name, serviceName, routeName string, consumerUsername string) (*Plugin, error)
GetByProp returns a plugin which matches all the properties passed in the arguments. If serviceName and routeName are empty strings, then a global plugin is searched. If serviceName is empty, a plugin for the route with routeName is searched. If routeName is empty, a plugin for the route with serviceName is searched.
func (*PluginsCollection) Update ¶
func (k *PluginsCollection) Update(plugin Plugin) error
Update updates a plugin
type Route ¶
Route represents a route in Kong. It adds some helper methods along with Meta to the original Route object.
type RoutesCollection ¶
type RoutesCollection struct {
// contains filtered or unexported fields
}
RoutesCollection stores and indexes Kong Services.
func NewRoutesCollection ¶
func NewRoutesCollection() (*RoutesCollection, error)
NewRoutesCollection instantiates a RoutesCollection.
func (*RoutesCollection) Add ¶
func (k *RoutesCollection) Add(route Route) error
Add adds a route to RoutesCollection
func (*RoutesCollection) Delete ¶
func (k *RoutesCollection) Delete(nameOrID string) error
Delete deletes a route by name or ID.
func (*RoutesCollection) Get ¶
func (k *RoutesCollection) Get(ID string) (*Route, error)
Get gets a route by name or ID.
func (*RoutesCollection) GetAll ¶
func (k *RoutesCollection) GetAll() ([]*Route, error)
GetAll gets a route by name or ID.
func (*RoutesCollection) GetAllByServiceID ¶
func (k *RoutesCollection) GetAllByServiceID(id string) ([]*Route, error)
GetAllByServiceID returns all routes referencing a service by its id.
func (*RoutesCollection) GetAllByServiceName ¶
func (k *RoutesCollection) GetAllByServiceName(name string) ([]*Route, error)
GetAllByServiceName returns all routes referencing a service by its name.
func (*RoutesCollection) Update ¶
func (k *RoutesCollection) Update(route Route) error
Update updates a route
type SNI ¶
SNI represents a SNI in Kong. It adds some helper methods along with Meta to the original SNI object.
type Service ¶
Service represents a service in Kong. It adds some helper methods along with Meta to the original Service object.
type ServicesCollection ¶
type ServicesCollection struct {
// contains filtered or unexported fields
}
ServicesCollection stores and indexes Kong Services.
func NewServicesCollection ¶
func NewServicesCollection() (*ServicesCollection, error)
NewServicesCollection instantiates a ServicesCollection.
func (*ServicesCollection) Add ¶
func (k *ServicesCollection) Add(service Service) error
Add adds a service to the collection
func (*ServicesCollection) Delete ¶
func (k *ServicesCollection) Delete(nameOrID string) error
Delete deletes a service by name or ID.
func (*ServicesCollection) Get ¶
func (k *ServicesCollection) Get(nameOrID string) (*Service, error)
Get gets a service by name or ID.
func (*ServicesCollection) GetAll ¶
func (k *ServicesCollection) GetAll() ([]*Service, error)
GetAll gets a service by name or ID.
func (*ServicesCollection) Update ¶
func (k *ServicesCollection) Update(service Service) error
Update udpates an exisitng service. It returns an error if the service is not already present.
type Target ¶
Target represents a Target in Kong. It adds some helper methods along with Meta to the original Target object.
type TargetsCollection ¶
type TargetsCollection struct {
// contains filtered or unexported fields
}
TargetsCollection stores and indexes Kong Upstreams.
func NewTargetsCollection ¶
func NewTargetsCollection() (*TargetsCollection, error)
NewTargetsCollection instantiates a TargetsCollection.
func (*TargetsCollection) Add ¶
func (k *TargetsCollection) Add(target Target) error
Add adds a target to TargetsCollection.
func (*TargetsCollection) Delete ¶
func (k *TargetsCollection) Delete(nameOrID string) error
Delete deletes a target by it's Target or ID.
func (*TargetsCollection) Get ¶
func (k *TargetsCollection) Get(ID string) (*Target, error)
Get gets a target by Target or ID.
func (*TargetsCollection) GetAll ¶
func (k *TargetsCollection) GetAll() ([]*Target, error)
GetAll gets a target by Target or ID.
func (*TargetsCollection) GetAllByUpstreamID ¶
func (k *TargetsCollection) GetAllByUpstreamID(id string) ([]*Target, error)
GetAllByUpstreamID returns all targets referencing a Upstream by its ID.
func (*TargetsCollection) GetAllByUpstreamName ¶
func (k *TargetsCollection) GetAllByUpstreamName( name string) ([]*Target, error)
GetAllByUpstreamName returns all targets referencing a Upstream by its name.
func (*TargetsCollection) Update ¶
func (k *TargetsCollection) Update(target Target) error
Update updates a target
type Upstream ¶
Upstream represents a upstream in Kong. It adds some helper methods along with Meta to the original Upstream object.
type UpstreamsCollection ¶
type UpstreamsCollection struct {
// contains filtered or unexported fields
}
UpstreamsCollection stores and indexes Kong Upstreams.
func NewUpstreamsCollection ¶
func NewUpstreamsCollection() (*UpstreamsCollection, error)
NewUpstreamsCollection instantiates a UpstreamsCollection.
func (*UpstreamsCollection) Add ¶
func (k *UpstreamsCollection) Add(upstream Upstream) error
Add adds an upstream to the collection.
func (*UpstreamsCollection) Delete ¶
func (k *UpstreamsCollection) Delete(nameOrID string) error
Delete deletes an upstream by it's name or ID.
func (*UpstreamsCollection) Get ¶
func (k *UpstreamsCollection) Get(nameOrID string) (*Upstream, error)
Get gets an upstream by name or ID.
func (*UpstreamsCollection) GetAll ¶
func (k *UpstreamsCollection) GetAll() ([]*Upstream, error)
GetAll gets all upstreams in the state.
func (*UpstreamsCollection) Update ¶
func (k *UpstreamsCollection) Update(upstream Upstream) error
Update udpates an exisitng upstream.