com.nepxion.discovery.plugin.admincenter.endpoint.InspectorEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-plugin-admin-center-starter-swagger Show documentation
Show all versions of discovery-plugin-admin-center-starter-swagger Show documentation
Nepxion Discovery is a solution for Spring Cloud with blue green, gray, weight, limitation, circuit breaker, degrade, isolation, monitor, tracing, dye, failover, async agent
The newest version!
package com.nepxion.discovery.plugin.admincenter.endpoint;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.nepxion.discovery.common.entity.InspectorEntity;
import com.nepxion.discovery.common.util.ResponseUtil;
import com.nepxion.discovery.plugin.admincenter.resource.InspectorResource;
@RestController
@RequestMapping(path = "/inspector")
@Api(tags = { "侦测接口" })
public class InspectorEndpoint {
@Autowired
private InspectorResource inspectorResource;
@RequestMapping(path = "/inspect", method = RequestMethod.POST)
@ApiOperation(value = "侦测全链路路由", notes = "", response = ResponseEntity.class, httpMethod = "POST")
@ResponseBody
public ResponseEntity> inspect(@RequestBody @ApiParam(value = "侦测对象", required = true) InspectorEntity inspectorEntity) {
return doInspect(inspectorEntity);
}
@RequestMapping(path = "/inspect-service", method = RequestMethod.POST)
@ApiOperation(value = "侦测全链路路由", notes = "", response = ResponseEntity.class, httpMethod = "POST")
@ResponseBody
public ResponseEntity> inspect(@RequestBody @ApiParam(value = "侦测服务列表", required = true) List service) {
return doInspect(service);
}
private ResponseEntity> doInspect(InspectorEntity inspectorEntity) {
try {
InspectorEntity result = inspectorResource.inspect(inspectorEntity);
return ResponseUtil.getSuccessResponse(result);
} catch (Exception e) {
return ResponseUtil.getFailureResponse(e);
}
}
private ResponseEntity> doInspect(List service) {
try {
String result = inspectorResource.inspect(service);
return ResponseUtil.getSuccessResponse(result);
} catch (Exception e) {
return ResponseUtil.getFailureResponse(e);
}
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy