Documentation ¶
Index ¶
- Variables
- func BrokerService() (serviceTypes.ServiceBrokerService, error)
- func CatalogCacheService() (service.ServiceBrokerCatalogCacheService, error)
- func Create(s Service) error
- func CreateServiceInstance(instance ServiceInstance, service *Service, evt *event.Event, requestID string) error
- func Delete(s Service) error
- func DeleteInstance(si *ServiceInstance, evt *event.Event, requestID string) error
- func InitializeSync(appLister func() ([]bind.App, error)) error
- func Proxy(service *Service, path string, evt *event.Event, requestID string, ...) error
- func ProxyInstance(instance *ServiceInstance, path string, evt *event.Event, requestID string, ...) error
- func RenameServiceInstanceTeam(oldName, newName string) error
- func RenameServiceTeam(oldName, newName string) error
- func Update(s Service) error
- type BindAppParameters
- type BrokerInstanceBind
- type BrokerInstanceData
- type Plan
- type Service
- type ServiceClient
- type ServiceInstance
- func GetServiceInstance(serviceName string, instanceName string) (*ServiceInstance, error)
- func GetServiceInstancesBoundToApp(appName string) ([]ServiceInstance, error)
- func GetServiceInstancesByServices(services []Service) ([]ServiceInstance, error)
- func GetServicesInstancesByTeamsAndNames(teams []string, names []string, appName, serviceName string) ([]ServiceInstance, error)
- func (si *ServiceInstance) BindApp(app bind.App, params BindAppParameters, shouldRestart bool, writer io.Writer, ...) error
- func (si *ServiceInstance) BindUnit(app bind.App, unit bind.Unit) error
- func (si *ServiceInstance) FindApp(appName string) int
- func (si *ServiceInstance) GetIdentifier() string
- func (si *ServiceInstance) Grant(teamName string) error
- func (si *ServiceInstance) Info(requestID string) (map[string]string, error)
- func (si *ServiceInstance) Revoke(teamName string) error
- func (si *ServiceInstance) Status(requestID string) (string, error)
- func (si *ServiceInstance) ToInfo() (ServiceInstanceWithInfo, error)
- func (si *ServiceInstance) UnbindApp(unbindArgs UnbindAppArgs) error
- func (si *ServiceInstance) UnbindUnit(app bind.App, unit bind.Unit) error
- func (si *ServiceInstance) Update(service Service, updateData ServiceInstance, evt *event.Event, ...) error
- type ServiceInstanceWithInfo
- type ServiceModel
- type UnbindAppArgs
- type Unit
Constants ¶
This section is empty.
Variables ¶
var ( ErrInstanceAlreadyExistsInAPI = errors.New("instance already exists in the service API") ErrInstanceNotFoundInAPI = errors.New("instance does not exist in the service API") ErrInstanceNotReady = errors.New("instance is not ready yet") )
var ( ErrServiceAlreadyExists = errors.New("Service already exists.") ErrServiceNotFound = errors.New("Service not found.") )
var ( ErrServiceInstanceNotFound = errors.New("service instance not found") ErrInvalidInstanceName = errors.New("invalid service instance name") ErrInstanceNameAlreadyExists = errors.New("instance name already exists.") ErrAccessNotAllowed = errors.New("user does not have access to this service instance") ErrTeamMandatory = errors.New("please specify the team that owns the service instance") ErrAppAlreadyBound = errors.New("app is already bound to this service instance") ErrAppNotBound = errors.New("app is not bound to this service instance") ErrUnitNotBound = errors.New("unit is not bound to this service instance") ErrServiceInstanceBound = errors.New("This service instance is bound to at least one app. Unbind them before removing it") )
var ClientFactory = func(config *osb.ClientConfiguration) (osb.Client, error) { return osb.NewClient(config) }
ClientFactory provides a way to customize the Open Service Broker API client. Should be used in tests to create a fake client.
var ErrInvalidBrokerData = errors.New("Invalid broker data")
Functions ¶
func BrokerService ¶
func BrokerService() (serviceTypes.ServiceBrokerService, error)
func CatalogCacheService ¶
func CatalogCacheService() (service.ServiceBrokerCatalogCacheService, error)
func CreateServiceInstance ¶
func DeleteInstance ¶
func DeleteInstance(si *ServiceInstance, evt *event.Event, requestID string) error
DeleteInstance deletes the service instance from the database.
func Proxy ¶
func Proxy(service *Service, path string, evt *event.Event, requestID string, w http.ResponseWriter, r *http.Request) error
Proxy is a proxy between tsuru and the service. This method allow customized service methods.
func ProxyInstance ¶
func ProxyInstance(instance *ServiceInstance, path string, evt *event.Event, requestID string, w http.ResponseWriter, r *http.Request) error
ProxyInstance is a proxy between tsuru and the service instance. This method allow customized service instance methods.
func RenameServiceTeam ¶
Types ¶
type BindAppParameters ¶
type BindAppParameters map[string]interface{}
type BrokerInstanceBind ¶
type BrokerInstanceData ¶
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 GetServices ¶
type ServiceClient ¶
type ServiceClient interface { Create(instance *ServiceInstance, evt *event.Event, requestID string) error Update(instance *ServiceInstance, evt *event.Event, requestID string) error Destroy(instance *ServiceInstance, evt *event.Event, requestID string) error BindApp(instance *ServiceInstance, app bind.App, params BindAppParameters, evt *event.Event, requestID string) (map[string]string, error) BindUnit(instance *ServiceInstance, app bind.App, unit bind.Unit) error UnbindApp(instance *ServiceInstance, app bind.App, evt *event.Event, requestID string) error UnbindUnit(instance *ServiceInstance, app bind.App, unit bind.Unit) error Status(instance *ServiceInstance, requestID string) (string, error) Info(instance *ServiceInstance, requestID string) ([]map[string]string, error) Plans(requestID string) ([]Plan, error) Proxy(path string, evt *event.Event, requestID string, w http.ResponseWriter, r *http.Request) error }
type ServiceInstance ¶
type ServiceInstance struct { Name string `json:"name"` Id int `json:"id"` ServiceName string `bson:"service_name" json:"service_name"` PlanName string `bson:"plan_name" json:"plan_name"` Apps []string `json:"apps"` BoundUnits []Unit `bson:"bound_units" json:"bound_units"` Teams []string `json:"teams"` TeamOwner string `json:"team_owner"` Description string `json:"description"` Tags []string `json:"tags"` Parameters map[string]interface{} `json:"parameters,omitempty"` // BrokerData stores data used by Instances provisioned by Brokers BrokerData *BrokerInstanceData `json:"broker_data,omitempty" bson:"broker_data"` }
func GetServiceInstance ¶
func GetServiceInstance(serviceName string, instanceName string) (*ServiceInstance, error)
func GetServiceInstancesBoundToApp ¶
func GetServiceInstancesBoundToApp(appName string) ([]ServiceInstance, error)
func GetServiceInstancesByServices ¶
func GetServiceInstancesByServices(services []Service) ([]ServiceInstance, error)
func GetServicesInstancesByTeamsAndNames ¶
func GetServicesInstancesByTeamsAndNames(teams []string, names []string, appName, serviceName string) ([]ServiceInstance, error)
func (*ServiceInstance) BindApp ¶
func (si *ServiceInstance) BindApp(app bind.App, params BindAppParameters, shouldRestart bool, writer io.Writer, evt *event.Event, requestID string) error
BindApp makes the bind between the service instance and an app.
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) Info ¶
func (si *ServiceInstance) Info(requestID string) (map[string]string, error)
func (*ServiceInstance) Revoke ¶
func (si *ServiceInstance) Revoke(teamName string) error
func (*ServiceInstance) Status ¶
func (si *ServiceInstance) Status(requestID string) (string, error)
Status returns the service instance status.
func (*ServiceInstance) ToInfo ¶
func (si *ServiceInstance) ToInfo() (ServiceInstanceWithInfo, error)
ToInfo returns the service instance as a struct compatible with the return of the service info api call.
func (*ServiceInstance) UnbindApp ¶
func (si *ServiceInstance) UnbindApp(unbindArgs UnbindAppArgs) error
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.
func (*ServiceInstance) Update ¶
func (si *ServiceInstance) Update(service Service, updateData ServiceInstance, evt *event.Event, requestID string) error
Update changes informations of the service instance.
type ServiceInstanceWithInfo ¶
type ServiceModel ¶
type ServiceModel struct { Service string `json:"service"` Instances []string `json:"instances"` Plans []string `json:"plans"` ServiceInstances []ServiceInstance `json:"service_instances"` }