func machinesList(w http.ResponseWriter, r *http.Request, token auth.Token) error {
	machines, err := iaas.ListMachines()
	if err != nil {
		return err
	}
	contexts := permission.ContextsForPermission(token, permission.PermMachineRead)
	allowedIaaS := map[string]struct{}{}
	for _, c := range contexts {
		if c.CtxType == permTypes.CtxGlobal {
			allowedIaaS = nil
			break
		}
		if c.CtxType == permTypes.CtxIaaS {
			allowedIaaS[c.Value] = struct{}{}
		}
	}
	for i := 0; allowedIaaS != nil && i < len(machines); i++ {
		if _, ok := allowedIaaS[machines[i].Iaas]; !ok {
			machines = append(machines[:i], machines[i+1:]...)
			i--
		}
	}
	w.Header().Add("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(machines)
}
func machinesList(w http.ResponseWriter, r *http.Request, token auth.Token) error {
	machines, err := iaas.ListMachines()
	if err != nil {
		return err
	}
	contexts := permission.ContextsForPermission(token, permission.PermMachineRead)
	allowedIaaS := map[string]struct{}{}
	for _, c := range contexts {
		if c.CtxType == permTypes.CtxGlobal {
			allowedIaaS = nil
			break
		}
		if c.CtxType == permTypes.CtxIaaS {
			allowedIaaS[c.Value] = struct{}{}
		}
	}
	for i := 0; allowedIaaS != nil && i < len(machines); i++ {
		if _, ok := allowedIaaS[machines[i].Iaas]; !ok {
			machines = append(machines[:i], machines[i+1:]...)
			i--
		}
	}
	w.Header().Add("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(machines)
}
func machinesList ( w http . ResponseWriter , r * http . Request , token auth . Token ) error { machines , err := iaas . ListMachines ( ) if err != nil { return err } contexts := permission . ContextsForPermission ( token , permission . PermMachineRead ) allowedIaaS := map [ string ] struct { } { } for _ , c := range contexts { if c . CtxType == permTypes . CtxGlobal { allowedIaaS = nil break } if c . CtxType == permTypes . CtxIaaS { allowedIaaS [ c . Value ] = struct { } { } } } for i := 0 ; allowedIaaS != nil && i < len ( machines ) ; i ++ { if _ , ok := allowedIaaS [ machines [ i ] . Iaas ] ; ! ok { machines = append ( machines [ : i ] , machines [ i + 1 : ] ... ) i -- } } w . Header ( ) . Add ( " " , " " ) return json . NewEncoder ( w ) . Encode ( machines ) }
// title: machine list
// path: /iaas/machines
// method: GET
// produce: application/json
// responses:
//   200: OK
//   401: Unauthorized
title : machine list path : / iaas / machines method : GET produce : application / json responses : 200 : OK 401 : Unauthorized