func addTeamToPoolHandler(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	poolName := r.URL.Query().Get(":name")
	allowed := permission.Check(t, permission.PermPoolUpdateTeamAdd, permission.Context(permTypes.CtxPool, poolName))
	if !allowed {
		return permission.ErrUnauthorized
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypePool, Value: poolName},
		Kind:       permission.PermPoolUpdateTeamAdd,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermPoolReadEvents, permission.Context(permTypes.CtxPool, poolName)),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	if teams, ok := InputValues(r, "team"); ok {
		err := pool.AddTeamsToPool(poolName, teams)
		if err == pool.ErrPoolNotFound {
			return &terrors.HTTP{Code: http.StatusNotFound, Message: err.Error()}
		}
		return err
	}
	return &terrors.HTTP{Code: http.StatusBadRequest, Message: "You must provide the team."}
}
func addTeamToPoolHandler(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	poolName := r.URL.Query().Get(":name")
	allowed := permission.Check(t, permission.PermPoolUpdateTeamAdd, permission.Context(permTypes.CtxPool, poolName))
	if !allowed {
		return permission.ErrUnauthorized
	}
	evt, err := event.New(&event.Opts{
		Target:     event.Target{Type: event.TargetTypePool, Value: poolName},
		Kind:       permission.PermPoolUpdateTeamAdd,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermPoolReadEvents, permission.Context(permTypes.CtxPool, poolName)),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	if teams, ok := InputValues(r, "team"); ok {
		err := pool.AddTeamsToPool(poolName, teams)
		if err == pool.ErrPoolNotFound {
			return &terrors.HTTP{Code: http.StatusNotFound, Message: err.Error()}
		}
		return err
	}
	return &terrors.HTTP{Code: http.StatusBadRequest, Message: "You must provide the team."}
}
func addTeamToPoolHandler ( w http . ResponseWriter , r * http . Request , t auth . Token ) ( err error ) { poolName := r . URL . Query ( ) . Get ( " " ) allowed := permission . Check ( t , permission . PermPoolUpdateTeamAdd , permission . Context ( permTypes . CtxPool , poolName ) ) if ! allowed { return permission . ErrUnauthorized } evt , err := event . New ( & event . Opts { Target : event . Target { Type : event . TargetTypePool , Value : poolName } , Kind : permission . PermPoolUpdateTeamAdd , Owner : t , CustomData : event . FormToCustomData ( InputFields ( r ) ) , Allowed : event . Allowed ( permission . PermPoolReadEvents , permission . Context ( permTypes . CtxPool , poolName ) ) , } ) if err != nil { return err } defer func ( ) { evt . Done ( err ) } ( ) if teams , ok := InputValues ( r , " " ) ; ok { err := pool . AddTeamsToPool ( poolName , teams ) if err == pool . ErrPoolNotFound { return & terrors . HTTP { Code : http . StatusNotFound , Message : err . Error ( ) } } return err } return & terrors . HTTP { Code : http . StatusBadRequest , Message : " " } }
// title: add team too pool
// path: /pools/{name}/team
// method: POST
// consume: application/x-www-form-urlencoded
// responses:
//   200: Pool updated
//   401: Unauthorized
//   400: Invalid data
//   404: Pool not found
title : add team too pool path : / pools / { name } / team method : POST consume : application / x - www - form - urlencoded responses : 200 : Pool updated 401 : Unauthorized 400 : Invalid data 404 : Pool not found