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

import com.alibaba.fastjson.JSON;
import com.bocloud.cmp.model.powervc.PowervcViosGroupModel;
import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.interfaces.resource.powervc.ViosGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * powervc中的存储器链接组
 */
@RestController
@Api(value = "Powervc存储器连接组", tags = "Powervc存储器连接组")
public class ViosGroupController {

    private final ViosGroupService viosGroupService;

    @Autowired
    public ViosGroupController(ViosGroupService viosGroupService) {
        this.viosGroupService = viosGroupService;
    }

    @Log(module = BoCloudService.IMS, target = "Powervc存储器连接组", operation = "查询")
    @RequestMapping(value = "/v1/powervc/viosgroups", method = {RequestMethod.GET})
    @ApiOperation(tags={"CMC","CSC"},value = "查询",  httpMethod = "GET")
    public BocloudResult<List<PowervcViosGroupModel>> list(@RequestParam(value = Common.PARAMS, required = false) String params) {
        return viosGroupService.list(JSON.parseObject(params).getLongValue("vendorId"));
    }
}
