package com.bocloud.ims.booter.controller.resource.powervc;

import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.GridBean;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.entity.resource.powervc.ValidateResult;
import com.bocloud.ims.interfaces.resource.powervc.ValidateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * powervc中验证环境
 *
 * @author lkx007
 */
@RestController
@RequestMapping("/v1/powervc/vendors")
@Api(value = "Powervc环境验证", tags = "Powervc环境验证")
public class ValidateController {
	@Autowired
	private ValidateService validateService;

	/**
	 * 分页查询
	 * 
	 * @param pager
	 * @param context
	 * @return 数据结果集
	 */
	@Log(module = BoCloudService.IMS, target = "Powervc环境验证", operation = "查询验证结果")
	@RequestMapping(value = "/{id}/status", method = { RequestMethod.GET })
	@ApiOperation(tags={"CMC","CSC"},value = "查询验证结果",  httpMethod = "GET")
	public BocloudResult<GridBean<ValidateResult>> list(Pager pager) {
		return validateService.listResult(pager);
	}

	/**
	 * 验证环境
	 *
	 * @param vendorId
	 *            参数信息
	 * @param context
	 *            操作者信息
	 * @return 空
	 */
	@Log(module = BoCloudService.IMS, target = "Povervc环境", operation = "执行环境验证")
	@RequestMapping(value = "/{id}/status", method = { RequestMethod.PUT })
	@ApiOperation(tags={"CMC","CSC"},value = "执行环境验证",  httpMethod = "PUT")
	public BocloudResult env(@PathVariable(value = Common.ID) long vendorId,
			@Value(Common.REQ_CONTEXT) RequestContext context) {
		return validateService.env(vendorId, context);
	}

}
