state

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 ACLGroup added in v0.5.0

type ACLGroup struct {
	kong.ACLGroup `yaml:",inline"`
	Meta
}

ACLGroup represents an ACL group for a consumer in Kong. It adds some helper methods along with Meta to the original ACLGroup object.

func (*ACLGroup) Equal added in v0.5.0

func (b1 *ACLGroup) Equal(b2 *ACLGroup) bool

Equal returns true if b1 and b2 are equal.

func (*ACLGroup) EqualWithOpts added in v0.5.0

func (b1 *ACLGroup) EqualWithOpts(b2 *ACLGroup, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if j1 and j2 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 ACLGroupsCollection added in v0.5.0

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

ACLGroupsCollection stores and indexes acl-group credentials.

func NewACLGroupsCollection added in v0.5.0

func NewACLGroupsCollection() (*ACLGroupsCollection, error)

NewACLGroupsCollection instantiates a ACLGroupsCollection.

func (*ACLGroupsCollection) Add added in v0.5.0

func (k *ACLGroupsCollection) Add(aclGroup ACLGroup) error

Add adds aclGroup to ACLGroupsCollection

func (*ACLGroupsCollection) DeleteByID added in v0.5.0

func (k *ACLGroupsCollection) DeleteByID(ID string) error

DeleteByID deletes an acl-group by ID.

func (*ACLGroupsCollection) Get added in v0.5.0

func (k *ACLGroupsCollection) Get(consumerUsernameOrID,
	groupOrID string) (*ACLGroup, error)

Get gets a acl-group for a consumer by group or ID.

func (*ACLGroupsCollection) GetAll added in v0.5.0

func (k *ACLGroupsCollection) GetAll() ([]*ACLGroup, error)

GetAll gets all acl-groups.

func (*ACLGroupsCollection) GetAllByConsumerID added in v0.5.0

func (k *ACLGroupsCollection) GetAllByConsumerID(id string) ([]*ACLGroup,
	error)

GetAllByConsumerID returns all acl-group credentials belong to a Consumer with id.

func (*ACLGroupsCollection) GetAllByConsumerUsername added in v0.5.0

func (k *ACLGroupsCollection) GetAllByConsumerUsername(username string) ([]*ACLGroup,
	error)

GetAllByConsumerUsername returns all acl-group credentials belong to a Consumer with username.

func (*ACLGroupsCollection) GetByID added in v0.5.0

func (k *ACLGroupsCollection) GetByID(id string) (*ACLGroup, error)

GetByID gets an acl-group with id.

func (*ACLGroupsCollection) Update added in v0.5.0

func (k *ACLGroupsCollection) Update(aclGroup ACLGroup) error

Update updates an existing acl-group credential.

type BasicAuth added in v0.5.0

type BasicAuth struct {
	kong.BasicAuth `yaml:",inline"`
	Meta
}

BasicAuth represents a basic-auth credential in Kong. It adds some helper methods along with Meta to the original BasicAuth object.

func (*BasicAuth) Equal added in v0.5.0

func (b1 *BasicAuth) Equal(b2 *BasicAuth) bool

Equal returns true if b1 and b2 are equal.

func (*BasicAuth) EqualWithOpts added in v0.5.0

func (b1 *BasicAuth) EqualWithOpts(b2 *BasicAuth, ignoreID,
	ignoreTS, ignorePassword, ignoreForeign bool) bool

EqualWithOpts returns true if j1 and j2 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 BasicAuthsCollection added in v0.5.0

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

BasicAuthsCollection stores and indexes basic-auth credentials.

func NewBasicAuthsCollection added in v0.5.0

func NewBasicAuthsCollection() (*BasicAuthsCollection, error)

NewBasicAuthsCollection instantiates a BasicAuthsCollection.

func (*BasicAuthsCollection) Add added in v0.5.0

func (k *BasicAuthsCollection) Add(basicAuth BasicAuth) error

Add adds a basic-auth credential to BasicAuthsCollection

func (*BasicAuthsCollection) Delete added in v0.5.0

func (k *BasicAuthsCollection) Delete(usernameOrID string) error

Delete deletes a basic-auth credential by key or ID.

func (*BasicAuthsCollection) Get added in v0.5.0

func (k *BasicAuthsCollection) Get(usernameOrID string) (*BasicAuth, error)

Get gets a basic-auth credential by or ID.

func (*BasicAuthsCollection) GetAll added in v0.5.0

func (k *BasicAuthsCollection) GetAll() ([]*BasicAuth, error)

GetAll gets all basic-auth credentials.

func (*BasicAuthsCollection) GetAllByConsumerID added in v0.5.0

func (k *BasicAuthsCollection) GetAllByConsumerID(id string) ([]*BasicAuth,
	error)

GetAllByConsumerID returns all basic-auth credentials belong to a Consumer with id.

func (*BasicAuthsCollection) GetAllByConsumerUsername added in v0.5.0

func (k *BasicAuthsCollection) GetAllByConsumerUsername(username string) ([]*BasicAuth,
	error)

GetAllByConsumerUsername returns all basic-auth credentials belong to a Consumer with username.

func (*BasicAuthsCollection) Update added in v0.5.0

func (k *BasicAuthsCollection) Update(basicAuth BasicAuth) error

Update updates an existing basic-auth credential.

type CACertificate added in v0.5.0

type CACertificate struct {
	kong.CACertificate `yaml:",inline"`
	Meta
}

CACertificate represents a CACertificate in Kong. It adds some helper methods along with Meta to the original CACertificate object.

func (*CACertificate) Equal added in v0.5.0

func (c1 *CACertificate) Equal(c2 *CACertificate) bool

Equal returns true if c1 and c2 are equal.

func (*CACertificate) EqualWithOpts added in v0.5.0

func (c1 *CACertificate) EqualWithOpts(c2 *CACertificate,
	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 CACertificatesCollection added in v0.5.0

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

CACertificatesCollection stores and indexes Kong CACertificates.

func NewCACertificatesCollection added in v0.5.0

func NewCACertificatesCollection() (*CACertificatesCollection, error)

NewCACertificatesCollection instantiates a CACertificatesCollection.

func (*CACertificatesCollection) Add added in v0.5.0

Add adds a caCert to the collection

func (*CACertificatesCollection) Delete added in v0.5.0

func (k *CACertificatesCollection) Delete(certOrID string) error

Delete deletes a caCertificate by looking up it's cert and key.

func (*CACertificatesCollection) Get added in v0.5.0

func (k *CACertificatesCollection) Get(certOrID string) (*CACertificate, error)

Get gets a caCertificate by cert or ID.

func (*CACertificatesCollection) GetAll added in v0.5.0

func (k *CACertificatesCollection) GetAll() ([]*CACertificate, error)

GetAll gets a caCertificate by name or ID.

func (*CACertificatesCollection) Update added in v0.5.0

func (k *CACertificatesCollection) Update(caCert CACertificate) error

Update udpates an existing caCert. It returns an error if the caCert is not already present.

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

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 existing certificate. It returns an error if the certificate is not already present.

type Consumer added in v0.2.0

type Consumer struct {
	kong.Consumer `yaml:",inline"`
	Meta
}

Consumer represents a consumer in Kong. It adds some helper methods along with Meta to the original Consumer object.

func (*Consumer) Equal added in v0.2.0

func (c1 *Consumer) Equal(c2 *Consumer) bool

Equal returns true if c1 and c2 are equal.

func (*Consumer) EqualWithOpts added in v0.2.0

func (c1 *Consumer) EqualWithOpts(c2 *Consumer,
	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 ConsumersCollection added in v0.2.0

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

ConsumersCollection stores and indexes Kong Consumers.

func NewConsumersCollection added in v0.2.0

func NewConsumersCollection() (*ConsumersCollection, error)

NewConsumersCollection instantiates a ConsumersCollection.

func (*ConsumersCollection) Add added in v0.2.0

func (k *ConsumersCollection) Add(consumer Consumer) error

Add adds a consumer to the collection

func (*ConsumersCollection) Delete added in v0.2.0

func (k *ConsumersCollection) Delete(usernameOrID string) error

Delete deletes a consumer by name or ID.

func (*ConsumersCollection) Get added in v0.2.0

func (k *ConsumersCollection) Get(userNameOrID string) (*Consumer, error)

Get gets a consumer by name or ID.

func (*ConsumersCollection) GetAll added in v0.2.0

func (k *ConsumersCollection) GetAll() ([]*Consumer, error)

GetAll gets a consumer by name or ID.

func (*ConsumersCollection) Update added in v0.2.0

func (k *ConsumersCollection) Update(consumer Consumer) error

Update udpates an existing consumer. It returns an error if the consumer is not already present.

type HMACAuth added in v0.5.0

type HMACAuth struct {
	kong.HMACAuth `yaml:",inline"`
	Meta
}

HMACAuth represents a key-auth credential in Kong. It adds some helper methods along with Meta to the original HMACAuth object.

func (*HMACAuth) Equal added in v0.5.0

func (h1 *HMACAuth) Equal(h2 *HMACAuth) bool

Equal returns true if h1 and h2 are equal.

func (*HMACAuth) EqualWithOpts added in v0.5.0

func (h1 *HMACAuth) EqualWithOpts(h2 *HMACAuth, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if h1 and h2 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 HMACAuthsCollection added in v0.5.0

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

HMACAuthsCollection stores and indexes hmac-auth credentials.

func NewHMACAuthsCollection added in v0.5.0

func NewHMACAuthsCollection() (*HMACAuthsCollection, error)

NewHMACAuthsCollection instantiates a HMACAuthsCollection.

func (*HMACAuthsCollection) Add added in v0.5.0

func (k *HMACAuthsCollection) Add(hmacAuth HMACAuth) error

Add adds a hmac-auth credential to HMACAuthsCollection

func (*HMACAuthsCollection) Delete added in v0.5.0

func (k *HMACAuthsCollection) Delete(usernameOrID string) error

Delete deletes a hmac-auth credential by key or ID.

func (*HMACAuthsCollection) Get added in v0.5.0

func (k *HMACAuthsCollection) Get(usernameOrID string) (*HMACAuth, error)

Get gets a hmac-auth credential by or ID.

func (*HMACAuthsCollection) GetAll added in v0.5.0

func (k *HMACAuthsCollection) GetAll() ([]*HMACAuth, error)

GetAll gets all hmac-auth credentials.

func (*HMACAuthsCollection) GetAllByConsumerID added in v0.5.0

func (k *HMACAuthsCollection) GetAllByConsumerID(id string) ([]*HMACAuth,
	error)

GetAllByConsumerID returns all hmac-auth credentials belong to a Consumer with id.

func (*HMACAuthsCollection) GetAllByConsumerUsername added in v0.5.0

func (k *HMACAuthsCollection) GetAllByConsumerUsername(username string) ([]*HMACAuth,
	error)

GetAllByConsumerUsername returns all hmac-auth credentials belong to a Consumer with username.

func (*HMACAuthsCollection) Update added in v0.5.0

func (k *HMACAuthsCollection) Update(hmacAuth HMACAuth) error

Update updates an existing hmac-auth credential.

type JWTAuth added in v0.5.0

type JWTAuth struct {
	kong.JWTAuth `yaml:",inline"`
	Meta
}

JWTAuth represents a jwt credential in Kong. It adds some helper methods along with Meta to the original JWTAuth object.

func (*JWTAuth) Equal added in v0.5.0

func (j1 *JWTAuth) Equal(j2 *JWTAuth) bool

Equal returns true if j1 and j2 are equal.

func (*JWTAuth) EqualWithOpts added in v0.5.0

func (j1 *JWTAuth) EqualWithOpts(j2 *JWTAuth, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if j1 and j2 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 JWTAuthsCollection added in v0.5.0

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

JWTAuthsCollection stores and indexes key-auth credentials.

func NewJWTAuthsCollection added in v0.5.0

func NewJWTAuthsCollection() (*JWTAuthsCollection, error)

NewJWTAuthsCollection instantiates a JWTAuthsCollection.

func (*JWTAuthsCollection) Add added in v0.5.0

func (k *JWTAuthsCollection) Add(jwtAuth JWTAuth) error

Add adds a key-auth credential to JWTAuthsCollection

func (*JWTAuthsCollection) Delete added in v0.5.0

func (k *JWTAuthsCollection) Delete(keyOrID string) error

Delete deletes a key-auth credential by key or ID.

func (*JWTAuthsCollection) Get added in v0.5.0

func (k *JWTAuthsCollection) Get(keyOrID string) (*JWTAuth, error)

Get gets a key-auth credential by key or ID.

func (*JWTAuthsCollection) GetAll added in v0.5.0

func (k *JWTAuthsCollection) GetAll() ([]*JWTAuth, error)

GetAll gets all key-auth credentials.

func (*JWTAuthsCollection) GetAllByConsumerID added in v0.5.0

func (k *JWTAuthsCollection) GetAllByConsumerID(id string) ([]*JWTAuth,
	error)

GetAllByConsumerID returns all key-auth credentials belong to a Consumer with id.

func (*JWTAuthsCollection) GetAllByConsumerUsername added in v0.5.0

func (k *JWTAuthsCollection) GetAllByConsumerUsername(username string) ([]*JWTAuth,
	error)

GetAllByConsumerUsername returns all key-auth credentials belong to a Consumer with username.

func (*JWTAuthsCollection) Update added in v0.5.0

func (k *JWTAuthsCollection) Update(jwtAuth JWTAuth) error

Update updates an existing key-auth credential.

type KeyAuth added in v0.5.0

type KeyAuth struct {
	kong.KeyAuth `yaml:",inline"`
	Meta
}

KeyAuth represents a key-auth credential in Kong. It adds some helper methods along with Meta to the original KeyAuth object.

func (*KeyAuth) Equal added in v0.5.0

func (k1 *KeyAuth) Equal(k2 *KeyAuth) bool

Equal returns true if k1 and k2 are equal.

func (*KeyAuth) EqualWithOpts added in v0.5.0

func (k1 *KeyAuth) EqualWithOpts(k2 *KeyAuth, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if k1 and k2 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 KeyAuthsCollection added in v0.5.0

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

KeyAuthsCollection stores and indexes key-auth credentials.

func NewKeyAuthsCollection added in v0.5.0

func NewKeyAuthsCollection() (*KeyAuthsCollection, error)

NewKeyAuthsCollection instantiates a KeyAuthsCollection.

func (*KeyAuthsCollection) Add added in v0.5.0

func (k *KeyAuthsCollection) Add(keyAuth KeyAuth) error

Add adds a key-auth credential to KeyAuthsCollection

func (*KeyAuthsCollection) Delete added in v0.5.0

func (k *KeyAuthsCollection) Delete(keyOrID string) error

Delete deletes a key-auth credential by key or ID.

func (*KeyAuthsCollection) Get added in v0.5.0

func (k *KeyAuthsCollection) Get(keyOrID string) (*KeyAuth, error)

Get gets a key-auth credential by key or ID.

func (*KeyAuthsCollection) GetAll added in v0.5.0

func (k *KeyAuthsCollection) GetAll() ([]*KeyAuth, error)

GetAll gets all key-auth credentials.

func (*KeyAuthsCollection) GetAllByConsumerID added in v0.5.0

func (k *KeyAuthsCollection) GetAllByConsumerID(id string) ([]*KeyAuth,
	error)

GetAllByConsumerID returns all key-auth credentials belong to a Consumer with id.

func (*KeyAuthsCollection) GetAllByConsumerUsername added in v0.5.0

func (k *KeyAuthsCollection) GetAllByConsumerUsername(username string) ([]*KeyAuth,
	error)

GetAllByConsumerUsername returns all key-auth credentials belong to a Consumer with username.

func (*KeyAuthsCollection) Update added in v0.5.0

func (k *KeyAuthsCollection) Update(keyAuth KeyAuth) error

Update updates an existing key-auth credential.

type KongState

type KongState struct {
	Services       *ServicesCollection
	Routes         *RoutesCollection
	Upstreams      *UpstreamsCollection
	Targets        *TargetsCollection
	Certificates   *CertificatesCollection
	CACertificates *CACertificatesCollection
	Plugins        *PluginsCollection
	Consumers      *ConsumersCollection

	KeyAuths    *KeyAuthsCollection
	HMACAuths   *HMACAuthsCollection
	JWTAuths    *JWTAuthsCollection
	BasicAuths  *BasicAuthsCollection
	ACLGroups   *ACLGroupsCollection
	Oauth2Creds *Oauth2CredsCollection
}

KongState is an in-memory database representation of Kong's configuration.

func NewKongState

func NewKongState() (*KongState, error)

NewKongState creates a new in-memory KongState.

type Meta

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

Meta stores metadata for any entity.

func (*Meta) AddMeta

func (m *Meta) AddMeta(key string, obj interface{})

AddMeta adds key->obj metadata. It will override the old obj in key is already present.

func (*Meta) GetMeta

func (m *Meta) GetMeta(key string) interface{}

GetMeta returns the obj previously added using AddMeta(). It returns nil if key is not present.

type Oauth2Credential added in v0.5.1

type Oauth2Credential struct {
	kong.Oauth2Credential `yaml:",inline"`
	Meta
}

Oauth2Credential represents an Oauth2 credential in Kong. It adds some helper methods along with Meta to the original Oauth2Credential object.

func (*Oauth2Credential) Equal added in v0.5.1

func (k1 *Oauth2Credential) Equal(k2 *Oauth2Credential) bool

Equal returns true if k1 and k2 are equal.

func (*Oauth2Credential) EqualWithOpts added in v0.5.1

func (k1 *Oauth2Credential) EqualWithOpts(k2 *Oauth2Credential, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if k1 and k2 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 Oauth2CredsCollection added in v0.5.1

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

Oauth2CredsCollection stores and indexes oauth2 credentials.

func NewOauth2CredsCollection added in v0.5.1

func NewOauth2CredsCollection() (*Oauth2CredsCollection, error)

NewOauth2CredsCollection instantiates a Oauth2CredsCollection.

func (*Oauth2CredsCollection) Add added in v0.5.1

func (k *Oauth2CredsCollection) Add(oauth2Cred Oauth2Credential) error

Add adds an oauth2 credential to Oauth2CredsCollection

func (*Oauth2CredsCollection) Delete added in v0.5.1

func (k *Oauth2CredsCollection) Delete(clientIDorID string) error

Delete deletes an oauth2 credential by client_id or ID.

func (*Oauth2CredsCollection) Get added in v0.5.1

func (k *Oauth2CredsCollection) Get(clientIDorID string) (*Oauth2Credential, error)

Get gets an oauth2 credential by client_id or ID.

func (*Oauth2CredsCollection) GetAll added in v0.5.1

func (k *Oauth2CredsCollection) GetAll() ([]*Oauth2Credential, error)

GetAll gets all oauth2 credentials.

func (*Oauth2CredsCollection) GetAllByConsumerID added in v0.5.1

func (k *Oauth2CredsCollection) GetAllByConsumerID(id string) ([]*Oauth2Credential,
	error)

GetAllByConsumerID returns all oauth2 credentials belong to a Consumer with id.

func (*Oauth2CredsCollection) GetAllByConsumerUsername added in v0.5.1

func (k *Oauth2CredsCollection) GetAllByConsumerUsername(
	username string) ([]*Oauth2Credential, error)

GetAllByConsumerUsername returns all oauth2 credentials belong to a Consumer with username.

func (*Oauth2CredsCollection) Update added in v0.5.1

func (k *Oauth2CredsCollection) Update(oauth2Cred Oauth2Credential) error

Update updates an existing oauth2 credential.

type Plugin

type Plugin struct {
	kong.Plugin `yaml:",inline"`
	Meta
}

Plugin represents a route in Kong. It adds some helper methods along with Meta to the original Plugin object.

func (*Plugin) Equal

func (p1 *Plugin) Equal(p2 *Plugin) bool

Equal returns true if r1 and r2 are equal. TODO add compare array without position

func (*Plugin) EqualWithOpts

func (p1 *Plugin) EqualWithOpts(p2 *Plugin, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if p1 and p2 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 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 added in v0.2.0

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

type Route struct {
	kong.Route `yaml:",inline"`
	Meta
}

Route represents a route in Kong. It adds some helper methods along with Meta to the original Route object.

func (*Route) Equal

func (r1 *Route) Equal(r2 *Route) bool

Equal returns true if r1 and r2 are equal. TODO add compare array without position

func (*Route) EqualWithOpts

func (r1 *Route) EqualWithOpts(r2 *Route, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if r1 and r2 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 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

type SNI struct {
	kong.SNI `yaml:",inline"`
	Meta
}

SNI represents a SNI in Kong. It adds some helper methods along with Meta to the original SNI object.

func (*SNI) Equal

func (s1 *SNI) Equal(s2 *SNI) bool

Equal returns true if s1 and s2 are equal. TODO add compare array without position

func (*SNI) EqualWithOpts

func (s1 *SNI) EqualWithOpts(s2 *SNI, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if s1 and s2 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 Service

type Service struct {
	kong.Service `yaml:",inline"`
	Meta
}

Service represents a service in Kong. It adds some helper methods along with Meta to the original Service object.

func (*Service) Equal

func (s1 *Service) Equal(s2 *Service) bool

Equal returns true if s1 and s2 are equal.

func (*Service) EqualWithOpts

func (s1 *Service) EqualWithOpts(s2 *Service,
	ignoreID bool, ignoreTS bool) bool

EqualWithOpts returns true if s1 and s2 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 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 existing service. It returns an error if the service is not already present.

type Target

type Target struct {
	kong.Target `yaml:",inline"`
	Meta
}

Target represents a Target in Kong. It adds some helper methods along with Meta to the original Target object.

func (*Target) Equal

func (t1 *Target) Equal(t2 *Target) bool

Equal returns true if t1 and t2 are equal. TODO add compare array without position

func (*Target) EqualWithOpts

func (t1 *Target) EqualWithOpts(t2 *Target, ignoreID,
	ignoreTS, ignoreForeign bool) bool

EqualWithOpts returns true if t1 and t2 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 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(upstreamNameOrID, targetOrID string) error

Delete deletes a target by its ID.

func (*TargetsCollection) Get

func (k *TargetsCollection) Get(upstreamNameOrID,
	targetOrID string) (*Target, error)

Get get a target by upstreamName and target

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

type Upstream struct {
	kong.Upstream `yaml:",inline"`
	Meta
}

Upstream represents a upstream in Kong. It adds some helper methods along with Meta to the original Upstream object.

func (*Upstream) Equal

func (u1 *Upstream) Equal(u2 *Upstream) bool

Equal returns true if u1 and u2 are equal.

func (*Upstream) EqualWithOpts

func (u1 *Upstream) EqualWithOpts(u2 *Upstream,
	ignoreID bool, ignoreTS bool) bool

EqualWithOpts returns true if u1 and u2 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 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 existing upstream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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