protocol

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegisterInstance     Operation = "Register"
	DeregisterInstance             = "Deregister"
	RenewInstance                  = "Renew"
	ListServices                   = "ListServices"
	ListServiceInstances           = "ListServiceInstances"
	ListInstances                  = "ListInstances"
	SetInstanceStatus              = "SetStatus"
	GetInstance                    = "GetInfo"
)

The following are the current API operations exposed by Service Discovery.

While most operations have implementations in both API protocols (Amalgam8 / Eureka), some are unique to a certain protocol - e.g., SetInstanceStatus is currently unique to Eureka).

Also, several sub-operations may be mapped to the same Operation value, e.g. Amalgam8's ListInstances as well as Eureka's ListVips are both mapped to ListInstances.

Variables

This section is empty.

Functions

func APIHandler

func APIHandler(handler rest.HandlerFunc, protocol Type, operation Operation) rest.HandlerFunc

APIHandler returns a wrapper HandlerFunc that injects API information into the HTTP request's context (r.Env), before calling the provided HandlerFunc. The given protocol is injected as the env.APIProtocol, and the given operation as the env.APIOperation.

func NameOf

func NameOf(protocol Type) string

NameOf returns the name of the given protocol type value

Types

type APIDescriptor

type APIDescriptor struct {

	// The path part of the URL.
	Path string

	// The HTTP method (e.g. "GET"). Valid values are defined in the MethodXXX constants in the http package.
	Method string

	// The protocol (e.g., Eureka).
	Protocol Type

	// The logic operation (e.g., RegisterInstance).
	Operation Operation

	// The handler registered for this API call.
	Handler rest.HandlerFunc
}

APIDescriptor encapsulates information associated with an API call.

func (*APIDescriptor) AsRoute

func (desc *APIDescriptor) AsRoute() *rest.Route

AsRoute converts this APIDescriptor into a rest.Route object.

type Operation

type Operation string

Operation represents an operation exposed by the Service Discovery API.

func (Operation) String

func (op Operation) String() string

String returns a string representation of this Operation value.

type Type

type Type uint32

Type represents the API protocol type

const (
	Amalgam8 Type = 1 << iota // Amalgam8 protocol
	Eureka                    // Eureka protocol
)

Defines the API protocol types

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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