179 lines
5.5 KiB
C#
179 lines
5.5 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();
|
|
|
|
try
|
|
{
|
|
Ret.MailMirrorOK = RfMail.MailIsMirroringProperly();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"Mail mirror: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.AyaNovaWebsiteOK = OpsDiagnostics.CheckWebsite("https://www.ayanova.com/", "Ground Zero Tech-Works Inc.");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"AyaNova website: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.APIWebsiteOK = OpsDiagnostics.CheckWebsite("https://api.ayanova.com/", "WorkorderTypes Enumeration");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"API website: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.ContactFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/contact", "Contact.Email");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"Contact form website: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.RequestFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/request", "Contact.Email");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"Request website: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.RequestLiteFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/requestlite", "Contact.Email");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"RequestLite website: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.SubversionOK = OpsDiagnostics.CheckWebsite("http://svn.helloayanova.com:3343/csvn/login/auth", "Subversion Edge");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"Subversion server: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.ForumOK = OpsDiagnostics.CheckWebsite("http://forum.ayanova.com/", "AyaNova support resources");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"Forum: {ex.Message}\r\n";
|
|
}
|
|
|
|
try
|
|
{
|
|
Ret.DevOpsOK = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Ret.OpsCheckMessage += $"DevOps: {ex.Message}\r\n";
|
|
}
|
|
|
|
|
|
|
|
//PING?
|
|
//Can ping Spaces and all the servers we have, maybe do that first then proceed
|
|
//https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-ping-a-host
|
|
//using System.Net.NetworkInformation;
|
|
|
|
//AyaNova website: https://www.ayanova.com/
|
|
//API website: https://api.ayanova.com/
|
|
//Contact form: https://contact.ayanova.com/contact
|
|
//Request form: https://contact.ayanova.com/request
|
|
//Request lite form: https://contact.ayanova.com/requestlite
|
|
//subversion admin: http://svn.helloayanova.com:3343/csvn/login/auth
|
|
//Forum: http://forum.ayanova.com/
|
|
//devops: https://test.helloayanova.com/api/v8/
|
|
//Spaces and backup: https://gztw1.nyc3.digitaloceanspaces.com/
|
|
//Need S3 library for c#
|
|
/*
|
|
IAmazonS3 amazonS3Client =
|
|
AWSClientFactory.CreateAmazonS3Client("your-spaces-key", "your-spaces-key-secrete",
|
|
new AmazonS3Config
|
|
{
|
|
ServiceURL = "https://nyc3.digitaloceanspaces.com"
|
|
}
|
|
);
|
|
var myBuckets = amazonS3Client.ListBuckets();
|
|
*/
|
|
|
|
|
|
return Ret;
|
|
}
|
|
|
|
public class dtoOpsStatus
|
|
{
|
|
public bool MailMirrorOK;
|
|
public bool ForumOK;
|
|
public bool AyaNovaWebsiteOK;
|
|
public bool APIWebsiteOK;
|
|
public bool ContactFormOK;
|
|
public bool RequestFormOK;
|
|
public bool RequestLiteFormOK;
|
|
public bool SubversionOK;
|
|
public bool DevOpsOK;
|
|
public bool BackupOK;
|
|
public string OpsCheckMessage;
|
|
|
|
public dtoOpsStatus()
|
|
{
|
|
MailMirrorOK = false;
|
|
ForumOK = false;
|
|
AyaNovaWebsiteOK = false;
|
|
APIWebsiteOK = false;
|
|
ContactFormOK = false;
|
|
RequestFormOK = false;
|
|
RequestLiteFormOK = false;
|
|
SubversionOK = false;
|
|
DevOpsOK = false;
|
|
BackupOK = false;
|
|
OpsCheckMessage = string.Empty;
|
|
}
|
|
}
|
|
|
|
|
|
}//eoc
|
|
}//eons |