Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( IDNotFoundError = restkit.NotFoundError("not found", 0) DuplicateIDError = restkit.BadRequestError("duplicate ID", codeDuplicateID) ValidationError = restkit.BadRequestError("validation", codeValidation) )
Functions ¶
func IsDuplicateID ¶
IsDuplicateID returns true if the cause of the given error is DuplicateIDError.
func IsIDNotFound ¶
IsIDNotFound returns true if the cause of the given error is IDNotFoundError.
func IsValidation ¶
IsValidation returns true if the cause of the given error is ValidationError.
Types ¶
type API ¶
type API interface {
// Add adds a given frontend record with given ID to the list of frontends.
// If the given ID already exists, a DuplicateIDError is returned.
Add(id string, record FrontendRecord) error
// Remove a frontend with given ID.
// If the ID is not found, an IDNotFoundError is returned.
Remove(id string) error
// All returns a map of all known frontend records mapped by their ID.
All() (map[string]FrontendRecord, error)
// Get returns the frontend record for the given id.
// If the ID is not found, an IDNotFoundError is returned.
Get(id string) (FrontendRecord, error)
}
API is the client interface for controlling the frontends of the Robin loadbalancer.
type FrontendRecord ¶
type FrontendRecord struct {
Selectors []FrontendSelectorRecord `json:"selectors"`
Service string `json:"service,omitempty"`
Mode string `json:"mode,omitempty"` // http|tcp
HttpCheckPath string `json:"http-check-path,omitempty"`
HttpCheckMethod string `json:"http-check-method,omitempty"`
Sticky bool `json:"sticky,omitempty"`
Backup bool `json:"backup,omitempty"`
}
func (FrontendRecord) Validate ¶
func (r FrontendRecord) Validate() error
Validate checks the given object for invalid values.
type FrontendSelectorRecord ¶
type FrontendSelectorRecord struct {
Weight int `json:"weight,omitempty"`
Domain string `json:"domain,omitempty"`
PathPrefix string `json:"path-prefix,omitempty"`
SslCert string `json:"ssl-cert,omitempty"`
ServicePort int `json:"port,omitempty"`
FrontendPort int `json:"frontend-port,omitempty"`
Private bool `json:"private,omitempty"`
Users []UserRecord `json:"users,omitempty"`
RewriteRules []RewriteRule `json:"rewrite-rules,omitempty"`
}
func (FrontendSelectorRecord) Validate ¶
func (r FrontendSelectorRecord) Validate() error
Validate checks the given object for invalid values.
type RewriteRule ¶
type RewriteRule struct {
PathPrefix string `json:"path-prefix,omitempty"` // Add this to the start of the request path.
RemovePathPrefix string `json:"remove-path-prefix,omitempty"` // Remove this from the start of the request path.
Domain string `json:"domain,omitempty"` // Redirect to this domain
}
func (RewriteRule) Validate ¶
func (r RewriteRule) Validate() error
Validate checks the given object for invalid values.
type UserRecord ¶
func (UserRecord) Validate ¶
func (r UserRecord) Validate() error
Validate checks the given object for invalid values.
Directories
¶
| Path | Synopsis |
|---|---|
|
deps
|
|
|
github.com/juju/errgo
The errgo package provides a way to create and diagnose errors.
|
The errgo package provides a way to create and diagnose errors. |
|
github.com/juju/errgo/errors
The errors package provides a way to create and diagnose errors.
|
The errors package provides a way to create and diagnose errors. |