165 lines
4.9 KiB
C#
165 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using rockfishCore.Models;
|
|
using rockfishCore.Util;
|
|
|
|
|
|
namespace rockfishCore.Controllers
|
|
{
|
|
[Produces("application/json")]
|
|
[Route("api/ops")]
|
|
[Authorize]
|
|
public class OpsController : Controller
|
|
{
|
|
private readonly rockfishContext _context;
|
|
|
|
public OpsController(rockfishContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
|
|
//status of ops
|
|
[HttpGet("status")]
|
|
public dtoOpsStatus GetOpsStatus()
|
|
{
|
|
dtoOpsStatus Ret = new dtoOpsStatus();
|
|
|
|
//TESTING
|
|
Ret.OpsCheckError="Fake error message\r\nwith more fake text\r\neot";
|
|
Ret.MailMirrorOK=true;
|
|
Ret.ContactFormOK=true;
|
|
|
|
|
|
// try
|
|
// {
|
|
// Ret.MailMirrorOK = RfMail.MailIsMirroringProperly();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Mail mirror: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.AyaNovaSiteOK = OpsDiagnostics.CheckWebsite("https://www.ayanova.com/", "Ground Zero Tech-Works Inc.");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"AyaNova site: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.APISiteOK = OpsDiagnostics.CheckWebsite("https://api.ayanova.com/", "WorkorderTypes Enumeration");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"API site: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.ContactFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/contact", "Contact.Email");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Contact form: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.RequestFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/request", "Contact.Email");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Request form: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.RequestLiteFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/requestlite", "Contact.Email");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"RequestLite form: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.SubversionOK = OpsDiagnostics.CheckWebsite("http://svn.helloayanova.com:3343/csvn/login/auth", "Subversion Edge");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Subversion: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.ForumOK = OpsDiagnostics.CheckWebsite("http://forum.ayanova.com/", "AyaNova support resources");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Forum: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.DevOpsOK = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server");
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"DevOps: {ex.Message}\r\n";
|
|
// }
|
|
|
|
// try
|
|
// {
|
|
// Ret.BackupOK = OpsDiagnostics.VerifyBackups();
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// Ret.OpsCheckError += $"Backup: {ex.Message}\r\n";
|
|
// }
|
|
|
|
return Ret;
|
|
}
|
|
|
|
public class dtoOpsStatus
|
|
{
|
|
public bool MailMirrorOK;
|
|
public bool ForumOK;
|
|
public bool AyaNovaSiteOK;
|
|
public bool APISiteOK;
|
|
public bool ContactFormOK;
|
|
public bool RequestFormOK;
|
|
public bool RequestLiteFormOK;
|
|
public bool SubversionOK;
|
|
public bool DevOpsOK;
|
|
public bool BackupOK;
|
|
public string OpsCheckError;
|
|
|
|
public dtoOpsStatus()
|
|
{
|
|
MailMirrorOK = false;
|
|
ForumOK = false;
|
|
AyaNovaSiteOK = false;
|
|
APISiteOK = false;
|
|
ContactFormOK = false;
|
|
RequestFormOK = false;
|
|
RequestLiteFormOK = false;
|
|
SubversionOK = false;
|
|
DevOpsOK = false;
|
|
BackupOK = false;
|
|
OpsCheckError = string.Empty;
|
|
}
|
|
}
|
|
|
|
|
|
}//eoc
|
|
}//eons |