apihub

package module
v0.0.0-...-f37d2a6 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Setup

In order to setup the development environment it's required to have glide installed on your $PATH.

make setup

Concourse CI

You must create a target called apihub before calling make pipeline

Documentation

Index

Constants

View Source
const (
	E_BAD_REQUEST string = "bad_request"
)
View Source
const SERVICES_PREFIX string = "services_"

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendInfo

type BackendInfo struct {
	Address          string `json:"address"`
	Disabled         bool   `json:"disabled"`
	HeartBeatAddress string `json:"heart_beat_address"`
	HeartBeatTimeout int    `json:"heart_beat_timeout"`
}

Backend holds information about a backend.

type Client

type Client interface {
	// Ping pings the ApiHub server.
	//
	// Errors:
	// * Error - indicates the ApiHub API server is in a bad state.
	Ping() error

	// AddService adds a new service.
	//
	// Errors:
	// * When the host is already taken.
	AddService(ServiceSpec) (Service, error)

	// RemoveService removes an existing service.
	//
	// Errors:
	// * When the host is not found.
	RemoveService(host string) error

	// Services lists all services.
	//
	// Errors:
	// * None.
	Services() ([]Service, error)

	// FindService returns the service with the specified host.
	//
	// Errors:
	// * Service not found.
	FindService(host string) (Service, error)

	// UpdateService updates the service with the specified host.
	//
	// Errors:
	// * Service not found.
	UpdateService(string, ServiceSpec) (Service, error)
}

type ErrorResponse

type ErrorResponse struct {
	Error       string `json:"error,omitempty"`
	Description string `json:"error_description,omitempty"`
}

type Service

type Service interface {
	// Host returns the subdomain/host used to access a service.
	Host() string

	// Start adds a service in the service pool to host upcoming requests.
	Start() error

	// Stop stops proxying the requests.
	Stop() error

	// Info returns information about a service.
	Info() (ServiceSpec, error)

	// Backends returns all backends in the service.
	Backends() ([]BackendInfo, error)

	// Timeout waits for the duration before returning an error to the client.
	SetTimeout(time.Duration) error
}

type ServicePublisher

type ServicePublisher interface {
	Publish(logger lager.Logger, prefix string, spec ServiceSpec) error
	Unpublish(logger lager.Logger, prefix string, host string) error
}

type ServiceSpec

type ServiceSpec struct {
	// Host specifies the subdomain/host used to access the service.
	Host     string        `json:"host"`
	Disabled bool          `json:"disabled"`
	Timeout  time.Duration `json:"timeout"` // in milliseconds
	Backends []BackendInfo `json:"backends,omitempty"`
}

ServiceInfo holds information about a service.

type ServiceSubscriber

type ServiceSubscriber interface {
	Subscribe(logger lager.Logger, prefix string, servicesCh chan ServiceSpec, stop <-chan struct{}) error
}

type Storage

type Storage interface {
	AddService(ServiceSpec) error
	UpdateService(ServiceSpec) error
	FindServiceByHost(string) (ServiceSpec, error)
	Services() ([]ServiceSpec, error)
	RemoveService(string) error
}

Storage is an interface for "storage".

Directories

Path Synopsis
api
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
connection/connectionfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
cmd
api
gatewayfakes
This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter
integration
package storage provides in memory storage implementation, for test purposes.
package storage provides in memory storage implementation, for test purposes.

Jump to

Keyboard shortcuts

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