Documentation ¶
Index ¶
- Constants
- Variables
- type Active
- type CommonPluginConfig
- type Comsumner
- type Consumer
- type ConsumerConfig
- type HealthChecks
- type Healthy
- type Passive
- type Plugins
- type Route
- type RouteConfig
- type RouteList
- type ServiceConfig
- type ServiceID
- type ServiceList
- type Target
- type TargetConfig
- type Unhealthy
- type Upstream
- type UpstreamConfig
Constants ¶
View Source
const (
CONSUMER_RESOURCE_OBJECT = "consumers"
)
View Source
const (
PLUGIN_RESOURCE_OBJECT = "plugins"
)
View Source
const (
ROUTE_RESOURCE_OBJECT = "routes"
)
View Source
const (
SERVICE_RESOURCE_OBJECT = "services"
)
View Source
const (
TARGET_RESOURCE_OBJECT = "targets"
)
View Source
const (
UPSTREAM_RESOURCE_OBJECT = "upstreams"
)
Variables ¶
View Source
var CertificateResourceObjectCommand = cli.Command{ Name: "certificate", Usage: "The kong certificate object.", Subcommands: []cli.Command{}, }
TODO
View Source
var ConsumerResourceObjectCommnad = cli.Command{ Name: "consumer", Usage: "The kong consumer object.", Subcommands: []cli.Command{ { Name: "create", Usage: "create consumer object", Flags: []cli.Flag{ cli.StringFlag{ Name: "username", Usage: "the unique username of the consumer", }, cli.StringFlag{ Name: "custom_id", Usage: "the custom_id field for storing an existing unique ID for the consumer", }, }, Action: createConsumer, }, { Name: "list", Usage: "list all consumers object", Flags: []cli.Flag{}, Action: getConsumers, }, { Name: "get", Usage: "retrieve consumer object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the consumer id", }, cli.StringFlag{ Name: "username", Usage: "the consumer username", }, }, Action: getConsumber, }, { Name: "delete", Usage: "delete consumer object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the consumer id", }, cli.StringFlag{ Name: "username", Usage: "the consumer username", }, }, Action: deleteConsumber, }, }, }
View Source
var PluginResourceObjectCommand = cli.Command{ Name: "plugin", Usage: "The kong plugin object.", Subcommands: []cli.Command{ { Name: "avalible_plugins", Usage: "current support plugins object", Action: avaiblePlugins, }, { Name: "create", Usage: "create a plugin object", Subcommands: []cli.Command{ authentication.BasicAuthCommand, logging.StatsDCommand, }, }, { Name: "get", Usage: "retrieve a plugin object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the plugin id", }, }, Action: getPlugin, }, { Name: "list", Usage: "list all plugins object", Flags: []cli.Flag{ cli.StringFlag{ Name: "service_id", Usage: "the service object id", }, cli.StringFlag{ Name: "route_id", Usage: "the route object id", }, cli.StringFlag{ Name: "size", Value: "100", Usage: "limit on the number of objects to be returned", }, }, Action: getPlugins, }, { Name: "delete", Usage: "delete a plugin object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the plugin id", }, }, Action: deletePlugin, }, }, }
View Source
var RouteResourceObjectCommand = cli.Command{ Name: "route", Usage: "The kong route object.", Subcommands: []cli.Command{ { Name: "create", Usage: "create route object", Flags: routeCommonFlags, Action: createRoute, }, { Name: "get", Usage: "retrieve route object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "The route id", }, }, Action: getRoute, }, { Name: "delete", Usage: "delete route object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the route id", }, }, Action: deleteRoute, }, { Name: "list", Usage: "list all routes object", Flags: []cli.Flag{ cli.StringFlag{ Name: "size", Value: "100", Usage: "A limit on the number of objects to be returned per page", }, cli.StringFlag{ Name: "offset", Usage: "A cursor used for pagination. offset is an object identifier that defines a place in the list", }, }, Action: getRoutes, }, }, }
View Source
var SNIResourceObjectCommand = cli.Command{ Name: "snis", Usage: "The kong sni object.", Subcommands: []cli.Command{}, }
TODO
View Source
var ServiceResourceObjectCommand = cli.Command{ Name: "service", Usage: "The kong service object.", Subcommands: []cli.Command{ { Name: "create", Usage: "create service object", Flags: serviceFlags, Action: createService, }, { Name: "get", Usage: "retrieve service object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the service id", }, cli.StringFlag{ Name: "name", Usage: "the service name", }, }, Action: getService, }, { Name: "delete", Usage: "delete service object", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the service id", }, cli.StringFlag{ Name: "name", Usage: "the service name", }, }, Action: deleteService, }, { Name: "list", Usage: "list all services object", Action: getAllServices, }, { Name: "routes", Usage: "list routes associated to a service", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the service id", }, cli.StringFlag{ Name: "name", Usage: "the service name", }, }, Action: getRoutesByService, }, }, }
View Source
var TargetResourceObjectCommand = cli.Command{ Name: "target", Usage: "The kong target object.", Subcommands: []cli.Command{ { Name: "create", Usage: "Create target object", Flags: targetCommonFlags, Action: createTarget, }, { Name: "list", Usage: "Lists all targets currently active on the upstream’s load balancing wheel", Flags: append(targetCommonFlags, cli.StringFlag{ Name: "id", Usage: "the target id", }), Action: getTargets, }, { Name: "delete", Usage: "Disable a target in the load balancer", Flags: []cli.Flag{ cli.StringFlag{ Name: "id", Usage: "the target id", }, cli.StringFlag{ Name: "upstream_id", Usage: "the upstream id", }, cli.StringFlag{ Name: "name", Usage: "the upstream name", }, cli.StringFlag{ Name: "target", Usage: "The target address (ip or hostname) and port,If omitted the port defaults to 8000", }, }, Action: deleteTarget, }, }, }
View Source
var UpstreamResourceObjectCommand = cli.Command{ Name: "upstream", Usage: "The kong upstream object.", Subcommands: []cli.Command{ { Name: "create", Usage: "create upstream object", Flags: upstreamCommonFlags, Action: createUpstream, }, { Name: "get", Usage: "get upstream object", Flags: []cli.Flag{ cli.StringFlag{Name: "name", Usage: "the upstream name"}, cli.StringFlag{Name: "id", Usage: "the upstream id"}, }, Action: getUpstream, }, { Name: "list", Usage: "list all upstream object", Flags: []cli.Flag{ cli.StringFlag{Name: "name", Usage: "the upstream name"}, cli.StringFlag{Name: "id", Usage: "the upstream id"}, cli.StringFlag{Name: "size", Value: "100", Usage: "A limit on the number of objects to be returned."}, }, Action: getUpstreams, }, { Name: "delete", Usage: "delete upstream object", Flags: []cli.Flag{ cli.StringFlag{Name: "name", Usage: "the upstream name"}, cli.StringFlag{Name: "id", Usage: "the upstream id"}, }, Action: deleteUpstream, }, }, }
Functions ¶
This section is empty.
Types ¶
type Active ¶
type Active struct { //Socket timeout for active health checks (in seconds). Timeout int `json:"timeout,omitempty"` //Number of targets to check concurrently in active health checks. Concurrency int `json:"concurrency,omitempty"` //Path to use in GET HTTP request to run as a probe on active health checks. HTTPPath string `json:"http_path,omitempty"` //Health checks Healthy Healthy `json:"healthy,omitempty"` //Unhealthy checks Unhealthy Unhealthy `json:"unhealthy,omitempty"` }
type CommonPluginConfig ¶
type Consumer ¶
type Consumer struct {
Data []ConsumerConfig `json:"data"`
}
type ConsumerConfig ¶
type HealthChecks ¶
type Healthy ¶
type Healthy struct { //Interval between active health checks for healthy targets (in seconds). A value of zero indicates that active probes for healthy targets should not be performed. Interval int `json:"interval,omitempty"` //An array of HTTP statuses to consider a success, indicating healthiness, when returned by a probe in active health checks. HTTPStatuses []int `json:"http_statuses,omitempty"` //Number of successes in active probes (as defined by healthchecks.active.healthy.http_statuses) to consider a target healthy. Successes int `json:"successes,omitempty"` }
type Plugins ¶
type Plugins struct {
Data []CommonPluginConfig `json:"data"`
}
type RouteConfig ¶
type RouteConfig struct { ID string `json:"id"` //The route id Protocols []string `json:"protocols"` //A list of the protocols this Route should allow Methods []string `json:"methods,omitempty"` //A list of HTTP methods that match this route Hosts []string `json:"hosts,omitempty"` //A list of domain names that match this route. When using http or https protocols, at least one of hosts, paths, or methods must be set Paths []string `json:"paths,omitempty"` //A list of paths that match this route.When using http or https protocols, at least one of hosts, paths, or methods must be set. RegexPriority int `json:"regex_priority,omitempty"` //A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. StripPath bool `json:"strip_path,omitempty"` //When matching a Route via one of the paths, strip the matching prefix from the upstream request URL PreserveHost bool `json:"preserve_host,omitempty"` //When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers Service ServiceID `json:"service"` //The Service this Route is associated to. }
type RouteList ¶
type RouteList struct {
Data []RouteConfig `json:"data"`
}
type ServiceConfig ¶
type ServiceConfig struct { ID string `json:"id"` //the service id Name string `json:"name"` //the service name Retries int `json:"retries"` //the number if retries to execute upon failure to proxy. Protocol string `json:"protocol"` //the protocol used to communicate with the upstream. Host string `json:"host"` //the host of the upstream server Port int `json:"port"` //the upstream server port Path string `json:"path"` //the path to be used in requests to the upstream server ConnectTimeout int `json:"connect_timeout"` //the timeout in millilsends for establishing a connection to the upstream server WriteTimeout int `json:"write_timeout"` //the timeout in milliseconds between two successive write operations for transmitting a request to the upstream server. ReadTimeout int `json:"read_timeout"` //the timeout in milliseconds between two successive read operations for transmitting a request to the upstream server URL string `json:"url"` //shorthand attribute to set protocol, host, port and path at once. This attribute is write-only }
type ServiceList ¶
type ServiceList struct {
Data []ServiceConfig `json:"data"`
}
type Target ¶
type Target struct {
Data []TargetConfig `json:"data"`
}
type TargetConfig ¶
type TargetConfig struct { ID string `json:"id,omitempty"` UpstreamID string `json:"upstream_id,omitempty"` // The target address (ip or hostname) and port. If omitted the port defaults to 8000. If the hostname resolves to an SRV record, the port value will overridden by the value from the dns record. Target string `json:"target"` //The weight this target gets within the upstream loadbalancer (0-1000, defaults to 100). If the hostname resolves to an SRV record, the weight value will overridden by the value from the dns record. Weight int `json:"weight,omitempty"` }
type Unhealthy ¶
type Unhealthy struct { //Interval between active health checks for unhealthy targets (in seconds). A value of zero indicates that active probes for unhealthy targets should not be performed. Interval int `json:"interval,omitempty"` //An array of HTTP statuses to consider a failure, indicating unhealthiness, when returned by a probe in active health checks. HTTPStatuses []int `json:"http_statuses,omitempty"` //Number of TCP failures in active probes to consider a target unhealthy. TCPFailures int `json:"tcp_failures,omitempty"` //Number of timeouts in active probes to consider a target unhealthy. Timeouts int `json:"timeouts,omitempty"` //Number of HTTP failures in active probes (as defined by healthchecks.active.unhealthy.http_statuses) to consider a target unhealthy. HTTPFailures int `json:"http_failures"` }
type Upstream ¶
type Upstream struct {
Data []UpstreamConfig `json:"data"`
}
type UpstreamConfig ¶
type UpstreamConfig struct { //The upstream ID ID string `json:"ID,omitempty"` //This is a hostname, which must be equal to the host of a Service. Name string `json:"name"` //The number of slots in the loadbalancer algorithm (10-65536, defaults to 1000). Slots int `json:"slots,omitempty"` //What to use as hashing input: none, consumer, ip, header, or cookie (defaults to none resulting in a weighted-round-robin scheme). HashOn string `json:"hash_on,omitempty"` // What to use as hashing input if the primary hash_on does not return a hash (eg. header is missing, or no consumer identified). One of: none, consumer, ip, header, or cookie (defaults to none, not available if hash_on is set to cookie). HashFallback string `json:"hash_fallback,omitempty"` //The header name to take the value from as hash input (only required when hash_on is set to header) HashOnHeader string `json:"hash_on_header,omitempty"` //The header name to take the value from as hash input (only required when hash_fallback is set to header). HashFallbackHeader string `json:"hash_fallback_header,omitempty"` //The cookie name to take the value from as hash input (only required when hash_on or hash_fallback is set to cookie). If the specified cookie is not in the request, Kong will generate a value and set the cookie in the response. HashOnCookie string `json:"hash_on_cookie,omitempty"` //The cookie path to set in the response headers (only required when hash_on or hash_fallback is set to cookie, defaults to "/") HashOnCookiePath string `json:"hash_on_cookie_path,omitempty"` //Target health check HealthChecks HealthChecks `json:"healthchecks,omitempty"` }
Click to show internal directories.
Click to hide internal directories.