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

import com.bocloud.cmp.params.azure.ResourceCheckNameParams;
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.resource.azure.checkname.ResourceCheckNameService;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Company: 博云 www.bocloud.com
 * @ClassName: ResourceCheckNameController
 * @Description:
 * @author: zhenpingLi/李振平
 * @date: 2021/3/10 11:26
 */
@Api(value = "资源名称校验", tags = "资源名称校验管理")
@RestController
@RequestMapping("/v1/resource/check/names")
public class ResourceCheckNameController {

    @Autowired
    private ResourceCheckNameService service;

    /**
     * 资源名称校验
     *
     * @param params
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "资源名称校验", httpMethod = "POST")
    @Log(module = BoCloudService.IMS, target = "resourceCheckName", operation = "ResourceCheckName校验")
    @PostMapping
    public BocloudResult checkName(@RequestBody ResourceCheckNameParams params,
                                   @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.checkName(params, context);
    }

}