public virtual IActionResult PostEventToEndpointByUid([FromRoute] Guid endpointUid) { if (!EndpointManager.TryGetEndpointByUid(endpointUid, out EndpointInformation endpoint)) { Console.WriteLine($"Received message for unknown Endpoint: {endpointUid}"); // assume this endpoint has been removed return(StatusCode((int)HttpStatusCode.Gone)); } if (endpoint.Enabled == false) { Console.WriteLine($"Received message for DISABLED Endpoint: {endpointUid}, refusing!"); return(StatusCode((int)HttpStatusCode.Forbidden)); } Console.WriteLine($"Received message for Endpoint: {endpointUid}"); using (StreamReader reader = new StreamReader(Request.Body)) { string content = reader.ReadToEndAsync().Result; EndpointManager.QueueMessage(endpointUid, content); } return(StatusCode((int)HttpStatusCode.NoContent)); }
public virtual IActionResult GetEndpointInfoByUid([FromRoute] Guid endpointUid) { if (EndpointManager.TryGetEndpointByUid(endpointUid, out EndpointInformation endpoint)) { return(StatusCode((int)HttpStatusCode.OK, endpoint)); } return(StatusCode((int)HttpStatusCode.NotFound)); }