package com.bocloud.ims.booter.controller.resource.azure.db;

import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.interfaces.resource.azure.db.CloudDatabaseServerLogService;
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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Company: 博云 www.bocloud.com
 * @ClassName: CloudDatabaseServerLogController
 * @Description:
 * @author: zhenpingLi/李振平
 * @date: 2021/2/4 15:23
 */
@Api(value = "CloudDatabaseServerLog", tags = "CloudDatabaseServerLog管理")
@RestController
@RequestMapping("/v1/cloud/database/server/logs")
public class CloudDatabaseServerLogController {
    @Autowired
    private CloudDatabaseServerLogService service;

    /**
     * 查询列表
     *
     * @param pager
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "列表CloudDatabaseServerLog", httpMethod = "GET")
    @Log(module = BoCloudService.IMS, target = "CloudDatabaseServerLog", operation = "列表CloudDatabaseServerLog")
    @GetMapping
    public BocloudResult list(Pager pager,
                              @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.list(pager, context);
    }

    /**
     * 查询列表
     *
     * @param
     * @return
     */
    @ApiOperation(value = "查询列表", response = BocloudResult.class, httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
    @Log(module = BoCloudService.IMS, target = "CloudDatabaseServerLog", operation = "CloudDatabaseServerLog列表")
    @GetMapping("/dbs/{id}")
    public BocloudResult list(@PathVariable(value = Common.ID) Long id) {
        return service.listApi(id);
    }

}