use of jetbrains.buildServer.federation.ConnectedServers in project teamcity-rest by JetBrains.
the class FederationRequest method addServer.
@PUT
@Path("/servers")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
public FederationServers addServer(FederationServers servers) {
if (servers.servers.stream().map(FederationServer::getUrl).anyMatch(StringUtil::isEmpty)) {
throw new BadRequestException("Server url cannot be empty.");
}
ConnectedServers connectedServers = myServiceLocator.getSingletonService(ConnectedServers.class);
myPermissionChecker.checkGlobalPermission(connectedServers.getRequiredPermissionForSetServers());
connectedServers.setAttachedServer(servers.servers.stream().map(server -> new TeamCityServer(server.getUrl(), server.getName())).collect(toList()));
return servers;
}
Aggregations