service

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Service module.

The service module contains a set of functions to manipulate the connection aspect of the request to the Service, such as connecting to a given host, IP address/port, or choosing a given Upstream entity for load-balancing and healthchecking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	bridge.PdkBridge
}

Holds this module's functions. Accessible as `kong.Service`

func (Service) SetTarget

func (s Service) SetTarget(host string, port int) error

kong.Service.SetTarget() sets the host and port on which to connect to for proxying the request.

Using this method is equivalent to ask Kong to not run the load-balancing phase for this request, and consider it manually overridden. Load-balancing components such as retries and health-checks will also be ignored for this request.

The host argument expects a string containing the IP address of the upstream server (IPv4/IPv6), and the port argument must contain a number representing the port on which to connect to.

func (Service) SetUpstream

func (s Service) SetUpstream(host string) error

kong.Service.SetUpstream() sets the desired Upstream entity to handle the load-balancing step for this request. Using this method is equivalent to creating a Service with a host property equal to that of an Upstream entity (in which case, the request would be proxied to one of the Targets associated with that Upstream).

The host argument should receive a string equal to that of one of the Upstream entities currently configured.

Directories

Path Synopsis
Manipulation of the request to the Service.
Manipulation of the request to the Service.
Manipulation of the response from the Service.
Manipulation of the response from the Service.

Jump to

Keyboard shortcuts

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