amalgam8

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteParamServiceName = "sname"
	RouteParamInstanceID  = "iid"
)

API parameter names

View Source
const (
	//EndpointTypeTCP Denotes a TCP endpoint type
	EndpointTypeTCP = "tcp"
	//EndpointTypeUDP Denotes a UDP endpoint type
	EndpointTypeUDP = "udp"
	//EndpointTypeHTTP Denotes an HTTP endpoint type
	EndpointTypeHTTP = "http"
	//EndpointTypeHTTPS Denotes an HTTPS endpoint type
	EndpointTypeHTTPS = "https"
	//EndpointTypeUser Denotes a user-defined endpoint type
	EndpointTypeUser = "user"
)

Variables

This section is empty.

Functions

func InstanceCreateURL

func InstanceCreateURL() string

InstanceCreateURL returns URL path used for creating new instance registrations

func InstanceHeartbeatURL

func InstanceHeartbeatURL(id string) string

InstanceHeartbeatURL returns (client side) URL path used for renewing registration of the identified instance

func InstanceURL

func InstanceURL(id string) string

InstanceURL returns (client side) URL path used for interacting with the specified instance

func InstancesURL

func InstancesURL() string

InstancesURL returns URL path used for querying instances

func ServiceInstancesURL

func ServiceInstancesURL(name string) string

ServiceInstancesURL returns the (client side) URL path corresponding to the instance list for the named service

func ServiceNamesURL

func ServiceNamesURL() string

ServiceNamesURL returns (client side) URL path used for querying service names

Types

type InstanceAddress

type InstanceAddress struct {
	Type  string `json:"type,omitempty"` // possible values: { tcp, udp, http, https, user}
	Value string `json:"value"`          // can't be empty string, or consists of only spaces

}

InstanceAddress encapsulates a service network endpoint

func (*InstanceAddress) String

func (a *InstanceAddress) String() string

String output the structure

type InstanceLinks struct {
	Self      string `json:"self,omitempty"`
	Heartbeat string `json:"heartbeat,omitempty"`
}

InstanceLinks type defines the REST links relating to a service instance

func BuildLinks(baseURL, id string) *InstanceLinks

BuildLinks composes URL values in the InstanceLinks structure for the instance identifier. URL's are based off of the given base URL value.

type InstanceList

type InstanceList struct {
	ServiceName string             `json:"service_name,omitempty"`
	Instances   []*ServiceInstance `json:"instances"`
}

InstanceList type is returned in response to a request to list the instances of a service name

type InstanceRegistration

type InstanceRegistration struct {
	ServiceName string           `json:"service_name,omitempty"`
	Endpoint    *InstanceAddress `json:"endpoint,omitempty"`
	TTL         uint32           `json:"ttl,omitempty"`
	Status      string           `json:"status,omitempty"`
	Metadata    json.RawMessage  `json:"metadata,omitempty"`
	Tags        []string         `json:"tags,omitempty"`
}

InstanceRegistration encapsulates information needed for a service instance registration request

func (*InstanceRegistration) String

func (ir *InstanceRegistration) String() string

String output the structure

type InstancesList

type InstancesList struct {
	Instances []*ServiceInstance `json:"instances"`
}

InstancesList type is returned in response to a request to list the instances

type Routes

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

Routes encapsulates information needed for the aykesd protocol routes

func New

func New(catalogMap store.CatalogMap) *Routes

New creates a Routes object for the amalgam8 protocol routes

func (*Routes) RouteHandlers

func (routes *Routes) RouteHandlers(middlewares ...rest.Middleware) []*rest.Route

RouteHandlers returns an array of route handlers

type ServiceInstance

type ServiceInstance struct {
	ID            string           `json:"id,omitempty"`
	ServiceName   string           `json:"service_name,omitempty"`
	Endpoint      *InstanceAddress `json:"endpoint,omitempty"`
	TTL           uint32           `json:"ttl,omitempty"`
	Status        string           `json:"status,omitempty"`
	Metadata      json.RawMessage  `json:"metadata,omitempty"`
	LastHeartbeat *time.Time       `json:"last_heartbeat,omitempty"`
	Links         *InstanceLinks   `json:"links,omitempty"`
	Tags          []string         `json:"tags,omitempty"`
}

ServiceInstance defines the response of a successful instance registration request

func (*ServiceInstance) GetJSONToFieldsMap

func (si *ServiceInstance) GetJSONToFieldsMap() map[string]string

GetJSONToFieldsMap returns a map from JSON fields to struct field names

func (*ServiceInstance) String

func (si *ServiceInstance) String() string

String output the structure

type ServicesList

type ServicesList struct {
	Services []string `json:"services"`
}

ServicesList is the response type returned from a request to query service names

Jump to

Keyboard shortcuts

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