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

import com.bocloud.cmp.model.ClusterOperateModel;
import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.interfaces.h3c.H3cClusterService;
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.*;

@Api(value = "h3c集群", tags = "h3c集群")
@RestController
@RequestMapping("/v1/h3c/clusters")
public class H3cClusterController {

    @Autowired
    private H3cClusterService h3cClusterService;

    /**
     * 创建集群
     *
     * @param cluster
     * @param context
     * @return
     */
    @ApiOperation(tags={"CMC","CSC"},value = "创建主机池",  httpMethod = "POST")
    @Log(module = BoCloudService.IMS, target = "h3c集群", operation = "创建集群")
    @PostMapping
    public BocloudResult create(@RequestBody ClusterOperateModel cluster,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return h3cClusterService.create(cluster, context);
    }

    /**
     * 删除集群
     *
     * @param id
     * @return
     */
    @ApiOperation(tags={"CMC","CSC"},value = "删除集群",  httpMethod = "DELETE")
    @Log(module = BoCloudService.IMS, target = "h3c集群", operation = "删除集群")
    @DeleteMapping("/{id}")
    public BocloudResult remove(@PathVariable(Common.ID) Long id, @Value(Common.REQ_CONTEXT) RequestContext context) {
        return h3cClusterService.remove(id, context);
    }

}
