summaryrefslogtreecommitdiff
path: root/lisp/service
diff options
context:
space:
mode:
authorCarlos Konstanski <carlos.konstanski@olo.com>2025-12-18 16:01:49 -0700
committerGitHub <noreply@github.com>2025-12-18 16:01:49 -0700
commitb040de7070e9ece5e1ffe73bd7d7ae6c6310cb7c (patch)
treeb7cf7de15b45846506901048f6c4953699bc13c5 /lisp/service
parente7268f15f90251933edb07df2366bc40e1bc1fb5 (diff)
parent16e45f92cc92bc1e61659be66567131de18a9a96 (diff)
Merge pull request #11 from ololabs/inf-18465-create-an-unhealthy-targetgroup-report
[INF-18465] Create an unhealthy targetgroup report
Diffstat (limited to 'lisp/service')
-rw-r--r--lisp/service/menu-service.lisp1
-rw-r--r--lisp/service/octopus-projects-with-roles-service.lisp4
-rw-r--r--lisp/service/unhealthy-targetgroups-service.lisp50
3 files changed, 54 insertions, 1 deletions
diff --git a/lisp/service/menu-service.lisp b/lisp/service/menu-service.lisp
index 7911e32..ba6e934 100644
--- a/lisp/service/menu-service.lisp
+++ b/lisp/service/menu-service.lisp
@@ -6,6 +6,7 @@
(defparameter *menu-config* '((:id "a_menu_home" :label "Home" :handler "/home" :permissions "t")
(:id "a_menu_git_update" :label "Git Update" :handler "/git-update" :permissions "t")
(:id "a_menu_asg_recycle" :label "ASG Recycle" :handler "/asg-recycle" :permissions "t")
+ (:id "a_menu_unhealthy_targetgroups" :label "Unhealthy Targetgroups" :handler "/unhealthy-targetgroups" :permissions "t")
(:id "a_menu_tfcloud_apply" :label "TFCloud Apply" :handler "/tfcloud-apply" :permissions "t")
(:id "a_menu_octopus_machines_with_roles" :label "Octo Machines With Roles" :handler "/octopus-machines-with-roles" :permissions "t")
(:id "a_menu_octopus_environments_with_roles" :label "Octo Envs With Roles" :handler "/octopus-environments-with-roles" :permissions "t")
diff --git a/lisp/service/octopus-projects-with-roles-service.lisp b/lisp/service/octopus-projects-with-roles-service.lisp
index c3d9a67..627f346 100644
--- a/lisp/service/octopus-projects-with-roles-service.lisp
+++ b/lisp/service/octopus-projects-with-roles-service.lisp
@@ -38,7 +38,9 @@
(with-noauth (instance octopus-projects-with-roles/results-service)
(cl-fad:with-output-to-temporary-file (f :template "/tmp/snow/temp-%")
(get-octopus-projects-with-roles (make-instance 'octopus-process-step
- :target-roles (remove-if (lambda (x) (org-ckons-core::null-or-empty-p x)) (cl-ppcre:split "[, ]" roles))
+ :target-roles (remove-if (lambda (x)
+ (org-ckons-core::null-or-empty-p x))
+ (cl-ppcre:split "[, ]" roles))
:stdout (pathname f)))
(setf (stdout instance) (uiop:native-namestring (pathname f))))
(setf (session-value :octopus-roles) roles)))
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)))