package jp.ac.nii.prl.mape.monitoring.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.amazonaws.services.ec2.model.Instance;

import jp.ac.nii.prl.mape.monitoring.model.Model;
import jp.ac.nii.prl.mape.monitoring.service.EC2Service;

@RestController
@RequestMapping("/monitor")
@Component
public class MonitoringController {

	@Autowired
	private EC2Service ec2Service;
	
	@RequestMapping(method=RequestMethod.GET)
	public List<Instance> monitor() {
		System.out.println("Here");
		return ec2Service.getInstances();
	}
}

@@ -418,16 +418,71 @@
 nstance;
+%0Aimport com.amazonaws.services.ec2.model.SecurityGroup;
 %0A%0Aimport
@@ -581,16 +581,75 @@
 Service;
+%0Aimport jp.ac.nii.prl.mape.monitoring.service.ModelService;
 %0A%0A@RestC
@@ -786,147 +786,525 @@
 %09%0A%09@
-RequestMapping(method=RequestMethod.GET)%0A%09public List%3CInstance%3E monitor() %7B%0A%09%09System.out.println(%22Here%22);%0A%09%09return ec2Service.getInstances(
+Autowired%0A%09private ModelService modelService;%0A%09%0A%09@RequestMapping(value=%22/instances%22, method=RequestMethod.GET)%0A%09public List%3CInstance%3E getInstances() %7B%0A%09%09return ec2Service.getInstances();%0A%09%7D%0A%09%0A%09@RequestMapping(value=%22/securityGroups%22, method=RequestMethod.GET)%0A%09public List%3CSecurityGroup%3E getSecurityGroups() %7B%0A%09%09return ec2Service.getSecurityGroups();%0A%09%7D%0A%09%0A%09@RequestMapping(method=RequestMethod.GET)%0A%09public Model getModel() %7B%0A%09%09return modelService.createModel(ec2Service.getInstances(), ec2Service.getSecurityGroups()
 );%0A%09

Create Model with instances and securityGroups