// CreateAppGroup handle POST /apps-groups
CreateAppGroup handle POST /apps-groups
// CreateAppGroup handle POST / apps - groups
func CreateAppGroup(c *routing.Context) error {
	var appGroup appgroups.ApplicationGroup
	err := json.Unmarshal(c.Request.Body(), &appGroup)
	if err != nil {
		return http.Error(c, err.Error(), 400, ServiceDiscoveryServiceName())
	}
	if appGroup.Name == "" {
		return http.Error(c, `Invalid body. Missing body parameter`, 400, ServiceDiscoveryServiceName())
	}
	appGroupService, err := getAppGroupService(c)
	if err != nil {
		return http.Error(c, err.Error(), 400, ServiceDiscoveryServiceName())
	}
	err = appGroupService.CreateApplicationGroup(appGroup)
	if err != nil {
		return http.Error(c, strconv.Quote(err.Error()), 400, ServiceDiscoveryServiceName())
	}
	return http.Created(c, `Service created successfuly`, ServiceDiscoveryServiceName())
}
func CreateAppGroup ( c * routing . Context ) error { var appGroup appgroups . ApplicationGroup err := json . Unmarshal ( c . Request . Body ( ) , & appGroup ) if err != nil { return http . Error ( c , err . Error ( ) , 400 , ServiceDiscoveryServiceName ( ) ) } if appGroup . Name == " " { return http . Error ( c , `Invalid body. Missing body parameter` , 400 , ServiceDiscoveryServiceName ( ) ) } appGroupService , err := getAppGroupService ( c ) if err != nil { return http . Error ( c , err . Error ( ) , 400 , ServiceDiscoveryServiceName ( ) ) } err = appGroupService . CreateApplicationGroup ( appGroup ) if err != nil { return http . Error ( c , strconv . Quote ( err . Error ( ) ) , 400 , ServiceDiscoveryServiceName ( ) ) } return http . Created ( c , `Service created successfuly` , ServiceDiscoveryServiceName ( ) ) }
CreateAppGroup handle POST /apps-groups
CreateAppGroup handle POST / apps - groups
// Parse body to object // Validate if name is not empty // Get application group service // Create application group