sync edge api
This commit is contained in:
		
							parent
							
								
									02585823fc
								
							
						
					
					
						commit
						93363f81bb
					
				@ -104,6 +104,7 @@ import org.thingsboard.server.queue.provider.TbQueueProducerProvider;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
import org.thingsboard.server.service.component.ComponentDiscoveryService;
 | 
			
		||||
import org.thingsboard.server.service.edge.EdgeNotificationService;
 | 
			
		||||
import org.thingsboard.server.service.edge.rpc.init.SyncEdgeService;
 | 
			
		||||
import org.thingsboard.server.service.queue.TbClusterService;
 | 
			
		||||
import org.thingsboard.server.service.security.model.SecurityUser;
 | 
			
		||||
import org.thingsboard.server.service.security.permission.AccessControlService;
 | 
			
		||||
@ -202,12 +203,15 @@ public abstract class BaseController {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    protected TbQueueProducerProvider producerProvider;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    @Autowired(required = false)
 | 
			
		||||
    protected EdgeService edgeService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    @Autowired(required = false)
 | 
			
		||||
    protected EdgeNotificationService edgeNotificationService;
 | 
			
		||||
 | 
			
		||||
    @Autowired(required = false)
 | 
			
		||||
    protected SyncEdgeService syncEdgeService;
 | 
			
		||||
 | 
			
		||||
    @Value("${server.log_controller_error_stack_trace}")
 | 
			
		||||
    @Getter
 | 
			
		||||
    private boolean logControllerErrorStackTrace;
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.ResponseStatus;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
import org.thingsboard.server.common.data.AdminSettings;
 | 
			
		||||
import org.thingsboard.server.common.data.Customer;
 | 
			
		||||
import org.thingsboard.server.common.data.EntitySubtype;
 | 
			
		||||
import org.thingsboard.server.common.data.EntityType;
 | 
			
		||||
@ -409,6 +410,18 @@ public class EdgeController extends BaseController {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PreAuthorize("hasAuthority('TENANT_ADMIN')")
 | 
			
		||||
    @RequestMapping(value = "/edge/sync", method = RequestMethod.POST)
 | 
			
		||||
    public void syncEdge(@RequestBody EdgeId edgeId) throws ThingsboardException {
 | 
			
		||||
        try {
 | 
			
		||||
            edgeId = checkNotNull(edgeId);
 | 
			
		||||
            Edge edge = checkEdgeId(edgeId, Operation.READ);
 | 
			
		||||
            syncEdgeService.sync(edge);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            throw handleException(e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping(value = "/license/checkInstance", method = RequestMethod.POST)
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public Object checkInstance(@RequestBody Object request) throws ThingsboardException {
 | 
			
		||||
 | 
			
		||||
@ -2372,6 +2372,10 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable {
 | 
			
		||||
                params).getBody();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void syncEdge(EdgeId edgeId) {
 | 
			
		||||
        restTemplate.postForEntity(baseURL + "/api/edge/sync", edgeId, EdgeId.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    public Optional<JsonNode> getAttributes(String accessToken, String clientKeys, String sharedKeys) {
 | 
			
		||||
        Map<String, String> params = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user