EbsManagerCtrl.java 2.68 KB
package com.ui.ctrl;

import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.AwsEbsTask;
import com.ui.model.req.NginxSyncTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by yoho on 2016/8/23.
 */
@RestController
@RequestMapping(value = "/aws")
public class EbsManagerCtrl {

    @Autowired
    HttpRestClient httpRestClient;

    @RequestMapping("/toEbsManager")
    public ModelAndView toNginxView() {
        return new ModelAndView("aws/ebsManager");
    }

    @RequestMapping(value = "/volume/check")
    public BaseResponse checkVolume(AwsEbsTask task) {

        BaseResponse response = httpRestClient.defaultPost("/aws/volume/check", task, BaseResponse.class);

        return response;
    }

    @RequestMapping(value = "/task/create")
    public BaseResponse createTask(AwsEbsTask task) {
        BaseResponse response = httpRestClient.defaultPost("/aws/task/create", task, BaseResponse.class);

        return response;
    }

    @RequestMapping(value = "/task/query")
    public BaseResponse modifyTask(AwsEbsTask task) {
        BaseResponse response = httpRestClient.defaultPost("/aws/task/query", task, BaseResponse.class);

        return response;
    }

    @RequestMapping(value = "/task/all")
    public BaseResponse queryAllTask() {
        BaseResponse response = httpRestClient.defaultGet("/aws/task/all", BaseResponse.class);

        return response;
    }

    @RequestMapping(value = "/task/delete")
    public BaseResponse deleteTask(AwsEbsTask task) {
        BaseResponse response = httpRestClient.defaultPost("/aws/task/delete", task, BaseResponse.class);

        return response;
    }


    @RequestMapping(value = "/task/stop")
    public BaseResponse stopTask(AwsEbsTask task) {
        BaseResponse response = httpRestClient.defaultPost("/aws/task/stop", task, BaseResponse.class);

        return response;
    }


    @RequestMapping(value = "/task/start")
    public BaseResponse startTask(AwsEbsTask task) {
        BaseResponse response = httpRestClient.defaultPost("/aws/task/start", task, BaseResponse.class);

        return response;
    }


    @RequestMapping(value = "/snapshot/check")
    public BaseResponse checkSnapShot(@RequestParam String vId) {
        AwsEbsTask task = new AwsEbsTask();

        task.setVolumeId(vId);

        BaseResponse response = httpRestClient.defaultPost("/aws/snapshot/check", task, BaseResponse.class);

        return response;
    }


}