// FindAppGroupForService handles GET /apps-groups/search/<service_id> api endpoint. Finds the group for the given service id
FindAppGroupForService handles GET /apps-groups/search/ api endpoint. Finds the group for the given service id
// FindAppGroupForService handles GET / apps - groups / search / <service_id > api endpoint . Finds the group for the given service id
func FindAppGroupForService(c *routing.Context) error {
	serviceID := c.Param("service_id")
	if !bson.IsObjectIdHex(string(serviceID)) {
		return http.Error(c, "Service id not valid.", 400, ServiceDiscoveryServiceName())
	}
	appGroupService, err := getAppGroupService(c)
	if err != nil {
		return http.Error(c, err.Error(), 400, ServiceDiscoveryServiceName())
	}
	appGroup := appGroupService.FindServiceApplicationGroup(serviceID)
	if appGroup.Name == "" {
		return http.Error(c, "Service is not associated to an application group.", 400, ServiceDiscoveryServiceName())
	}
	jsonAppGroup, _ := json.Marshal(appGroup)
	return http.Ok(c, string(jsonAppGroup), ServiceDiscoveryServiceName())
}
func FindAppGroupForService ( c * routing . Context ) error { serviceID := c . Param ( " " ) if ! bson . IsObjectIdHex ( string ( serviceID ) ) { return http . Error ( c , " " , 400 , ServiceDiscoveryServiceName ( ) ) } appGroupService , err := getAppGroupService ( c ) if err != nil { return http . Error ( c , err . Error ( ) , 400 , ServiceDiscoveryServiceName ( ) ) } appGroup := appGroupService . FindServiceApplicationGroup ( serviceID ) if appGroup . Name == " " { return http . Error ( c , " " , 400 , ServiceDiscoveryServiceName ( ) ) } jsonAppGroup , _ := json . Marshal ( appGroup ) return http . Ok ( c , string ( jsonAppGroup ) , ServiceDiscoveryServiceName ( ) ) }
FindAppGroupForService handles GET /apps-groups/search/ api endpoint.
FindAppGroupForService handles GET / apps - groups / search / api endpoint .
// Get application group service // Find application group for service