Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend struct { ID *int `json:"id,omitempty"` Address string `json:"address,omitempty"` Director string `json:"director,omitempty"` DC DC `json:"dc,omitempty"` Port int `json:"port,omitempty"` InheritTimeProfile bool `json:"inherit_time_profile,omitempty"` Weight *int `json:"weight,omitempty"` Tags []string `json:"tags,omitempty"` ResourceURI string `json:"resource_uri,omitempty"` }
Backend represents JSON structure of backend in VaaS API.
type Client ¶
type Client interface { FindDirectorID(string) (int, error) AddBackend(*Backend) (string, error) DeleteBackend(int) error GetDC(string) (*DC, error) }
Client is an interface for VaaS API.
type Config ¶ added in v0.9.0
type Config struct { // Enabled is a flag to control whether hook should be used Enabled bool `default:"true" envconfig:"vaas_hook_enabled"` // Varnish as a Service API url VaasAPIHost string `default:"" envconfig:"vaas_host"` // Varnish as a Service username VaasAPIUsername string `default:"" envconfig:"vaas_username"` // Varnish as a Service access token VaasAPIKey string `default:"" envconfig:"vaas_token"` // VaasAsyncTimeout is a timeout for async registration in VaaS VaasAsyncTimeout time.Duration `default:"90s" envconfig:"vaas_async_timeout"` }
Config is Varnish configuration settable from environment
type DC ¶
type DC struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` ResourceURI string `json:"resource_uri,omitempty"` Symbol string `json:"symbol,omitempty"` }
DC represents JSON structure of DC in VaaS API.
type Director ¶
type Director struct { ID int `json:"id,omitempty"` Backends []string `json:"backends,omitempty"` Cluster []string `json:"cluster,omitempty"` Name string `json:"name,omitempty"` ResourceURI string `json:"resource_uri,omitempty"` }
Director represents JSON structure of Director in VaaS API.
type DirectorList ¶
type DirectorList struct { Meta Meta `json:"meta,omitempty"` Objects []Director `json:"objects,omitempty"` }
DirectorList represents JSON structure of Director list used in responses in VaaS API.
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook manages lifecycle of Varnish backend related to executed service instance.
func (*Hook) DeregisterBackend ¶
func (sh *Hook) DeregisterBackend(_ mesosutils.TaskInfo) error
DeregisterBackend deletes backend from VaaS.
func (*Hook) HandleEvent ¶
HandleEvent calls appropriate hook functions that correspond to supported event types. Unsupported events are ignored.
func (*Hook) RegisterBackend ¶
func (sh *Hook) RegisterBackend(taskInfo mesosutils.TaskInfo) error
RegisterBackend adds new backend to VaaS if it does not exist.