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

import com.alibaba.fastjson.JSONObject;
import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.utils.ResultTools;
import com.bocloud.ims.interfaces.resource.f5.F5NetworkMapService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by liuyuanyuan on 2019/5/6 15:17
 */
@Api(value = "NetworkMap", tags = "NetworkMap")
@RestController
@RequestMapping("/v1/f5/summary")
public class F5NetworkMapController {

    @Autowired
    private F5NetworkMapService f5NetworkMapService;

    /**
     * 获取f5展示列表
     *
     * @param vendorId
     * @param filter
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "获取f5展示列表", httpMethod = "GET")
    @GetMapping
    public BocloudResult<Map<String, Object>> list(@RequestParam(value = "vendorId") Long vendorId,
                                                   @RequestParam(value = "filter", required = false) String filter) {
        if (null != vendorId) {
            JSONObject filterData = JSONObject.parseObject(filter);
            return f5NetworkMapService.list(vendorId, filterData);
        } else {
            return ResultTools.formatErrResult();
        }
    }
}
