func nodeContainerUpdate(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	var config nodecontainer.NodeContainerConfig
	err = ParseInput(r, &config)
	if err != nil {
		return err
	}
	poolName := InputValue(r, "pool")
	var ctxs []permTypes.PermissionContext
	if poolName != "" {
		ctxs = append(ctxs, permission.Context(permTypes.CtxPool, poolName))
	}
	if !permission.Check(t, permission.PermNodecontainerUpdate, ctxs...) {
		return permission.ErrUnauthorized
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypeNodeContainer, Value: config.Name},
		Kind:       permission.PermNodecontainerUpdate,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermPoolReadEvents, ctxs...),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	config.Name = r.URL.Query().Get(":name")
	err = nodecontainer.UpdateContainer(poolName, &config)
	if err != nil {
		if err == nodecontainer.ErrNodeContainerNotFound {
			return &tsuruErrors.HTTP{
				Code:    http.StatusNotFound,
				Message: err.Error(),
			}
		}
		if _, ok := err.(nodecontainer.ValidationErr); ok {
			return &tsuruErrors.HTTP{
				Code:    http.StatusBadRequest,
				Message: err.Error(),
			}
		}
		return err
	}
	return nil
}
func nodeContainerUpdate(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	var config nodecontainer.NodeContainerConfig
	err = ParseInput(r, &config)
	if err != nil {
		return err
	}
	poolName := InputValue(r, "pool")
	var ctxs []permTypes.PermissionContext
	if poolName != "" {
		ctxs = append(ctxs, permission.Context(permTypes.CtxPool, poolName))
	}
	if !permission.Check(t, permission.PermNodecontainerUpdate, ctxs...) {
		return permission.ErrUnauthorized
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypeNodeContainer, Value: config.Name},
		Kind:       permission.PermNodecontainerUpdate,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermPoolReadEvents, ctxs...),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	config.Name = r.URL.Query().Get(":name")
	err = nodecontainer.UpdateContainer(poolName, &config)
	if err != nil {
		if err == nodecontainer.ErrNodeContainerNotFound {
			return &tsuruErrors.HTTP{
				Code:    http.StatusNotFound,
				Message: err.Error(),
			}
		}
		if _, ok := err.(nodecontainer.ValidationErr); ok {
			return &tsuruErrors.HTTP{
				Code:    http.StatusBadRequest,
				Message: err.Error(),
			}
		}
		return err
	}
	return nil
}
// title: node container update
// path: /docker/nodecontainers/{name}
// method: POST
// consume: application/x-www-form-urlencoded
// responses:
//   200: Ok
//   400: Invald data
//   401: Unauthorized
//   404: Not found