Documentation ¶
Index ¶
- Constants
- func BasicAuthHandler(h http.Handler, username, password string) http.Handler
- type RiakService
- func (s *RiakService) BindInstance(r *http.Request) (int, interface{}, error)
- func (s *RiakService) BindInstanceEvent(r *http.Request) (int, interface{}, error)
- func (s *RiakService) CheckInstanceStatus(r *http.Request) (int, interface{}, error)
- func (s *RiakService) CreateInstance(r *http.Request) (int, interface{}, error)
- func (s *RiakService) GetPlans(r *http.Request) (int, interface{}, error)
- func (s *RiakService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
- func (s *RiakService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint
- func (s *RiakService) Middleware(h http.Handler) http.Handler
- func (s *RiakService) Prefix() string
- func (s *RiakService) RemoveInstance(r *http.Request) (int, interface{}, error)
- func (s *RiakService) UnbindInstance(r *http.Request) (int, interface{}, error)
- func (s *RiakService) UnbindInstanceEvent(r *http.Request) (int, interface{}, error)
Constants ¶
const ( // MissingParamsMsg message when parameters are required MissingParamsMsg = "Missing parameters" // BucketCreationFailMsg message when bucket creation fails BucketCreationFailMsg = "Error declaring bucket type" // ErrorBucketStatusMsg message when bucket status is in error state ErrorBucketStatusMsg = "Bucket error" // UserGrantingFailMsg message when granting access to users fails UserGrantingFailMsg = "Error granting user" // UserRevokingFailMsg message when revoking access to users fails UserRevokingFailMsg = "Error revoking user" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RiakService ¶
type RiakService struct { // Application configuration Cfg *config.ServiceConfig // resources client (normally riak) Client client.Client }
RiakService expose tsuru api for riak service
func NewRiakService ¶
func NewRiakService(c *config.ServiceConfig, client client.Client) *RiakService
NewRiakService creates a new services ready to register on the server
func (*RiakService) BindInstance ¶
func (s *RiakService) BindInstance(r *http.Request) (int, interface{}, error)
BindInstance Binds an app to an instance on Tsuru, this translates to a new authentication credentias and authorization for teh desired bucket
func (*RiakService) BindInstanceEvent ¶
func (s *RiakService) BindInstanceEvent(r *http.Request) (int, interface{}, error)
BindInstanceEvent Processes the event from tsuru when an app is binded to a service instance
func (*RiakService) CheckInstanceStatus ¶
func (s *RiakService) CheckInstanceStatus(r *http.Request) (int, interface{}, error)
CheckInstanceStatus Checks the status of an instance on tsuru. Translated to riak, Checks the status of the bucket
func (*RiakService) CreateInstance ¶
func (s *RiakService) CreateInstance(r *http.Request) (int, interface{}, error)
CreateInstance Creates a new instance on Tsuru, this translates to a new bucket of the desired bucket type on Riak
func (*RiakService) GetPlans ¶
func (s *RiakService) GetPlans(r *http.Request) (int, interface{}, error)
GetPlans returns a json with the available plans on tsuru. Translated to riak, this are the bucket types
func (*RiakService) JSONEndpoints ¶
func (s *RiakService) JSONEndpoints() map[string]map[string]server.JSONEndpoint
JSONEndpoints maps the routes with the endpoints
func (*RiakService) JSONMiddleware ¶
func (s *RiakService) JSONMiddleware(j server.JSONEndpoint) server.JSONEndpoint
JSONMiddleware wraps all the requests around these middlewares
func (*RiakService) Middleware ¶
func (s *RiakService) Middleware(h http.Handler) http.Handler
Middleware wraps all the requests around thesse middlewares
func (*RiakService) Prefix ¶
func (s *RiakService) Prefix() string
Prefix returns the url prefix for all the endpoints of this service
func (*RiakService) RemoveInstance ¶
func (s *RiakService) RemoveInstance(r *http.Request) (int, interface{}, error)
RemoveInstance Remove instance Removes the instance from tsuru. Translated to riak, delete all the keys from the bucket (causing bucket deletion) -> not a good choice, not deleting bucket Bucket will persist 'forever'
func (*RiakService) UnbindInstance ¶
func (s *RiakService) UnbindInstance(r *http.Request) (int, interface{}, error)
UnbindInstance Unbinds the instance from the app on Tsuru, this translates to remove credentials from the desired bucket
func (*RiakService) UnbindInstanceEvent ¶
func (s *RiakService) UnbindInstanceEvent(r *http.Request) (int, interface{}, error)
UnbindInstanceEvent Processes the event from tsuru when an app is unbinded from a service instance