Prepare Data History Provider 2.7 integration update
- modularize Citrix and agent integrations and add remote desktop endpoints - extend ticket overview, ticket links, token validation, and staged relation handling - update configuration, licensing, project, signing, and publish artifacts
This commit is contained in:
@@ -84,7 +84,7 @@ namespace FasdWebService.Controllers
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
[Route("api/GetCollectorStatus")]
|
||||
[Route("api/CheckCollectorStatus")]
|
||||
public IHttpActionResult GetCollectorStatus()
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
@@ -95,7 +95,7 @@ namespace FasdWebService.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
var retVal = WebApiApplication.Collector.GetCollectorStatus(requestInfo);
|
||||
var retVal = WebApiApplication.Collector.CheckCollectorStatus(requestInfo);
|
||||
if (retVal != null)
|
||||
return Ok(retVal);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace F4SDwebService.Controllers
|
||||
public async Task<IHttpActionResult> QuickActionRun([FromBody] cF4SDServerQuickActionParameters jsonRequest)
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
var requestInfo = new cF4sdWebRequestInfo(jsonRequest.Action, jsonRequest.ParamaterType);
|
||||
var requestInfo = new cF4sdWebRequestInfo(jsonRequest.Action, jsonRequest.ParameterType);
|
||||
if (cPerformanceLogger.IsActive && requestInfo != null) { cPerformanceLogger.LogPerformanceStart(0, requestInfo.requestName, requestInfo.id, requestInfo.created); }
|
||||
var apiError = 0;
|
||||
|
||||
|
||||
72
F4SDwebService/Controllers/RemoteDesktopController.cs
Normal file
72
F4SDwebService/Controllers/RemoteDesktopController.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using C4IT.DataHistoryProvider.Base.DataSources;
|
||||
using C4IT.DataHistoryProvider.Base.Modules.Agent;
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.FASD.Communication.Agent;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace F4SDwebService.Controllers
|
||||
{
|
||||
public class RemoteDesktopController : ApiController
|
||||
{
|
||||
private readonly IRemoteDesktopManager<AgentRemoteConnectionInfo, AgentRemoteClientInfo, AgentRemoteConnectionStatusDto> _remoteDesktopManager;
|
||||
|
||||
public RemoteDesktopController()
|
||||
{
|
||||
var agentConfig = WebApiApplication.Collector.F4sdAgent.GetAgentApiConfiguration(true);
|
||||
_remoteDesktopManager = new AgentRemoteDesktopManager(agentConfig);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/RemoteDesktop/Initiate")]
|
||||
public async Task<IHttpActionResult> Initiate([FromBody] AgentRemoteClientInfo clientInfo, [FromUri] bool isElevated, CancellationToken token = default)
|
||||
{
|
||||
AgentRemoteConnectionInfo connection = await _remoteDesktopManager.InitiateConnectionOfClient(clientInfo, isElevated, token);
|
||||
|
||||
if (connection is null)
|
||||
return NotFound();
|
||||
else if (connection.Errors is null)
|
||||
return Ok(connection);
|
||||
else
|
||||
return Content(System.Net.HttpStatusCode.BadRequest, connection);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("api/RemoteDesktop/{connectionId}/Status")]
|
||||
public async Task<IHttpActionResult> GetStatus(Guid connectionId)
|
||||
{
|
||||
AgentRemoteConnectionStatusDto status = await _remoteDesktopManager.GetConnectionStatus(connectionId);
|
||||
|
||||
if (status is null)
|
||||
return NotFound();
|
||||
|
||||
return Ok(status);
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Route("api/RemoteDesktop/{connectionId}/Stop")]
|
||||
public async Task<IHttpActionResult> Stop(Guid connectionId)
|
||||
{
|
||||
await _remoteDesktopManager.TerminateConnection(connectionId);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("api/RemoteDesktop/IsActive")]
|
||||
public IHttpActionResult IsActive()
|
||||
{
|
||||
bool isActive = _remoteDesktopManager.IsActive();
|
||||
return Ok(isActive);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("api/RemoteDesktop/health")]
|
||||
public async Task<IHttpActionResult> GetHealth()
|
||||
{
|
||||
HealthInformation healthInfo = await _remoteDesktopManager.GetHealthInfo();
|
||||
return Ok(healthInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,52 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT_DataHistoryProvider_Base.DataSources;
|
||||
using C4IT_DataHistoryProvider_Base.Services;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
using C4IT_DataHistoryProvider_Base.DataSources;
|
||||
using C4IT_DataHistoryProvider_Base.Services;
|
||||
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace F4SDwebService.Controllers
|
||||
{
|
||||
public class StagedSearchRelationController : ApiController
|
||||
{
|
||||
private readonly IStagedRelationService _relationService;
|
||||
private IStagedRelationService _relationService = null;
|
||||
|
||||
public StagedSearchRelationController()
|
||||
{
|
||||
_relationService = WebApiApplication.Collector.GetStagedRelationService();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool checkRelationService()
|
||||
{
|
||||
if (_relationService == null && WebApiApplication.Collector != null)
|
||||
_relationService = WebApiApplication.Collector.GetStagedRelationService();
|
||||
|
||||
return (_relationService != null);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/StagedSearchRelations")]
|
||||
public IHttpActionResult StartGatheringRelatedInformationObjects([FromBody] IEnumerable<cFasdApiSearchResultEntry> relatedTo, [FromUri] int age)
|
||||
public async Task<IHttpActionResult> StartGatheringRelatedInformationObjects([FromBody] IEnumerable<cFasdApiSearchResultEntry> relatedTo, [FromUri] int age)
|
||||
{
|
||||
MethodBase CM = null; if (DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
try
|
||||
{
|
||||
cF4sdStagedSearchResultRelationTaskId taskId = _relationService.StartGatheringRelatedObjects(relatedTo, age);
|
||||
if (!checkRelationService())
|
||||
return NotFound();
|
||||
|
||||
cF4sdStagedSearchResultRelationTaskId taskId = await _relationService.StartGatheringRelatedObjects(relatedTo, age);
|
||||
if (taskId.Id == Guid.Empty)
|
||||
return BadRequest();
|
||||
|
||||
@@ -54,6 +69,9 @@ namespace F4SDwebService.Controllers
|
||||
MethodBase CM = null; if (DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
try
|
||||
{
|
||||
if (!checkRelationService())
|
||||
return NotFound();
|
||||
|
||||
return Ok(await _relationService.GetRelatedObjectsAsync(id, token));
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -72,6 +90,9 @@ namespace F4SDwebService.Controllers
|
||||
MethodBase CM = null; if (DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
try
|
||||
{
|
||||
if (!checkRelationService())
|
||||
return NotFound();
|
||||
|
||||
_relationService.StopGatheringRelatedObjects(id);
|
||||
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Accepted);
|
||||
return new ResponseMessageResult(response);
|
||||
|
||||
Reference in New Issue
Block a user