summaryrefslogtreecommitdiff
path: root/internal/api/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/handlers.go')
-rw-r--r--internal/api/handlers.go81
1 files changed, 81 insertions, 0 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go
index 45354aa..194401d 100644
--- a/internal/api/handlers.go
+++ b/internal/api/handlers.go
@@ -73,6 +73,87 @@ func CreateLoginHandler(logs *[LogLength]string, n *int, logChan chan string) ht
}
}
+func StatusHandler(w http.ResponseWriter, r *http.Request) {
+ type response struct {
+ Status string `json:"status"`
+ Description string `json:"description"`
+ Uptime float64 `json:"uptime"`
+ ResponseTime int `json:"responseTime"`
+ ActiveIncidents int `json:"activeIncidents"`
+ ScheduledMaintenance int `json:"scheduledMaintenance"`
+ }
+}
+
+func StatusServicesHandler(w http.ResponseWriter, r *http.Request) {
+ type service struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Icon string `json:"icon"`
+ Status string `json:"status"`
+ ResponseTime int `json:"responseTime"`
+ Uptime float64 `json:"uptime"`
+ }
+
+ var response []service
+ _ = response
+}
+
+func StatusMetricsHandler(w http.ResponseWriter, r *http.Request) {
+ type response struct {
+ Uptime float64 `json:"uptime"`
+ ResponseTime int `json:"responseTime"`
+ RequestVolume int `json:"requestVolume"`
+ ErrorRate float64 `json:"errorRate"`
+ }
+}
+
+func StatusIncidentsHandler(w http.ResponseWriter, r *http.Request) {
+ type incident struct {
+ Id string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ Severity string `json:"severity"`
+ StartTime time.Time `json:"startTime"`
+ AffectedServices []string `json:"affectedServices"`
+ }
+ var response []incident
+ _ = response
+}
+
+func StatusMaintenanceHandler(w http.ResponseWriter, r *http.Request) {
+ type event struct {
+ Id string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ StartTime time.Time `json:"startTime"`
+ EndTime time.Time `json:"endTime"`
+ AffectedServices []string `json:"affectedServices"`
+ }
+ var response []event
+ _ = response
+}
+
+func StatusUptimeHandler(w http.ResponseWriter, r *http.Request) {
+ type event struct {
+ Date time.Time `json:"date"`
+ Uptime float64 `json:"uptime"`
+ }
+ var response []event
+ _ = response
+}
+
+// TODO: SUBSCRIBE TO EMAILS
+func StatusSubscribeHandler(w http.ResponseWriter, r *http.Request) {
+
+}
+
+// TODO: CONTACT HANDLER
+func ContactHandler(w http.ResponseWriter, r *http.Request) {
+
+}
+
func redactIP(input string) string {
ipRegex := `\b(?:\d{1,3}\.){3}\d{1,3}\b`
re := regexp.MustCompile(ipRegex)