diff options
Diffstat (limited to 'lisp/service/unhealthy-targetgroups-service.lisp')
| -rw-r--r-- | lisp/service/unhealthy-targetgroups-service.lisp | 50 |
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))) |
