kongo

package module
v0.0.0-...-4b98feb Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: MIT Imports: 14 Imported by: 0

README

Kongo

Build Status Coverage Status GoDoc Go Report Card License

Kong api library for Golang

Installation

Kongo requires Go 1.9 or later.

go get github.com/fabiorphp/kongo

If you want to get an specific version, please use the example below:

go get gopkg.in/fabiorphp/kongo.v0

Usage

package main

import (
    "github.com/fabiorphp/kongo"
)

func main() {
    kongo := kongo.New(nil, "127.0.0.1:8001")
    status, _, _ := kongo.Node.Status()
    ...
}

Documentation

Read the full documentation at https://godoc.org/github.com/fabiorphp/kongo.

Development

Requirements
Makefile
// Clean up
$ make clean

// Creates folders and download dependencies
$ make configure

//Run tests and generates html coverage file
make cover

// Download project dependencies
make depend

// Format all go files
make fmt

//Run linters
make lint

// Run tests
make test

License

This project is released under the MIT licence. See LICENSE for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	// The date when the customer was registered.
	CreatedAt Time `json:"created_at"`

	// Field for storing an existing unique ID for the consumer. You must send either this field or username with the request.
	CustomId string `json:"custom_id,omitempty"`

	// The identification of customer registered.
	Id string `json:"id"`

	// The unique username of the consumer. You must send either this field or custom_id with the request.
	Username string `json:"username,omitempty"`
}

Customer it's a structure of API result.

type Customers

type Customers interface {
	// Create creates a new customer.
	Create(customer *Customer) (*Customer, *http.Response, error)

	// CreateWithContext creates a new customer.
	CreateWithContext(ctx context.Context, customer *Customer) (*Customer, *http.Response, error)

	// Delete deletes registered customer by ID or Username.
	Delete(idOrUsername string) (*http.Response, error)

	// DeleteWithContext deletes registered customer by ID or Username.
	DeleteWithContext(ctx context.Context, idOrUsername string) (*http.Response, error)

	// Get retrieves registered customer by ID or username.
	Get(idOrUsername string) (*Customer, *http.Response, error)

	// GetWithContext retrieves registered customer by ID or username.
	GetWithContext(ctx context.Context, idOrUsername string) (*Customer, *http.Response, error)

	// List retrieves a list of registered customers.
	List(options *ListCustomersOptions) ([]*Customer, *http.Response, error)

	// ListWithContext retrieves a list of registered customers.
	ListWithContext(ctx context.Context, options *ListCustomersOptions) ([]*Customer, *http.Response, error)

	// Update updates a customer registered by ID or Username.
	Update(idOrUsername string, customer *Customer) (*Customer, *http.Response, error)

	// UpdateWithContext updates a customer registered by ID or Username.
	UpdateWithContext(ctx context.Context, idOrUsername string, customer *Customer) (*Customer, *http.Response, error)
}

Customers manages the Kong customer rules.

type CustomersRoot

type CustomersRoot struct {
	// List of customers.
	Customers []*Customer `json:"data"`
}

CustomersRoot it's a structure of API result list.

type CustomersService

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

CustomersService it's a concrete instance of customers.

func (*CustomersService) Create

func (c *CustomersService) Create(customer *Customer) (*Customer, *http.Response, error)

Create creates a new customer.

func (*CustomersService) CreateWithContext

func (c *CustomersService) CreateWithContext(ctx context.Context, customer *Customer) (*Customer, *http.Response, error)

CreateWithContext creates a new customer.

func (*CustomersService) Delete

func (c *CustomersService) Delete(idOrUsername string) (*http.Response, error)

Delete retrieves registered customer by ID or Username.

func (*CustomersService) DeleteWithContext

func (c *CustomersService) DeleteWithContext(ctx context.Context, idOrUsername string) (*http.Response, error)

DeleteWithContext retrieves registered customer by ID or Username.

func (*CustomersService) Get

func (c *CustomersService) Get(idOrUsername string) (*Customer, *http.Response, error)

Get retrieves registered customer by ID or Username.

func (*CustomersService) GetWithContext

func (c *CustomersService) GetWithContext(ctx context.Context, idOrUsername string) (*Customer, *http.Response, error)

GetWithContext retrieves registered customer by ID or Username.

func (*CustomersService) List

List retrieves a list of registered customers.

func (*CustomersService) ListWithContext

func (c *CustomersService) ListWithContext(ctx context.Context, options *ListCustomersOptions) ([]*Customer, *http.Response, error)

ListWithContext retrieves a list of registered customers.

func (*CustomersService) Update

func (c *CustomersService) Update(idOrUsername string, customer *Customer) (*Customer, *http.Response, error)

Update updates a customer registered by ID or Username.

func (*CustomersService) UpdateWithContext

func (c *CustomersService) UpdateWithContext(ctx context.Context, idOrUsername string, customer *Customer) (*Customer, *http.Response, error)

UpdateWithContext updates a customer registered by ID or Username.

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response

	// Error message based on http status code
	Message string `json:"message, omitempty"`
}

An ErrorResponse report the error caused by and API request

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error retrieves the error message of Error Response

type Kongo

type Kongo struct {

	// Kong server base URL.
	BaseURL *url.URL

	// User agent for client
	UserAgent string

	// Node api service
	Node Node

	// Services api service
	Services Services

	// Routes api service
	Routes Routes

	// Customers api service
	Customers Customers
	// contains filtered or unexported fields
}

Kongo manages communication with Kong Admin API.

func New

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

New returns a new Kongo API client.

func NewClient

func NewClient(client *http.Client, baseURL *url.URL) (*Kongo, error)

NewClient returns a new Kongo API client.

func (*Kongo) Do

func (k *Kongo) Do(req *http.Request, value interface{}) (*http.Response, error)

Do sends an API request and returns the API response. If the HTTP response is in the 2xx range, unmarshal the response body into value.

func (*Kongo) NewRequest

func (k *Kongo) NewRequest(ctx context.Context, method string, res *url.URL, body interface{}) (*http.Request, error)

NewRequest creates an API requrest. A relative URL can be provided in res URL instance. If specified, the value pointed to by body JSON encoded and included in as the request body.

type ListCustomersOptions

type ListCustomersOptions struct {
	// A filter on the list based on the consumer custom_id field.
	CustomId string `url:"custom_id, omitempty"`

	// A filter on the list based on the consumer id field.
	Id string `url:"id, omitempty"`

	// A cursor used for pagination. offset is an object identifier that defines a place in the list.
	Offset string `url:"offset, omitempty"`

	// A limit on the number of objects to be returned per page. Defaults is 100 and max is 100.
	Size int `url:"size, omitempty"`

	// A filter on the list based on the consumer username field.
	Username string `url:"username, omitempty"`
}

ListCustomersOptions stores the options you can set for requesting the customer list.

type ListRoutesOptions

type ListRoutesOptions struct {
	// A cursor used for pagination. offset is an object identifier that defines a place in the list.
	Offset string `url:"offset, omitempty"`

	// A limit on the number of objects to be returned per page. Defaults is 100 and max is 100.
	Size int `url:"size, omitempty"`
}

ListRoutesOptions stores the options you can set for requesting the route list.

type ListServicesOptions

type ListServicesOptions struct {
	// A cursor used for pagination. offset is an object identifier that defines a place in the list.
	Offset string `url:"offset, omitempty"`

	// A limit on the number of objects to be returned per page. Defaults is 100 and max is 100.
	Size int `url:"size, omitempty"`
}

ListServicesOptions stores the options you can set for requesting the service list

type Node

type Node interface {
	// Info retrieves the information about the server node
	Info() (*NodeInfo, *http.Response, error)

	// InfoWithContext retrieves the information about the server node
	InfoWithContext(ctx context.Context) (*NodeInfo, *http.Response, error)

	// Status retrieves the status of the server node.
	Status() (*NodeStatus, *http.Response, error)

	// StatusWithContext retrieves the status of the server node.
	StatusWithContext(ctx context.Context) (*NodeStatus, *http.Response, error)
}

Node retrieves the info about the server nodes.

type NodeInfo

type NodeInfo struct {
	Configuration *NodeInfoConfiguration `json:"configuration"`
	Hostname      string                 `json:"hostname"`
	LuaVersion    string                 `json:"lua_version"`
	Plugins       *NodeInfoPlugins       `json:"plugins"`
	PrngSeeds     map[string]int         `json:"prng_seeds"`
	Tagline       string                 `json:"tagline"`
	Timers        *NodeInfoTimers        `json:"timers"`
	Version       string                 `json:"version"`
}

NodeInfo it's a structure of API result

type NodeInfoConfiguration

type NodeInfoConfiguration struct {
	AdminAcessLog                 string              `json:"admin_access_log"`
	AdminErrorLog                 string              `json:"admin_error_log"`
	AdminListen                   []string            `json:"admin_listen"`
	AdminListeners                []*NodeInfoListener `json:"admin_listeners"`
	AdminSSLCertificateDefault    string              `json:"admin_ssl_cert_default"`
	AdminSSLCertificateCsrDefault string              `json:"admin_ssl_cert_csr_default"`
	AdminSSLCertificateKeyDefault string              `json:"admin_ssl_cert_key_default"`
	AdminSSLEnabled               bool                `json:"admin_ssl_enabled"`
	AnonymousReports              bool                `json:"anonymous_reports"`

	CassandraConsistency            string   `json:"cassandra_consistency"`
	CassandraContactPoints          []string `json:"cassandra_contact_points"`
	CassandraDataCenters            []string `json:"cassandra_data_centers"`
	CassandraKeyspace               string   `json:"cassandra_keyspace"`
	CassandraLBPolicy               string   `json:"cassandra_lb_policy"`
	CassandraPort                   int      `json:"cassandra_port"`
	CassandraReplicationFactor      int      `json:"cassandra_repl_factor"`
	CassandraReplicationStrategy    string   `json:"cassandra_repl_strategy"`
	CassandraSchemaConsensusTimeout int      `json:"cassandra_schema_consensus_timeout"`
	CassandraSSL                    bool     `json:"cassandra_ssl"`
	CassandraSSLVerify              bool     `json:"cassandra_ssl_verify"`
	CassandraTimeout                int      `json:"cassandra_timeout"`
	CassandraUsername               string   `json:"cassandra_username"`

	ClientBodyBufferSize           string `json:"client_body_buffer_size"`
	ClientMaxBodySize              string `json:"client_max_body_size"`
	ClientSSL                      bool   `json:"client_ssl"`
	ClientSSLCertificateCsrDefault string `json:"client_ssl_cert_csr_default"`
	ClientSSLCertificateDefault    string `json:"client_ssl_cert_default"`
	ClientSSLCertificateKeyDefault string `json:"client_ssl_cert_key_default"`

	CustomPlugins interface{} `json:"custom_plugins"`

	Database                  string `json:"database"`
	DatabaseCacheTTL          int    `json:"db_cache_ttl"`
	DatabaseUpdateFrequency   int    `json:"db_update_frequency"`
	DatabaseUpdatePropagation int    `json:"db_update_propagation"`

	DNSErrorTTL    int         `json:"dns_error_ttl"`
	DNSHostsFile   string      `json:"dns_hostsfile"`
	DNSNotFoundTTL int         `json:"dns_not_found_ttl"`
	DNSNoSync      bool        `json:"dns_no_sync"`
	DNSOrder       []string    `json:"dns_order"`
	DNSResolver    interface{} `json:"dns_resolver"`
	DNSStaleTTL    int         `json:"dns_stale_ttl"`

	ErrorDefaultType string `json:"error_default_type"`

	KongEnv string `json:"kong_env"`

	LatencyTokens bool `json:"latency_tokens"`

	LuaPackageCPath   string `json:"lua_package_cpath"`
	LuaPackagePath    string `json:"lua_package_path"`
	LuaSocketPoolSize int    `json:"lua_socket_pool_size"`
	LuaSSLVerifyDepth int    `json:"lua_ssl_verify_depth"`

	LogLevel string `json:"log_level"`

	MemoryCacheSize string `json:"mem_cache_size"`

	NginxAccessLogs      string `json:"nginx_acc_logs"`
	NginxAdminAccessLog  string `json:"nginx_admin_acc_logs"`
	NginxConf            string `json:"nginx_conf"`
	NginxDaemon          string `json:"nginx_daemon"`
	NginxErrorLogs       string `json:"nginx_err_logs"`
	NginxKongConf        string `json:"nginx_kong_conf"`
	NginxOptimizations   bool   `json:"nginx_optimizations"`
	NginxPID             string `json:"nginx_pid"`
	NginxWorkerProcesses string `json:"nginx_worker_processes"`

	Plugins map[string]bool `json:"plugins"`

	PostgresDatabase  string `json:"pg_database"`
	PostgresHost      string `json:"pg_host"`
	PostgresPort      int    `json:"pg_port"`
	PostgresSSL       bool   `json:"pg_ssl"`
	PostgresUsername  string `json:"pg_user"`
	PostgresSSLVerify bool   `json:"pg_ssl_verify"`

	Prefix string `json:"prefix"`

	ProxyAccessLog  string              `json:"proxy_access_log"`
	ProxyErrorLog   string              `json:"proxy_error_log"`
	ProxyListen     []string            `json:"proxy_listen"`
	ProxyListeners  []*NodeInfoListener `json:"proxy_listeners"`
	ProxySSLEnabled bool                `json:"proxy_ssl_enabled"`

	RealIpHeader    string `json:"real_ip_header"`
	RealIpRecursive string `json:"real_ip_recursive"`

	ServerTokens bool `json:"server_tokens"`

	SSLCertificate           string `json:"ssl_cert"`
	SSLCertificateDefault    string `json:"ssl_cert_default"`
	SSLCertificateKey        string `json:"ssl_cert_key"`
	SSLCertificateDefaultKey string `json:"ssl_cert_key_default"`
	SSLCertificateCsrDefault string `json:"ssl_cert_csr_default"`
	SSLCiphers               string `json:"ssl_ciphers"`
	SSLCipherSuite           string `json:"ssl_cipher_suite"`

	TrustedIps interface{} `json:"trusted_ips"`

	UpstreamKeepAlive int `json:"upstream_keepalive"`
}

NodeInfoConfiguration it's a structure of API result

type NodeInfoListener

type NodeInfoListener struct {
	SSL      bool   `json:"ssl"`
	Ip       string `json:"ip"`
	Protocol bool   `json:"protocol"`
	Port     int    `json:"port"`
	Http2    bool   `json:"http2"`
	Listener string `json:"listener"`
}

NodeInfoListener it's a structure of API result

type NodeInfoPlugins

type NodeInfoPlugins struct {
	AvailableOnServer map[string]bool `json:"available_on_server"`
	EnabledInCluster  []string        `json:"enabled_in_cluster"`
}

NodeInfoPlugins it's a structure of API result

type NodeInfoTimers

type NodeInfoTimers struct {
	Pending int `json:"pending"`
	Running int `json:"running"`
}

NodeInfoTimers it's a structure of API result

type NodeService

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

NodeService it's a concrete instance of node

func (*NodeService) Info

func (n *NodeService) Info() (*NodeInfo, *http.Response, error)

Info retrieves the server node information

func (*NodeService) InfoWithContext

func (n *NodeService) InfoWithContext(ctx context.Context) (*NodeInfo, *http.Response, error)

InfoWithContext retrieves the server node information

func (*NodeService) Status

func (n *NodeService) Status() (*NodeStatus, *http.Response, error)

Status retrieves the server node status.

func (*NodeService) StatusWithContext

func (n *NodeService) StatusWithContext(ctx context.Context) (*NodeStatus, *http.Response, error)

StatusWithContext retrieves the server node status.

type NodeStatus

type NodeStatus struct {
	Database *NodeStatusDatabase `json:"database"`
	Server   *NodeStatusServer   `json:"server"`
}

NodeStatus it's a structure of API result

type NodeStatusDatabase

type NodeStatusDatabase struct {
	Reachable bool `json:"reachable, omitempty"`
}

NodeStatusDatabase it's a structure of API result

type NodeStatusServer

type NodeStatusServer struct {
	ConnectionsAccepted int `json:"connections_accepted, omitempty"`
	ConnectionsActive   int `json:"connections_active, omitempty"`
	ConnectionsHandled  int `json:"connections_handled, omitempty"`
	ConnectionsReading  int `json:"connections_reading, omitempty"`
	ConnectionsWaiting  int `json:"connections_waiting, omitempty"`
	ConnectionsWriting  int `json:"connections_writing, omitempty"`
	TotalRequests       int `json:"total_requests, omitempty"`
}

NodeStatusServer it's a structure of API result

type Route

type Route struct {
	// The date when the route was registered.
	CreatedAt Time `json:"created_at"`

	// A list of domain names that match this Route. At least one of hosts, paths, or methods must be set.
	Hosts []string `json:"hosts,omitempty"`

	// The identification of route registered.
	Id string `json:"id"`

	// A list of HTTP methods that match this Route. At least one of hosts, paths, or methods must be set.
	Methods []string `json:"methods,omitempty"`

	// A list of paths that match this Route. At least one of hosts, paths, or methods must be set.
	Paths []string `json:"paths,omitempty"`

	// When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers.
	PreserveHost bool `json:"preserve_host,omitempty"`

	// A list of the protocols this Route should allow. By default it is ["http", "https"].
	Protocols []string `json:"protocols"`

	// The Service this Route is associated to. This is where the Route proxies traffic to.
	Service RouteService `json:"service"`

	// When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.
	StripPath bool `json:"strip_path,omitempty"`

	// The date when the route was updated.
	UpdatedAt Time `json:"updated_at"`
}

Route it's a structure of API result.

type RouteService

type RouteService struct {
	// Service id associated.
	Id string `json:"id"`
}

RouteService it's a structure of API result.

type Routes

type Routes interface {
	// Create creates a new route.
	Create(route *Route) (*Route, *http.Response, error)

	// CreateWithContext creates a new route.
	CreateWithContext(ctx context.Context, route *Route) (*Route, *http.Response, error)

	// Delete deletes registered route by ID or Name.
	Delete(id string) (*http.Response, error)

	// DeleteWithContext deletes registered route by ID or Name.
	DeleteWithContext(ctx context.Context, id string) (*http.Response, error)

	// Get retrieves registered route by ID.
	Get(id string) (*Route, *http.Response, error)

	// GetWithContext retrieves registered route by ID.
	GetWithContext(ctx context.Context, id string) (*Route, *http.Response, error)

	// List retrieves a list of registered routes.
	List(options *ListRoutesOptions) ([]*Route, *http.Response, error)

	// ListWithContext retrieves a list of registered routes.
	ListWithContext(ctx context.Context, options *ListRoutesOptions) ([]*Route, *http.Response, error)

	// Update updates a route registered by ID.
	Update(id string, route *Route) (*Route, *http.Response, error)

	// UpdateWithContext updates a route registered by ID.
	UpdateWithContext(ctx context.Context, id string, route *Route) (*Route, *http.Response, error)
}

Routes manages the Kong route rules.

type RoutesRoot

type RoutesRoot struct {
	// List of routes.
	Routes []*Route `json:"data"`
}

RoutesRoot it's a structure of API result list.

type RoutesService

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

RoutesService it's a concrete instance of route.

func (*RoutesService) Create

func (r *RoutesService) Create(route *Route) (*Route, *http.Response, error)

Create creates a new route.

func (*RoutesService) CreateWithContext

func (r *RoutesService) CreateWithContext(ctx context.Context, route *Route) (*Route, *http.Response, error)

CreateWithContext creates a new route.

func (*RoutesService) Delete

func (r *RoutesService) Delete(id string) (*http.Response, error)

Delete retrieves registered route by ID or Name.

func (*RoutesService) DeleteWithContext

func (r *RoutesService) DeleteWithContext(ctx context.Context, id string) (*http.Response, error)

DeleteWithContext retrieves registered route by ID.

func (*RoutesService) Get

func (r *RoutesService) Get(id string) (*Route, *http.Response, error)

Get retrieves registered route by ID.

func (*RoutesService) GetWithContext

func (r *RoutesService) GetWithContext(ctx context.Context, id string) (*Route, *http.Response, error)

GetWithContext retrieves registered route by ID.

func (*RoutesService) List

func (r *RoutesService) List(options *ListRoutesOptions) ([]*Route, *http.Response, error)

List retrieves a list of registered routes.

func (*RoutesService) ListWithContext

func (r *RoutesService) ListWithContext(ctx context.Context, options *ListRoutesOptions) ([]*Route, *http.Response, error)

ListWithContext retrieves a list of registered routes.

func (*RoutesService) Update

func (r *RoutesService) Update(id string, route *Route) (*Route, *http.Response, error)

Update updates a route.

func (*RoutesService) UpdateWithContext

func (r *RoutesService) UpdateWithContext(ctx context.Context, id string, route *Route) (*Route, *http.Response, error)

UpdateWithContext updates a route.

type Service

type Service struct {
	// The timeout in milliseconds for establishing a connection to the upstream server. Defaults to 60000.
	ConnectTimeout int64 `json:"connect_timeout,omitempty" groups:"create,update"`

	// The date when the service was registred
	CreatedAt Time `json:"created_at"`

	// The host of the upstream server.
	Host string `json:"host" groups:"create,update"`

	// The identification of service registred
	Id string `json:"id"`

	// The service name.
	Name string `json:"name" groups:"create,create_url,update,update_url"`

	// The path to be used in requests to the upstream server. Empty by default.
	Path string `json:"path,omitempty" groups:"create,update"`

	// The upstream server port. Defaults to 80.
	Port int `json:"port,omitempty" groups:"create,update"`

	// The protocol used to communicate with the upstream. It can be one of http (default) or https.
	Protocol string `json:"protocol" groups:"create,update"`

	// The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server. Defaults to 60000.
	ReadTimeout int `json:"read_timeout,omitempty" groups:"create,update"`

	// The number of retries to execute upon failure to proxy. The default is 5.
	Retries int `json:"retries,omitempty" groups:"create,update"`

	// The date when the service was updated
	UpdatedAt Time `json:"updated_at"`

	// Shorthand attribute to set protocol, host, port and path at once. This attribute is write-only (the Admin API never "returns" the url).
	URL string `json:"url,omitempty" groups:"create_url,update_url"`

	// The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server. Defaults to 60000.
	WriteTimeout int `json:"write_timeout,omitempty" groups:"create,update"`
}

Service it's a structure of API result

type Services

type Services interface {
	// Create creates a new service
	Create(svc *Service) (*Service, *http.Response, error)

	// CreateWithContext creates a new service
	CreateWithContext(ctx context.Context, svc *Service) (*Service, *http.Response, error)

	// CreateByURLWithContext creates a new service by URL
	CreateByURL(svc *Service) (*Service, *http.Response, error)

	// CreateByURLWithContext creates a new service by URL
	CreateByURLWithContext(ctx context.Context, svc *Service) (*Service, *http.Response, error)

	// Delete deletes registred service by ID or Name
	Delete(idOrName string) (*http.Response, error)

	// DeleteWithContext deletes registred service by ID or Name
	DeleteWithContext(ctx context.Context, idOrName string) (*http.Response, error)

	// Get retrieves registred service by ID or Name
	Get(idOrName string) (*Service, *http.Response, error)

	// GetWithContext retrieves registred service by ID or Name
	GetWithContext(ctx context.Context, idOrName string) (*Service, *http.Response, error)

	// List retrieves a list of registred services
	List(options *ListServicesOptions) ([]*Service, *http.Response, error)

	// ListWithContext retrieves a list of registred services
	ListWithContext(ctx context.Context, options *ListServicesOptions) ([]*Service, *http.Response, error)

	// Update updates a service registred by ID or Name
	Update(idOrName string, svc *Service) (*Service, *http.Response, error)

	// UpdateWithContext updates a service registred by ID or Name
	UpdateWithContext(ctx context.Context, idOrName string, svc *Service) (*Service, *http.Response, error)

	// UpdateByURL updates a service registred by URL and pass the ID or Name
	UpdateByURL(idOrName string, svc *Service) (*Service, *http.Response, error)

	// UpdateByURLWithContext updates a service registred by URL and pass the ID or Name
	UpdateByURLWithContext(ctx context.Context, idOrName string, svc *Service) (*Service, *http.Response, error)
}

Services manages the Kong upstream services.

type ServicesRoot

type ServicesRoot struct {
	Services []*Service `json:"data"`
}

ServicesRoot it's a structure of API result list

type ServicesService

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

ServicesService it's a concrete instance of service

func (*ServicesService) Create

func (s *ServicesService) Create(svc *Service) (*Service, *http.Response, error)

Create creates a new service

func (*ServicesService) CreateByURL

func (s *ServicesService) CreateByURL(svc *Service) (*Service, *http.Response, error)

CreateByURL creates a new service by URL

func (*ServicesService) CreateByURLWithContext

func (s *ServicesService) CreateByURLWithContext(ctx context.Context, svc *Service) (*Service, *http.Response, error)

CreateByURLWithContext creates a new service by URL

func (*ServicesService) CreateWithContext

func (s *ServicesService) CreateWithContext(ctx context.Context, svc *Service) (*Service, *http.Response, error)

CreateWithContext creates a new service

func (*ServicesService) Delete

func (s *ServicesService) Delete(idOrName string) (*http.Response, error)

Delete retrieves registred service by ID or Name

func (*ServicesService) DeleteWithContext

func (s *ServicesService) DeleteWithContext(ctx context.Context, idOrName string) (*http.Response, error)

DeleteWithContext retrieves registred service by ID or Name

func (*ServicesService) Get

func (s *ServicesService) Get(idOrName string) (*Service, *http.Response, error)

Get retrieves registred service by ID or Name

func (*ServicesService) GetWithContext

func (s *ServicesService) GetWithContext(ctx context.Context, idOrName string) (*Service, *http.Response, error)

GetWithContext retrieves registred service by ID or Name

func (*ServicesService) List

func (s *ServicesService) List(options *ListServicesOptions) ([]*Service, *http.Response, error)

List retrieves a list of registred services

func (*ServicesService) ListWithContext

func (s *ServicesService) ListWithContext(ctx context.Context, options *ListServicesOptions) ([]*Service, *http.Response, error)

ListWithContext retrieves a list of registred services

func (*ServicesService) Update

func (s *ServicesService) Update(idOrName string, svc *Service) (*Service, *http.Response, error)

Update updates a service

func (*ServicesService) UpdateByURL

func (s *ServicesService) UpdateByURL(idOrName string, svc *Service) (*Service, *http.Response, error)

UpdateByURL updates a service registred by URL and pass the ID or Name

func (*ServicesService) UpdateByURLWithContext

func (s *ServicesService) UpdateByURLWithContext(ctx context.Context, idOrName string, svc *Service) (*Service, *http.Response, error)

UpdateByURLWithContext updates a service registred by URL and pass the ID or Name

func (*ServicesService) UpdateWithContext

func (s *ServicesService) UpdateWithContext(ctx context.Context, idOrName string, svc *Service) (*Service, *http.Response, error)

UpdateWithContext updates a service

type Time

type Time struct {
	time.Time
}

Time it is a custom time struct for json parsing

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(value []byte) (err error)

UnmarshalJSON unmarshals string time into Time instance

Jump to

Keyboard shortcuts

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