kong

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package kong provides Go bindings to Kong's RESTful Admin API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to b.

func Int

func Int(i int) *int

Int returns a pointer to i.

func IsNotFoundErr

func IsNotFoundErr(e error) bool

IsNotFoundErr returns true if the error or it's cause is a 404 response from Kong.

func String

func String(s string) *string

String returns pointer to s.

func StringSlice

func StringSlice(elements ...string) []*string

StringSlice converts a slice of string to a slice of *string

Types

type ActiveHealthcheck

type ActiveHealthcheck struct {
	Concurrency            *int       `json:"concurrency,omitempty" yaml:"concurrency,omitempty"`
	Healthy                *Healthy   `json:"healthy,omitempty" yaml:"healthy,omitempty"`
	HTTPPath               *string    `json:"http_path,omitempty" yaml:"http_path,omitempty"`
	HTTPSSni               *string    `json:"https_sni,omitempty" yaml:"https_sni,omitempty"`
	HTTPSVerifyCertificate *bool      `json:"https_verify_certificate,omitempty" yaml:"https_verify_certificate,omitempty"`
	Type                   *string    `json:"type,omitempty" yaml:"type,omitempty"`
	Timeout                *int       `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Unhealthy              *Unhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
}

ActiveHealthcheck configures active health check probing. +k8s:deepcopy-gen=true

func (*ActiveHealthcheck) DeepCopy

func (in *ActiveHealthcheck) DeepCopy() *ActiveHealthcheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActiveHealthcheck.

func (*ActiveHealthcheck) DeepCopyInto

func (in *ActiveHealthcheck) DeepCopyInto(out *ActiveHealthcheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CIDRPort

type CIDRPort struct {
	IP   *string `json:"ip,omitempty" yaml:"ip,omitempty"`
	Port *int    `json:"port,omitempty" yaml:"port,omitempty"`
}

CIDRPort represents a set of CIDR and a port. +k8s:deepcopy-gen=true

func (*CIDRPort) DeepCopy

func (in *CIDRPort) DeepCopy() *CIDRPort

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CIDRPort.

func (*CIDRPort) DeepCopyInto

func (in *CIDRPort) DeepCopyInto(out *CIDRPort)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CIDRPort) String

func (c *CIDRPort) String() string

type Certificate

type Certificate struct {
	ID        *string   `json:"id,omitempty" yaml:"id,omitempty"`
	Cert      *string   `json:"cert,omitempty" yaml:"cert,omitempty"`
	Key       *string   `json:"key,omitempty" yaml:"key,omitempty"`
	CreatedAt *int64    `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	SNIs      []*string `json:"snis,omitempty" yaml:"snis,omitempty"`
	Tags      []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Certificate represents a Certificate in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#certificate-object +k8s:deepcopy-gen=true

func (*Certificate) DeepCopy

func (in *Certificate) DeepCopy() *Certificate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Certificate.

func (*Certificate) DeepCopyInto

func (in *Certificate) DeepCopyInto(out *Certificate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Certificate) String

func (c *Certificate) String() string

func (*Certificate) Valid

func (c *Certificate) Valid() bool

Valid checks if all the fields in Consumer are valid.

type CertificateService

type CertificateService service

CertificateService handles Certificates in Kong.

func (*CertificateService) Create

func (s *CertificateService) Create(ctx context.Context,
	certificate *Certificate) (*Certificate, error)

Create creates a Certificate in Kong. If an ID is specified, it will be used to create a certificate in Kong, otherwise an ID is auto-generated.

func (*CertificateService) Delete

func (s *CertificateService) Delete(ctx context.Context,
	usernameOrID *string) error

Delete deletes a Certificate in Kong

func (*CertificateService) Get

func (s *CertificateService) Get(ctx context.Context,
	usernameOrID *string) (*Certificate, error)

Get fetches a Certificate in Kong.

func (*CertificateService) List

func (s *CertificateService) List(ctx context.Context,
	opt *ListOpt) ([]*Certificate, *ListOpt, error)

List fetches a list of certificate in Kong. opt can be used to control pagination.

func (*CertificateService) ListAll

func (s *CertificateService) ListAll(ctx context.Context) ([]*Certificate,
	error)

ListAll fetches all Certificates in Kong. This method can take a while if there a lot of Certificates present.

func (*CertificateService) Update

func (s *CertificateService) Update(ctx context.Context,
	certificate *Certificate) (*Certificate, error)

Update updates a Certificate in Kong

type Client

type Client struct {
	Consumers    *ConsumerService
	Services     *Svcservice
	Routes       *RouteService
	Certificates *CertificateService
	Plugins      *PluginService
	SNIs         *SNIService
	Upstreams    *UpstreamService
	Targets      *TargetService

	CustomEntities *CustomEntityService

	custom.Registry
	// contains filtered or unexported fields
}

Client talks to the Admin API or control plane of a Kong cluster

func NewClient

func NewClient(baseURL *string, client *http.Client) (*Client, error)

NewClient returns a Client which talks to Admin API of Kong

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request,
	v interface{}) (*Response, error)

Do executes a HTTP request and returns a response

func (*Client) Root

func (c *Client) Root(ctx context.Context) (map[string]interface{}, error)

Root returns the response of GET request on root of Admin API (GET /).

func (*Client) SetDebugMode

func (c *Client) SetDebugMode(enableDebug bool)

SetDebugMode enables or disables logging of the request to the logger set by SetLogger(). By default, debug logging is disabled.

func (*Client) SetLogger

func (c *Client) SetLogger(w io.Writer)

SetLogger sets the debug logger, defaults to os.StdErr

func (*Client) Status

func (c *Client) Status(ctx context.Context) (*Status, error)

Status returns the status of a Kong node

type Configuration

type Configuration map[string]interface{}

Configuration represents a config of a plugin in Kong.

func (Configuration) DeepCopy

func (in Configuration) DeepCopy() Configuration

DeepCopy copies the receiver, creating a new Configuration.

func (Configuration) DeepCopyInto

func (in Configuration) DeepCopyInto(out *Configuration)

DeepCopyInto copies the receiver, writing into out. in must be non-nil.

type Consumer

type Consumer struct {
	ID        *string   `json:"id,omitempty" yaml:"id,omitempty"`
	CustomID  *string   `json:"custom_id,omitempty" yaml:"custom_id,omitempty"`
	Username  *string   `json:"username,omitempty" yaml:"username,omitempty"`
	CreatedAt *int64    `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Tags      []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Consumer represents a Consumer in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#consumer-object +k8s:deepcopy-gen=true

func (*Consumer) DeepCopy

func (in *Consumer) DeepCopy() *Consumer

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Consumer.

func (*Consumer) DeepCopyInto

func (in *Consumer) DeepCopyInto(out *Consumer)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Consumer) String

func (c *Consumer) String() string

func (*Consumer) Valid

func (c *Consumer) Valid() bool

Valid checks if all the fields in Consumer are valid.

type ConsumerService

type ConsumerService service

ConsumerService handles Consumers in Kong.

func (*ConsumerService) Create

func (s *ConsumerService) Create(ctx context.Context,
	consumer *Consumer) (*Consumer, error)

Create creates a Consumer in Kong. If an ID is specified, it will be used to create a consumer in Kong, otherwise an ID is auto-generated.

func (*ConsumerService) Delete

func (s *ConsumerService) Delete(ctx context.Context,
	usernameOrID *string) error

Delete deletes a Consumer in Kong

func (*ConsumerService) Get

func (s *ConsumerService) Get(ctx context.Context,
	usernameOrID *string) (*Consumer, error)

Get fetches a Consumer in Kong.

func (*ConsumerService) List

func (s *ConsumerService) List(ctx context.Context,
	opt *ListOpt) ([]*Consumer, *ListOpt, error)

List fetches a list of Consumers in Kong. opt can be used to control pagination.

func (*ConsumerService) ListAll

func (s *ConsumerService) ListAll(ctx context.Context) ([]*Consumer, error)

ListAll fetches all Consumers in Kong. This method can take a while if there a lot of Consumers present.

func (*ConsumerService) Update

func (s *ConsumerService) Update(ctx context.Context,
	consumer *Consumer) (*Consumer, error)

Update updates a Consumer in Kong

type CustomEntityService

type CustomEntityService service

CustomEntityService handles custom entities in Kong.

func (*CustomEntityService) Create

func (s *CustomEntityService) Create(ctx context.Context,
	entity custom.Entity) (custom.Entity, error)

Create creates a custom entity based on entity. All required fields must be present in entity.

func (*CustomEntityService) Delete

func (s *CustomEntityService) Delete(ctx context.Context,
	entity custom.Entity) error

Delete deletes a custom entity in Kong.

func (*CustomEntityService) Get

Get fetches a custom entity. The primary key and all relations of the entity must be populated in entity.

func (*CustomEntityService) List

func (s *CustomEntityService) List(ctx context.Context, opt *ListOpt,
	entity custom.Entity) ([]custom.Entity, *ListOpt, error)

List fetches all custom entities based on relations

func (*CustomEntityService) ListAll

func (s *CustomEntityService) ListAll(ctx context.Context,
	entity custom.Entity) ([]custom.Entity, error)

ListAll fetches all custom entities based on relations

func (*CustomEntityService) Update

func (s *CustomEntityService) Update(ctx context.Context,
	entity custom.Entity) (custom.Entity, error)

Update updates a custom entity in Kong.

type Healthcheck

type Healthcheck struct {
	Active  *ActiveHealthcheck  `json:"active,omitempty" yaml:"active,omitempty"`
	Passive *PassiveHealthcheck `json:"passive,omitempty" yaml:"passive,omitempty"`
}

Healthcheck represents a health-check config of an upstream in Kong. +k8s:deepcopy-gen=true

func (*Healthcheck) DeepCopy

func (in *Healthcheck) DeepCopy() *Healthcheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Healthcheck.

func (*Healthcheck) DeepCopyInto

func (in *Healthcheck) DeepCopyInto(out *Healthcheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Healthy

type Healthy struct {
	HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
	Interval     *int  `json:"interval,omitempty" yaml:"interval,omitempty"`
	Successes    *int  `json:"successes,omitempty" yaml:"successes,omitempty"`
}

Healthy configures thresholds and HTTP status codes to mark targets healthy for an upstream. +k8s:deepcopy-gen=true

func (*Healthy) DeepCopy

func (in *Healthy) DeepCopy() *Healthy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Healthy.

func (*Healthy) DeepCopyInto

func (in *Healthy) DeepCopyInto(out *Healthy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ListOpt

type ListOpt struct {
	// Size of the page
	Size int `url:"size,omitempty"`
	// Offset for the current page
	Offset string `url:"offset,omitempty"`

	// Tags to use for filtering the list.
	Tags []*string `url:"tags,omitempty"`
	// Tags are ORed by default, meaning entities
	// containing even a single tag in the list are listed.
	// If true, tags are ANDed, meaning only entities
	// matching each tag in the Tags array are listed.
	MatchAllTags bool
}

ListOpt aids in paginating through list endpoints

type PassiveHealthcheck

type PassiveHealthcheck struct {
	Healthy   *Healthy   `json:"healthy,omitempty" yaml:"healthy,omitempty"`
	Unhealthy *Unhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
}

PassiveHealthcheck configures passive checks around passive health checks. +k8s:deepcopy-gen=true

func (*PassiveHealthcheck) DeepCopy

func (in *PassiveHealthcheck) DeepCopy() *PassiveHealthcheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PassiveHealthcheck.

func (*PassiveHealthcheck) DeepCopyInto

func (in *PassiveHealthcheck) DeepCopyInto(out *PassiveHealthcheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Plugin

type Plugin struct {
	CreatedAt *int          `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	ID        *string       `json:"id,omitempty" yaml:"id,omitempty"`
	Name      *string       `json:"name,omitempty" yaml:"name,omitempty"`
	Route     *Route        `json:"route,omitempty" yaml:"route,omitempty"`
	Service   *Service      `json:"service,omitempty" yaml:"service,omitempty"`
	Consumer  *Consumer     `json:"consumer,omitempty" yaml:"consumer,omitempty"`
	Config    Configuration `json:"config,omitempty" yaml:"config,omitempty"`
	Enabled   *bool         `json:"enabled,omitempty" yaml:"enabled,omitempty"`
	RunOn     *string       `json:"run_on,omitempty" yaml:"run_on,omitempty"`
	Protocols []*string     `json:"protocols,omitempty" yaml:"protocols,omitempty"`
	Tags      []*string     `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Plugin represents a Plugin in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Plugin-object +k8s:deepcopy-gen=true

func (*Plugin) DeepCopy

func (in *Plugin) DeepCopy() *Plugin

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plugin.

func (*Plugin) DeepCopyInto

func (in *Plugin) DeepCopyInto(out *Plugin)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Plugin) String

func (p *Plugin) String() string

func (*Plugin) Valid

func (p *Plugin) Valid() bool

Valid checks if all the fields in Plugin are valid.

type PluginService

type PluginService service

PluginService handles Plugins in Kong.

func (*PluginService) Create

func (s *PluginService) Create(ctx context.Context,
	plugin *Plugin) (*Plugin, error)

Create creates a Plugin in Kong. If an ID is specified, it will be used to create a plugin in Kong, otherwise an ID is auto-generated.

func (*PluginService) Delete

func (s *PluginService) Delete(ctx context.Context,
	usernameOrID *string) error

Delete deletes a Plugin in Kong

func (*PluginService) Get

func (s *PluginService) Get(ctx context.Context,
	usernameOrID *string) (*Plugin, error)

Get fetches a Plugin in Kong.

func (*PluginService) List

func (s *PluginService) List(ctx context.Context,
	opt *ListOpt) ([]*Plugin, *ListOpt, error)

List fetches a list of Plugins in Kong. opt can be used to control pagination.

func (*PluginService) ListAll

func (s *PluginService) ListAll(ctx context.Context) ([]*Plugin, error)

ListAll fetches all Plugins in Kong. This method can take a while if there a lot of Plugins present.

func (*PluginService) ListAllForConsumer

func (s *PluginService) ListAllForConsumer(ctx context.Context,
	consumerIDorName *string) ([]*Plugin, error)

ListAllForConsumer fetches all Plugins in Kong enabled for a consumer.

func (*PluginService) ListAllForRoute

func (s *PluginService) ListAllForRoute(ctx context.Context,
	routeID *string) ([]*Plugin, error)

ListAllForRoute fetches all Plugins in Kong enabled for a service.

func (*PluginService) ListAllForService

func (s *PluginService) ListAllForService(ctx context.Context,
	serviceIDorName *string) ([]*Plugin, error)

ListAllForService fetches all Plugins in Kong enabled for a service.

func (*PluginService) Update

func (s *PluginService) Update(ctx context.Context,
	plugin *Plugin) (*Plugin, error)

Update updates a Plugin in Kong

type Response

type Response struct {
	*http.Response
}

Response is a Kong Admin API response. It wraps http.Response.

type Route

type Route struct {
	CreatedAt     *int        `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Hosts         []*string   `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	ID            *string     `json:"id,omitempty" yaml:"id,omitempty"`
	Name          *string     `json:"name,omitempty" yaml:"name,omitempty"`
	Methods       []*string   `json:"methods,omitempty" yaml:"methods,omitempty"`
	Paths         []*string   `json:"paths,omitempty" yaml:"paths,omitempty"`
	PreserveHost  *bool       `json:"preserve_host,omitempty" yaml:"preserve_host,omitempty"`
	Protocols     []*string   `json:"protocols,omitempty" yaml:"protocols,omitempty"`
	RegexPriority *int        `json:"regex_priority,omitempty" yaml:"regex_priority,omitempty"`
	Service       *Service    `json:"service,omitempty" yaml:"service,omitempty"`
	StripPath     *bool       `json:"strip_path,omitempty" yaml:"strip_path,omitempty"`
	UpdatedAt     *int        `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
	SNIs          []*string   `json:"snis,omitempty" yaml:"snis,omitempty"`
	Sources       []*CIDRPort `json:"sources,omitempty" yaml:"sources,omitempty"`
	Destinations  []*CIDRPort `json:"destinations,omitempty" yaml:"destinations,omitempty"`
	Tags          []*string   `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Route represents a Route in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Route-object +k8s:deepcopy-gen=true

func (*Route) DeepCopy

func (in *Route) DeepCopy() *Route

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.

func (*Route) DeepCopyInto

func (in *Route) DeepCopyInto(out *Route)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Route) String

func (r *Route) String() string

func (*Route) Valid

func (r *Route) Valid() bool

Valid checks if all the fields in Route are valid.

type RouteService

type RouteService service

RouteService handles routes in Kong.

func (*RouteService) Create

func (s *RouteService) Create(ctx context.Context,
	route *Route) (*Route, error)

Create creates a Route in Kong If an ID is specified, it will be used to create a route in Kong, otherwise an ID is auto-generated.

func (*RouteService) CreateInService

func (s *RouteService) CreateInService(ctx context.Context,
	serviceID *string, route *Route) (*Route, error)

CreateInService creates a route associated with serviceID

func (*RouteService) Delete

func (s *RouteService) Delete(ctx context.Context, nameOrID *string) error

Delete deletes a Route in Kong

func (*RouteService) Get

func (s *RouteService) Get(ctx context.Context,
	nameOrID *string) (*Route, error)

Get fetches a Route in Kong.

func (*RouteService) List

func (s *RouteService) List(ctx context.Context,
	opt *ListOpt) ([]*Route, *ListOpt, error)

List fetches a list of Routes in Kong. opt can be used to control pagination.

func (*RouteService) ListAll

func (s *RouteService) ListAll(ctx context.Context) ([]*Route, error)

ListAll fetches all Routes in Kong. This method can take a while if there a lot of Routes present.

func (*RouteService) ListForService

func (s *RouteService) ListForService(ctx context.Context,
	serviceNameOrID *string, opt *ListOpt) ([]*Route, *ListOpt, error)

ListForService fetches a list of Routes in Kong associated with a service. opt can be used to control pagination.

func (*RouteService) Update

func (s *RouteService) Update(ctx context.Context,
	route *Route) (*Route, error)

Update updates a Route in Kong

type SNI

type SNI struct {
	ID          *string      `json:"id,omitempty" yaml:"id,omitempty"`
	Name        *string      `json:"name,omitempty" yaml:"name,omitempty"`
	CreatedAt   *int64       `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Certificate *Certificate `json:"certificate,omitempty" yaml:"certificate,omitempty"`
	Tags        []*string    `json:"tags,omitempty" yaml:"tags,omitempty"`
}

SNI represents a SNI in Kong. Read https://getkong.org/docs/0.14.x/admin-api/#sni-object +k8s:deepcopy-gen=true

func (*SNI) DeepCopy

func (in *SNI) DeepCopy() *SNI

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SNI.

func (*SNI) DeepCopyInto

func (in *SNI) DeepCopyInto(out *SNI)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SNI) String

func (c *SNI) String() string

func (*SNI) Valid

func (c *SNI) Valid() bool

Valid checks if all the fields in SNI are valid.

type SNIService

type SNIService service

SNIService handles SNIs in Kong.

func (*SNIService) Create

func (s *SNIService) Create(ctx context.Context, sni *SNI) (*SNI, error)

Create creates a SNI in Kong. If an ID is specified, it will be used to create a sni in Kong, otherwise an ID is auto-generated.

func (*SNIService) Delete

func (s *SNIService) Delete(ctx context.Context, usernameOrID *string) error

Delete deletes a SNI in Kong

func (*SNIService) Get

func (s *SNIService) Get(ctx context.Context,
	usernameOrID *string) (*SNI, error)

Get fetches a SNI in Kong.

func (*SNIService) List

func (s *SNIService) List(ctx context.Context,
	opt *ListOpt) ([]*SNI, *ListOpt, error)

List fetches a list of SNIs in Kong. opt can be used to control pagination.

func (*SNIService) ListAll

func (s *SNIService) ListAll(ctx context.Context) ([]*SNI, error)

ListAll fetches all SNIs in Kong. This method can take a while if there a lot of SNIs present.

func (*SNIService) ListForCertificate

func (s *SNIService) ListForCertificate(ctx context.Context,
	certificateID *string, opt *ListOpt) ([]*SNI, *ListOpt, error)

ListForCertificate fetches a list of SNIs in Kong associated with certificateID. opt can be used to control pagination.

func (*SNIService) Update

func (s *SNIService) Update(ctx context.Context, sni *SNI) (*SNI, error)

Update updates a SNI in Kong

type Service

type Service struct {
	ConnectTimeout *int      `json:"connect_timeout,omitempty" yaml:"connect_timeout,omitempty"`
	CreatedAt      *int      `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	Host           *string   `json:"host,omitempty" yaml:"host,omitempty"`
	ID             *string   `json:"id,omitempty" yaml:"id,omitempty"`
	Name           *string   `json:"name,omitempty" yaml:"name,omitempty"`
	Path           *string   `json:"path,omitempty" yaml:"path,omitempty"`
	Port           *int      `json:"port,omitempty" yaml:"port,omitempty"`
	Protocol       *string   `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	ReadTimeout    *int      `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"`
	Retries        *int      `json:"retries,omitempty" yaml:"retries,omitempty"`
	UpdatedAt      *int      `json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
	WriteTimeout   *int      `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"`
	Tags           []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Service represents a Service in Kong. Read https://getkong.org/docs/0.13.x/admin-api/#Service-object +k8s:deepcopy-gen=true

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Service) String

func (s *Service) String() string

func (*Service) Valid

func (s *Service) Valid() bool

Valid checks if all the fields in Service are valid.

type Status

type Status struct {
	Database struct {
		Reachable bool `json:"reachable"`
	} `json:"database"`
	Server struct {
		ConnectionsAccepted int `json:"connections_accepted"`
		ConnectionsActive   int `json:"connections_active"`
		ConnectionsHandled  int `json:"connections_handled"`
		ConnectionsReading  int `json:"connections_reading"`
		ConnectionsWaiting  int `json:"connections_waiting"`
		ConnectionsWriting  int `json:"connections_writing"`
		TotalRequests       int `json:"total_requests"`
	} `json:"server"`
}

Status respresents current status of a Kong node.

type Svcservice

type Svcservice service

Svcservice handles services in Kong.

func (*Svcservice) Create

func (s *Svcservice) Create(ctx context.Context,
	service *Service) (*Service, error)

Create creates an Service in Kong If an ID is specified, it will be used to create a service in Kong, otherwise an ID is auto-generated.

func (*Svcservice) Delete

func (s *Svcservice) Delete(ctx context.Context, nameOrID *string) error

Delete deletes an Service in Kong

func (*Svcservice) Get

func (s *Svcservice) Get(ctx context.Context,
	nameOrID *string) (*Service, error)

Get fetches an Service in Kong.

func (*Svcservice) GetForRoute

func (s *Svcservice) GetForRoute(ctx context.Context,
	routeID *string) (*Service, error)

GetForRoute fetches a Service associated with routeID in Kong.

func (*Svcservice) List

func (s *Svcservice) List(ctx context.Context,
	opt *ListOpt) ([]*Service, *ListOpt, error)

List fetches a list of Services in Kong. opt can be used to control pagination.

func (*Svcservice) ListAll

func (s *Svcservice) ListAll(ctx context.Context) ([]*Service, error)

ListAll fetches all Services in Kong. This method can take a while if there a lot of Services present.

func (*Svcservice) Update

func (s *Svcservice) Update(ctx context.Context,
	service *Service) (*Service, error)

Update updates an Service in Kong

type Target

type Target struct {
	CreatedAt *float64  `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	ID        *string   `json:"id,omitempty" yaml:"id,omitempty"`
	Target    *string   `json:"target,omitempty" yaml:"target,omitempty"`
	Upstream  *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
	Weight    *int      `json:"weight,omitempty" yaml:"weight,omitempty"`
	Tags      []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Target represents a Target in Kong. +k8s:deepcopy-gen=true

func (*Target) DeepCopy

func (in *Target) DeepCopy() *Target

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Target.

func (*Target) DeepCopyInto

func (in *Target) DeepCopyInto(out *Target)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Target) String

func (t *Target) String() string

func (*Target) Valid

func (t *Target) Valid() bool

Valid checks if all the fields in Target are valid.

type TargetService

type TargetService service

TargetService handles Targets in Kong.

func (*TargetService) Create

func (s *TargetService) Create(ctx context.Context,
	upstreamNameOrID *string, target *Target) (*Target, error)

Create creates a Target in Kong under upstreamID. If an ID is specified, it will be used to create a target in Kong, otherwise an ID is auto-generated.

func (*TargetService) Delete

func (s *TargetService) Delete(ctx context.Context,
	upstreamNameOrID *string, targetOrID *string) error

Delete deletes a Target in Kong

func (*TargetService) List

func (s *TargetService) List(ctx context.Context,
	upstreamNameOrID *string, opt *ListOpt) ([]*Target, *ListOpt, error)

List fetches a list of Targets in Kong. opt can be used to control pagination.

func (*TargetService) ListAll

func (s *TargetService) ListAll(ctx context.Context,
	upstreamNameOrID *string) ([]*Target, error)

ListAll fetches all Targets in Kong for an upstream.

func (*TargetService) MarkHealthy

func (s *TargetService) MarkHealthy(ctx context.Context,
	upstreamNameOrID *string, target *Target) error

MarkHealthy marks target belonging to upstreamNameOrID as healthy in Kong's load balancer.

func (*TargetService) MarkUnhealthy

func (s *TargetService) MarkUnhealthy(ctx context.Context,
	upstreamNameOrID *string, target *Target) error

MarkUnhealthy marks target belonging to upstreamNameOrID as unhealthy in Kong's load balancer.

type Unhealthy

type Unhealthy struct {
	HTTPFailures *int  `json:"http_failures,omitempty" yaml:"http_failures,omitempty"`
	HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
	TCPFailures  *int  `json:"tcp_failures,omitempty" yaml:"tcp_failures,omitempty"`
	Timeouts     *int  `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
}

Unhealthy configures thresholds and HTTP status codes to mark targets unhealthy. +k8s:deepcopy-gen=true

func (*Unhealthy) DeepCopy

func (in *Unhealthy) DeepCopy() *Unhealthy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Unhealthy.

func (*Unhealthy) DeepCopyInto

func (in *Unhealthy) DeepCopyInto(out *Unhealthy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Upstream

type Upstream struct {
	ID                 *string      `json:"id,omitempty" yaml:"id,omitempty"`
	Name               *string      `json:"name,omitempty" yaml:"name,omitempty"`
	Slots              *int         `json:"slots,omitempty" yaml:"slots,omitempty"`
	Healthchecks       *Healthcheck `json:"healthchecks,omitempty" yaml:"healthchecks,omitempty"`
	CreatedAt          *int64       `json:"created_at,omitempty" yaml:"created_at,omitempty"`
	HashOn             *string      `json:"hash_on,omitempty" yaml:"hash_on,omitempty"`
	HashFallback       *string      `json:"hash_fallback,omitempty" yaml:"hash_fallback,omitempty"`
	HashOnHeader       *string      `json:"hash_on_header,omitempty" yaml:"hash_on_header,omitempty"`
	HashFallbackHeader *string      `json:"hash_fallback_header,omitempty" yaml:"hash_fallback_header,omitempty"`
	HashOnCookie       *string      `json:"hash_on_cookie,omitempty" yaml:"hash_on_cookie,omitempty"`
	HashOnCookiePath   *string      `json:"hash_on_cookie_path,omitempty" yaml:"hash_on_cookie_path,omitempty"`
	Tags               []*string    `json:"tags,omitempty" yaml:"tags,omitempty"`
}

Upstream represents a Consumer in Kong. +k8s:deepcopy-gen=true

func (*Upstream) DeepCopy

func (in *Upstream) DeepCopy() *Upstream

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Upstream.

func (*Upstream) DeepCopyInto

func (in *Upstream) DeepCopyInto(out *Upstream)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Upstream) String

func (u *Upstream) String() string

func (*Upstream) Valid

func (u *Upstream) Valid() bool

Valid checks if all the fields in Upstream are valid.

type UpstreamService

type UpstreamService service

UpstreamService handles Upstreams in Kong.

func (*UpstreamService) Create

func (s *UpstreamService) Create(ctx context.Context,
	upstream *Upstream) (*Upstream, error)

Create creates a Upstream in Kong. If an ID is specified, it will be used to create a upstream in Kong, otherwise an ID is auto-generated.

func (*UpstreamService) Delete

func (s *UpstreamService) Delete(ctx context.Context,
	upstreamNameOrID *string) error

Delete deletes a Upstream in Kong

func (*UpstreamService) Get

func (s *UpstreamService) Get(ctx context.Context,
	upstreamNameOrID *string) (*Upstream, error)

Get fetches a Upstream in Kong.

func (*UpstreamService) List

func (s *UpstreamService) List(ctx context.Context,
	opt *ListOpt) ([]*Upstream, *ListOpt, error)

List fetches a list of Upstreams in Kong. opt can be used to control pagination.

func (*UpstreamService) ListAll

func (s *UpstreamService) ListAll(ctx context.Context) ([]*Upstream, error)

ListAll fetches all Upstreams in Kong. This method can take a while if there a lot of Upstreams present.

func (*UpstreamService) Update

func (s *UpstreamService) Update(ctx context.Context,
	upstream *Upstream) (*Upstream, error)

Update updates a Upstream in Kong

type Validator

type Validator interface {
	Valid() bool
}

Validator is an interface that wraps Valid method.

Directories

Path Synopsis
Package custom defines interfaces to interact with custom entities in Kong.
Package custom defines interfaces to interact with custom entities in Kong.

Jump to

Keyboard shortcuts

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