summaryrefslogtreecommitdiff
path: root/lisp/service/unhealthy-targetgroups-service.lisp
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2025-12-18 15:03:55 -0700
committerckonstanski <carlos.konstanski@olo.com>2025-12-18 15:03:55 -0700
commit116554ad7fe82bf7df08be4ee8732e306eac38f1 (patch)
tree773fc30be41d96badcaecfe6cff999f611014207 /lisp/service/unhealthy-targetgroups-service.lisp
parente7268f15f90251933edb07df2366bc40e1bc1fb5 (diff)
[INF-18465] Create an unhealthy targetgroup report
Diffstat (limited to 'lisp/service/unhealthy-targetgroups-service.lisp')
-rw-r--r--lisp/service/unhealthy-targetgroups-service.lisp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lisp/service/unhealthy-targetgroups-service.lisp b/lisp/service/unhealthy-targetgroups-service.lisp
new file mode 100644
index 0000000..578fe9c
--- /dev/null
+++ b/lisp/service/unhealthy-targetgroups-service.lisp
@@ -0,0 +1,50 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package :snow)
+
+(defclass unhealthy-targetgroups-service (rest-service)
+ ()
+ (:documentation ""))
+
+(defun unhealthy-targetgroups-json ()
+ (with-noauth (instance unhealthy-targetgroups-service)
+ t))
+
+(defclass unhealthy-targetgroups/view-service (unhealthy-targetgroups-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defun unhealthy-targetgroups-view-json ()
+ (with-noauth (instance unhealthy-targetgroups/view-service)
+ (setf (form instance)
+ (make-form "unhealthy-targetgroups-form"
+ nil
+ t
+ `((:name "profile" :label "Profile" :field-type "text" :required "required" :value ,(or (session-value :profile) ""))
+ (:name "region" :label "Region" :field-type "text" :required "required" :value ,(or (session-value :region) (region *webapp*)))
+ (:name "filter" :label "Filter" :field-type "text" :required "required" :value ,(or (session-value :unhealthy-targetgroup-filter) ""))
+ (:label "Find Unhealthy Targetgroups" :field-type "button" :onclick "on_unhealthy_targetgroups_results_clicked()"))))))
+
+(defclass unhealthy-targetgroups/results-service (unhealthy-targetgroups/view-service)
+ ((stdout :initarg :stdout
+ :initform nil
+ :accessor stdout)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defun unhealthy-targetgroups-results-json (profile region filter)
+ (with-noauth (instance unhealthy-targetgroups/results-service)
+ (cl-fad:with-output-to-temporary-file (f :template "/tmp/snow/temp-%")
+ (get-aws-unhealthy-targetgroups (make-instance 'aws-targetgroup
+ :profile profile
+ :region region
+ :filter filter
+ :stdout (pathname f)))
+ (setf (stdout instance) (uiop:native-namestring (pathname f))))
+ (setf (session-value :profile) profile)
+ (setf (session-value :region) region)
+ (setf (session-value :unhealthy-targetgroup-filter) filter)))