api

package
v0.0.0-...-dfbecc7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Type   string                 `json:"type"`
	Config map[string]interface{} `json:"config,omitempty"`
}

Configuration defines loadable parameters for a given middleware type.

type Container

type Container struct {
	Name  string `json:"name,omitempty"`
	Image string `json:"image,omitempty"`
}

Container encapsulates optional container information.

type Duration

type Duration time.Duration

Duration defines text marshalling and unmarshalling for `time.Duration`.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

MarshalText converts a Duration value into JSON bytes.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(b []byte) error

UnmarshalText converts the JSON bytes into a Duration value.

type EndpointInfo

type EndpointInfo struct {
	Nodes []Node `json:"nodes"`
}

EndpointInfo encapsulates node and service instance information in an object payload.

func (*EndpointInfo) Prepare

func (e *EndpointInfo) Prepare()

Prepare initializes optimized data structures after loading or unmarshalling.

type Endpoints

type Endpoints interface {
	GetEndpoints(currentIndex int64) (nodes []Node, index int64, useCache bool, err error)
	AddEndpoints(node Node) (modification *Modification, err error)
	RemoveEndpoints(nodeID string, serviceNames ...string) (modification *Modification, err error)
}

Endpoints handles retrieving and modifiying endpoints (nodes and service instances).

type HealthCheck

type HealthCheck struct {
	Timeout            Duration               `json:"timeout"`
	Interval           Duration               `json:"interval"`
	UnhealthyThreshold uint32                 `json:"unhealthyThreshold"`
	HealthyThreshold   uint32                 `json:"healthyThreshold"`
	CheckType          string                 `json:"checkType"`
	CheckConfig        map[string]interface{} `json:"checkConfig,omitempty"`
}

HealthCheck defines the health check behavior.

type Metadata

type Metadata map[string]interface{}

Metadata is user-defined key/value pairs that can be applied to nodes and services instances.

type Modification

type Modification struct {
	Index    int64    `json:"index"`
	Node     bool     `json:"nodeAffected"`
	Services []string `json:"services"`
}

Modification defines the post-modification state after adding or removing nodes and service instances.

type Node

type Node struct {
	ID         uuid.UUID         `json:"id"`
	Geography  string            `json:"geography"`
	Datacenter string            `json:"datacenter"`
	Address    net.IP            `json:"address"`
	Metadata   Metadata          `json:"metadata,omitempty"`
	Services   []ServiceInstance `json:"services,omitempty"`
}

Node represents a single running server node or sidecar proxy.

func (*Node) Prepare

func (n *Node) Prepare()

Prepare initializes optimized data structures after loading or unmarshalling.

type Operation

type Operation struct {
	Name       string `json:"name"`
	Method     string `json:"method"`
	URIPattern string `json:"uriPattern"`
	RoutingRules
}

Operation defines a single service operation and its operation-scoped routing rules.

type Port

type Port struct {
	Port     int32  `json:"port"`
	Protocol string `json:"protocol"`
	Secure   bool   `json:"secure"`
}

Port defines the port and protcol a service is listening on.

type Ports

type Ports []Port

Ports provides convenience methods on top if `[]Port`

func (Ports) Find

func (p Ports) Find(protocols ...string) (Port, bool)

Find returns the first occurrence of a port that matches one of the desired protocols (in preference order).

type Retry

type Retry struct {
	Attempts           int      `json:"attempts"`
	ResponseClassifier string   `json:"responseClassifier,omitempty"`
	PerTryTimeout      Duration `json:"perTryTimeout"`
}

Retry defines retry behavior rule.

type RouteInfo

type RouteInfo struct {
	Services []Service     `json:"services"`
	Global   *RoutingRules `json:"global,omitempty"`
}

RouteInfo encapsulates services and routes as well as global routing rules.

type Routes

type Routes interface {
	GetServices(currentIndex int64) (services []Service, index int64, useCache bool, err error)
	SetService(service Service) (index int64, err error)
	RemoveService(serviceName string) (index int64, err error)
}

Routes handles retrieving and modifiying services and routes.

type RoutingRules

type RoutingRules struct {
	Selectors    []string        `json:"selectors,omitempty"`
	RewriteRules []Configuration `json:"rewriteRules,omitempty"`
	Timeout      *Duration       `json:"timeout,omitempty"`
	Retry        *Retry          `json:"retry,omitempty"`
	Policies     []Configuration `json:"policies,omitempty"`
	Middleware   interface{}     `json:"-"`
}

RoutingRules defines the selectors, rewrite rules, retry behavior, and policies for a service or operation.

type Service

type Service struct {
	Name           string   `json:"name"`
	Namespace      string   `json:"namespace,omitempty"`
	Description    string   `json:"description"`
	Hostname       string   `json:"hostname,omitempty"`
	URIPrefix      string   `json:"uriPrefix"`
	Version        *Version `json:"version,omitempty"`
	Authentication string   `json:"authentication"`
	RoutingRules
	Operations  []Operation  `json:"operations"`
	HealthCheck *HealthCheck `json:"healthCheck,omitempty"`
}

Service defines a service application and its operations and service-scoped routing rules.

type ServiceInstance

type ServiceInstance struct {
	ID        uuid.UUID           `json:"id"`
	Service   string              `json:"service"`
	Name      string              `json:"name,omitempty"`
	Namespace string              `json:"namespace,omitempty"`
	Principal string              `json:"principal,omitempty"`
	Owner     string              `json:"owner,omitempty"`
	Container *Container          `json:"container,omitempty"`
	Ports     Ports               `json:"ports"`
	Metadata  Metadata            `json:"metadata,omitempty"`
	Labels    []string            `json:"labels,omitempty"`
	LabelSet  map[string]struct{} `json:"-"`
}

ServiceInstance defines a single running instance of a service.

func (*ServiceInstance) Prepare

func (s *ServiceInstance) Prepare()

Prepare initializes optimized data structures after loading or unmarshalling.

type Version

type Version struct {
	VersionLocations []string `json:"versionLocations,omitempty"`
	DefaultVersion   string   `json:"defaultVersion"`
}

Version defines rules for extracting the service/API version from the request.

Directories

Path Synopsis
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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