func serviceBrokerUpdate(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	if !permission.Check(t, permission.PermServiceBrokerUpdate) {
		return permission.ErrUnauthorized
	}
	brokerName := r.URL.Query().Get(":broker")
	if brokerName == "" {
		return &errors.HTTP{Code: http.StatusBadRequest, Message: "Empty broker name."}
	}
	broker, err := decodeServiceBroker(r)
	if err != nil {
		return &errors.HTTP{Code: http.StatusBadRequest, Message: err.Error()}
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypeServiceBroker, Value: broker.Name},
		Kind:       permission.PermServiceBrokerUpdate,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermServiceBrokerReadEvents),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	if err = servicemanager.ServiceBroker.Update(brokerName, *broker); err == service.ErrServiceBrokerNotFound {
		w.WriteHeader(http.StatusNotFound)
	}
	return err
}
func serviceBrokerUpdate(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	if !permission.Check(t, permission.PermServiceBrokerUpdate) {
		return permission.ErrUnauthorized
	}
	brokerName := r.URL.Query().Get(":broker")
	if brokerName == "" {
		return &errors.HTTP{Code: http.StatusBadRequest, Message: "Empty broker name."}
	}
	broker, err := decodeServiceBroker(r)
	if err != nil {
		return &errors.HTTP{Code: http.StatusBadRequest, Message: err.Error()}
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypeServiceBroker, Value: broker.Name},
		Kind:       permission.PermServiceBrokerUpdate,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermServiceBrokerReadEvents),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	if err = servicemanager.ServiceBroker.Update(brokerName, *broker); err == service.ErrServiceBrokerNotFound {
		w.WriteHeader(http.StatusNotFound)
	}
	return err
}
// title: Update service broker
// path: /brokers/{broker}
// method: PUT
// responses:
//   200: Service broker updated
//   401: Unauthorized
//	 404: Not Found