Documentation ¶
Overview ¶
Package backplane contains client API bindings for Backplane, a distributed hosted load balancer.
Index ¶
- type Backend
- type Client
- func (c *Client) API(method, path string, parameters map[string]string, postData interface{}, ...) error
- func (c *Client) GenToken() (string, error)
- func (c *Client) Query() (*QueryResponse, error)
- func (c *Client) Route(pattern string, labels map[string]string) (*Route, error)
- func (c *Client) Shape(endpoint string, weights map[string]int) error
- type Endpoint
- type Location
- type QueryResponse
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct { ID string `json:"ID"` Owner string `json:"Owner"` RawLabels string `json:"RawLabels"` Load int `json:"Load"` RemoteAddr string `json:"RemoteAddr"` ConnectedAt time.Time `json:"ConnectedAt"` Location Location `json:"Location"` RequestsPerSecond int `json:"RequestsPerSecond"` State string `json:"State"` }
Backend is a HTTP web server connected to Backplane via the backplane agent paired to it.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs actions against the Backplane API server.
func (*Client) API ¶
func (c *Client) API(method, path string, parameters map[string]string, postData interface{}, out interface{}) error
API is a generic json-encoding like function that allows access to any backplane.io API call.
See the implementation of Client.Query and Client.Shape for usage information.
func (*Client) GenToken ¶
GenToken creates a new Backplane API token for a future backplane Agent to user.
func (*Client) Query ¶
func (c *Client) Query() (*QueryResponse, error)
Query fetches infornation about all Endpoints, Routes and Backends registered to your account.
type Endpoint ¶
type Endpoint struct { Pattern string `json:"Pattern"` Owner string `json:"Owner"` CreatedAt time.Time `json:"CreatedAt"` Routes []Route `json:"Routes"` }
Endpoint looks like example.com api.example.com, or www.example.com/blog and are matched to requests with URLs that most closely match them.
type Location ¶
type Location struct { Latitude float64 `json:"Latitude"` Longitude float64 `json:"Longitude"` CityName string `json:"CityName"` CountryCode string `json:"CountryCode"` CountryName string `json:"CountryName"` ContinentCode string `json:"ContinentCode"` ContinentName string `json:"ContinentName"` RegionCode string `json:"RegionCode"` RegionName string `json:"RegionName"` }
Location represents a geographic location.
type QueryResponse ¶
type QueryResponse struct { Token string `json:"Token"` Endpoints []Endpoint `json:"Endpoints"` Backends []Backend `json:"Backends"` }
QueryResponse matches the output of www.backplane.io/q
type Route ¶
type Route struct { ID string `json:"ID,omitempty"` RawSelector string `json:"RawSelector"` Weight int `json:"Weight,omitempty"` Strategy string `json:"Strategy,omitempty"` Backends []string `json:"Backends,omitempty"` }
Route is how Backplane determines how to get traffic from an Endpoint to a Backend. Routes are identified by their routeID, which looks like route000. Routes are chosen by their Endpoint based on their weight.
Once a Route has been chosen Backplane will then choose a Backend.