func servicePlans(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	if s.IsRestricted {
		allowed := permission.Check(t, permission.PermServiceReadPlans,
			contextsForService(&s)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	requestID := requestIDHeader(r)
	plans, err := service.GetPlansByService(s, requestID)
	if err != nil {
		return err
	}
	w.Header().Set("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(plans)
}
func servicePlans(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	if s.IsRestricted {
		allowed := permission.Check(t, permission.PermServiceReadPlans,
			contextsForService(&s)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	requestID := requestIDHeader(r)
	plans, err := service.GetPlansByService(s, requestID)
	if err != nil {
		return err
	}
	w.Header().Set("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(plans)
}
func servicePlans ( w http . ResponseWriter , r * http . Request , t auth . Token ) error { serviceName := r . URL . Query ( ) . Get ( " " ) s , err := getService ( serviceName ) if err != nil { return err } if s . IsRestricted { allowed := permission . Check ( t , permission . PermServiceReadPlans , contextsForService ( & s ) ... , ) if ! allowed { return permission . ErrUnauthorized } } requestID := requestIDHeader ( r ) plans , err := service . GetPlansByService ( s , requestID ) if err != nil { return err } w . Header ( ) . Set ( " " , " " ) return json . NewEncoder ( w ) . Encode ( plans ) }
// title: service plans
// path: /services/{name}/plans
// method: GET
// produce: application/json
// responses:
//   200: OK
//   401: Unauthorized
//   404: Service not found
title : service plans path : / services / { name } / plans method : GET produce : application / json responses : 200 : OK 401 : Unauthorized 404 : Service not found