Пример #1
0
func (b *Broker) Deprovision(planId string, serviceInstanceId string) error {
	si, err := serviceinstances.New(serviceInstanceId, b.PlanMgmtDbs[planId])
	if err == nil {
		err = si.Deprovision()
	}
	return err
}
Пример #2
0
func (b *Broker) Provision(planId string, serviceInstanceId string) (*serviceinstances.ServiceInstance, error) {
	si, err := serviceinstances.New(serviceInstanceId, b.PlanMgmtDbs[planId])
	if err == nil {
		err = si.Provision()
	}
	return si, err
}
Пример #3
0
func (b *Broker) Unbind(planId string, serviceBindingId string, serviceInstanceId string) error {
	var sb *servicebindings.ServiceBinding
	var si *serviceinstances.ServiceInstance
	var instanceDb *db.DbConnection
	var err error

	si, err = serviceinstances.New(serviceInstanceId, b.PlanMgmtDbs[planId])
	if err == nil {
		if si.IsProvisioned() {
			instanceDb, err = si.GetInstanceDb()
			if err == nil {
				sb, err = servicebindings.New(serviceBindingId, instanceDb)
				if err == nil {
					err = sb.Unbind()
				}
			}
		} else {
			return errors.New("ERROR:  Trying to unbind from an unprovisioned service.")
		}
	}
	return err
}