;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- (declaim (optimize (speed 0) (safety 3) (debug 3))) (in-package :snow) (defclass tfcloud-apply-service (rest-service) () (:documentation "")) (defun tfcloud-apply-json () (with-noauth (instance tfcloud-apply-service) t)) (defclass tfcloud-apply/view-service (tfcloud-apply-service) ((form :initarg :form :initform nil :accessor form) (location-p :initform nil)) (:documentation "")) (defun tfcloud-apply-view-json () (with-noauth (instance tfcloud-apply/view-service) (setf (form instance) (make-form "tfcloud-apply-form" nil t `((:name "filter" :label "Filter" :field-type "text" :required "required" :value ,(or (session-value :tfcloud-apply-filter) "")) (:label "Find Matching Workspaces" :field-type "button" :onclick "on_tfcloud_apply_results_clicked()")))))) (defclass tfcloud-apply/results-service (tfcloud-apply/view-service) ((results :initarg :results :initform nil :accessor results) (location-p :initform nil)) (:documentation "")) (defun tfcloud-apply-results-json (filter) (with-noauth (instance tfcloud-apply/results-service) (with-tfcloud (tfcloud) (let ((workspaces (get-tfcloud-workspaces tfcloud filter))) (setf (results instance) (mapcar (lambda (workspace) (sanitize-json workspace)) workspaces)) (setf (session-value :tfcloud-apply-filter) filter) (setf (session-value :tfcloud-apply-workspaces) workspaces) (setf (form instance) (make-form "tfcloud-apply-submit-form" nil t `((:label "Apply Workspaces" :field-type "button" :onclick "on_tfcloud_apply_results_submit_clicked()")))))))) (defclass tfcloud-apply/results-submit-service (tfcloud-apply-service) ((location-p :initform nil)) (:documentation "")) (defun tfcloud-apply-results-submit-json () (with-noauth (instance tfcloud-apply/results-submit-service) (loop for workspace in (session-value :tfcloud-apply-workspaces) do (apply-tfcloud-workspace workspace))))