Documentation ¶
Index ¶
- Variables
- func CreateServiceInstance(instance ServiceInstance, service *Service, user *auth.User) error
- func DeleteInstance(si *ServiceInstance) error
- func GetServicesNames(services []Service) []string
- func Proxy(service *Service, path string, w http.ResponseWriter, r *http.Request) error
- type Client
- func (c *Client) BindApp(instance *ServiceInstance, app bind.App) (map[string]string, error)
- func (c *Client) BindUnit(instance *ServiceInstance, app bind.App, unit bind.Unit) error
- func (c *Client) Create(instance *ServiceInstance, user string) error
- func (c *Client) Destroy(instance *ServiceInstance) error
- func (c *Client) Info(instance *ServiceInstance) ([]map[string]string, error)
- func (c *Client) Plans() ([]Plan, error)
- func (c *Client) Proxy(path string, w http.ResponseWriter, r *http.Request) error
- func (c *Client) Status(instance *ServiceInstance) (string, error)
- func (c *Client) UnbindApp(instance *ServiceInstance, app bind.App) error
- func (c *Client) UnbindUnit(instance *ServiceInstance, app bind.App, unit bind.Unit) error
- type Plan
- type Service
- func (s *Service) Create() error
- func (s *Service) Delete() error
- func (s *Service) Get() error
- func (s *Service) GetUsername() string
- func (s *Service) GrantAccess(team *auth.Team) error
- func (s *Service) HasTeam(team *auth.Team) bool
- func (s *Service) RevokeAccess(team *auth.Team) error
- func (s *Service) Update() error
- type ServiceInstance
- func GetServiceInstance(serviceName string, instanceName string, u *auth.User) (*ServiceInstance, error)
- func GetServiceInstancesByServices(services []Service) ([]ServiceInstance, error)
- func GetServiceInstancesByServicesAndTeams(services []Service, u *auth.User, appName string) ([]ServiceInstance, error)
- func (si *ServiceInstance) BindApp(app bind.App, shouldRestart bool, writer io.Writer) error
- func (si *ServiceInstance) BindUnit(app bind.App, unit bind.Unit) error
- func (si *ServiceInstance) Create() error
- func (si *ServiceInstance) FindApp(appName string) int
- func (si *ServiceInstance) GetIdentifier() string
- func (si *ServiceInstance) Grant(teamName string) error
- func (si *ServiceInstance) Info() (map[string]string, error)
- func (si *ServiceInstance) MarshalJSON() ([]byte, error)
- func (si *ServiceInstance) Revoke(teamName string) error
- func (si *ServiceInstance) Service() *Service
- func (si *ServiceInstance) Status() (string, error)
- func (si *ServiceInstance) UnbindApp(app bind.App, shouldRestart bool, writer io.Writer) error
- func (si *ServiceInstance) UnbindUnit(app bind.App, unit bind.Unit) error
- type ServiceModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrServiceInstanceNotFound = stderrors.New("service instance not found") ErrInvalidInstanceName = stderrors.New("invalid service instance name") ErrInstanceNameAlreadyExists = stderrors.New("instance name already exists.") ErrAccessNotAllowed = stderrors.New("user does not have access to this service instance") ErrMultipleTeams = stderrors.New("user is member of multiple teams, please specify the team that owns the service instance") ErrUnitAlreadyBound = stderrors.New("unit is already bound to this service instance") ErrUnitNotBound = stderrors.New("unit is not bound to this service instance") ErrServiceInstanceBound = stderrors.New("This service instance is bound to at least one app. Unbind them before removing it") )
View Source
var (
ErrServiceAlreadyExists = errors.New("Service already exists.")
)
Functions ¶
func CreateServiceInstance ¶
func CreateServiceInstance(instance ServiceInstance, service *Service, user *auth.User) error
func DeleteInstance ¶
func DeleteInstance(si *ServiceInstance) error
DeleteInstance deletes the service instance from the database.
func GetServicesNames ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Destroy ¶
func (c *Client) Destroy(instance *ServiceInstance) error
func (*Client) Info ¶
func (c *Client) Info(instance *ServiceInstance) ([]map[string]string, error)
Info returns the additional info about a service instance. The api should be prepared to receive the request, like below: GET /resources/<name>
func (*Client) Plans ¶
Plans returns the service plans. The api should be prepared to receive the request, like below: GET /resources/plans
func (*Client) Proxy ¶
Proxy is a proxy between tsuru and the service. This method allow customized service methods.
func (*Client) UnbindApp ¶
func (c *Client) UnbindApp(instance *ServiceInstance, app bind.App) error
func (*Client) UnbindUnit ¶
type Service ¶
type Service struct { Name string `bson:"_id"` Username string Password string Endpoint map[string]string OwnerTeams []string `bson:"owner_teams"` Teams []string Doc string IsRestricted bool `bson:"is_restricted"` }
func GetServicesByOwnerTeams ¶
func (*Service) GetUsername ¶
type ServiceInstance ¶
type ServiceInstance struct { Name string Id int ServiceName string `bson:"service_name"` PlanName string `bson:"plan_name"` Apps []string Units []string Teams []string TeamOwner string }
func GetServiceInstance ¶
func GetServiceInstancesByServices ¶
func GetServiceInstancesByServices(services []Service) ([]ServiceInstance, error)
func (*ServiceInstance) Create ¶
func (si *ServiceInstance) Create() error
func (*ServiceInstance) FindApp ¶
func (si *ServiceInstance) FindApp(appName string) int
func (*ServiceInstance) GetIdentifier ¶
func (si *ServiceInstance) GetIdentifier() string
func (*ServiceInstance) Grant ¶
func (si *ServiceInstance) Grant(teamName string) error
func (*ServiceInstance) MarshalJSON ¶
func (si *ServiceInstance) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ServiceName in json format.
func (*ServiceInstance) Revoke ¶
func (si *ServiceInstance) Revoke(teamName string) error
func (*ServiceInstance) Service ¶
func (si *ServiceInstance) Service() *Service
func (*ServiceInstance) Status ¶
func (si *ServiceInstance) Status() (string, error)
Status returns the service instance status.
func (*ServiceInstance) UnbindApp ¶
UnbindApp makes the unbind between the service instance and an app.
func (*ServiceInstance) UnbindUnit ¶
UnbindUnit makes the unbind between the service instance and an unit.
type ServiceModel ¶
Click to show internal directories.
Click to hide internal directories.