git.fiddlerwoaroof.com
Browse code

Miscellaneous tweaks

Ed Langley authored on 31/10/2018 20:53:41
Showing 4 changed files
... ...
@@ -88,6 +88,7 @@
88 88
    (%rollback-configuration :initarg :rollback-configuration :reader rollback-configuration)
89 89
    (%drift-information :initarg :drift-information :reader drift-information)
90 90
    (%enable-termination-protection :initarg :enable-termination-protection :reader enable-termination-protection)
91
+   (%template-description :initarg :template-description :reader template-description)
91 92
    (%parameters :initarg :parameters :reader parameters :initform (list))))
92 93
 
93 94
 (defclass timeline ()
... ...
@@ -137,8 +138,24 @@
137 138
                                  (:rollback-configuration . car)
138 139
                                  (:drift-information . car)
139 140
                                  (:enable-termination-protection . car)
141
+                                 (:template-description . car)
140 142
                                  (:parameters . extract-list)))))))
141 143
 
144
+(defparameter *stack-statuses*
145
+  '("CREATE_COMPLETE" "CREATE_IN_PROGRESS" "CREATE_FAILED"
146
+    "DELETE_COMPLETE" "DELETE_FAILED" "DELETE_IN_PROGRESS"
147
+    "REVIEW_IN_PROGRESS"
148
+    "ROLLBACK_COMPLETE" "ROLLBACK_FAILED" "ROLLBACK_IN_PROGRESS"
149
+    "UPDATE_COMPLETE" "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" "UPDATE_IN_PROGRESS"
150
+    "UPDATE_ROLLBACK_COMPLETE" "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS" "UPDATE_ROLLBACK_FAILED" "UPDATE_ROLLBACK_IN_PROGRESS"))
151
+
152
+#+nil
153
+(aws-sdk/services/cloudformation:list-stacks 
154
+ :stack-status-filter '("UPDATE_COMPLETE" "UPDATE_IN_PROGRESS"
155
+                        "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" "UPDATE_ROLLBACK_COMPLETE"
156
+                        "UPDATE_ROLLBACK_IN_PROGRESS" "UPDATE_ROLLBACK_FAILED" 
157
+                        "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS" "CREATE_FAILED"
158
+                        "CREATE_COMPLETE" "CREATE_IN_PROGRESS"))
142 159
 
143 160
 (defgeneric initialize-date (value)
144 161
   (:method ((value cons)) (local-time:parse-timestring (car value)))
... ...
@@ -159,3 +176,4 @@
159 176
   (should be equal "outputs" (decamelize "Outputs"))
160 177
   (should be equal "outputs-outputs" (decamelize "OutputsOutputs"))
161 178
   (should be equal "a-b-c" (decamelize "ABC")))
179
+
... ...
@@ -13,6 +13,7 @@
13 13
 (defparameter *cloud-watcher-synopsis*
14 14
   (defsynopsis (:postfix "ARGS...")
15 15
     (group (:header "actions")
16
+           (flag :short-name "s" :long-name "stacks" :description "show stack information")
16 17
            (flag :short-name "p" :long-name "parameters" :description "show stack parameters")
17 18
            (flag :short-name "o" :long-name "outputs" :description "show stack outputs")
18 19
            (flag :short-name "w" :long-name "watch" :description "watch a cloudformation stack until it's done processing")
... ...
@@ -26,6 +27,17 @@
26 27
            (flag :long-name "self-test")
27 28
            (flag :long-name "help"))))
28 29
 
30
+(defun stacks-main ()
31
+  (mapcar (lambda (s)
32
+            (format t "~3&STACK ~a ~a~2%"
33
+                    (cloud-watcher.aws-result:stack-name s)
34
+                    (cloud-watcher.aws-result:stack-status s))
35
+            (stack-info s))
36
+          (mapcar 'cloud-watcher.aws-result:extract-stack
37
+                  (cloud-watcher.aws-result:extract-list
38
+                   (cdar
39
+                    (aws/cloudformation:describe-stacks))))))
40
+
29 41
 (defun stack-parameters-main (name)
30 42
   (stack-parameters (stack-for-name name)))
31 43
 
... ...
@@ -63,6 +75,7 @@
63 75
     (cond ((clon:getopt :long-name "help") (clon:help))
64 76
           ((clon:getopt :long-name "info") (stack-info-main (car files)))
65 77
           ((clon:getopt :long-name "watch") (cloud-watcher.main:watch-stack (car files)))
78
+          ((clon:getopt :long-name "stacks") (stacks-main))
66 79
           ((clon:getopt :long-name "outputs") (stack-outputs-main (car files)))
67 80
           ((clon:getopt :long-name "parameters") (stack-parameters-main (car files)))
68 81
           ((clon:getopt :long-name "self-test") (run-tests))
... ...
@@ -17,8 +17,13 @@
17 17
                  #:local-time
18 18
                  #:local-time-duration
19 19
                  #:aws-sdk/services/cloudformation
20
+                 #:aws-sdk/services/monitoring
20 21
                  #:aws-sdk/services/elasticmapreduce
21
-                 #:should-test)
22
+                 #:should-test
23
+                 #:yason
24
+                 #:hunchentoot
25
+                 #:data-lens
26
+                 )
22 27
     :serial t
23 28
     :components ((:file "aws-result")
24 29
                  (:file "main")
... ...
@@ -26,10 +26,9 @@
26 26
   (let ((key-key (format nil "~aKey" prefix))
27 27
         (value-key (format nil "~aValue" prefix)))
28 28
     (mapcar (lambda (inp)
29
-              (declare (ignore _ __))
30 29
               (let ((k (cadr (assoc key-key inp :test #'equal)))
31 30
                     (v (cadr (assoc value-key inp :test #'equal))))
32
-                (funcall formatter stream k v)))
31
+                (format stream formatter k v)))
33 32
             data)))
34 33
 
35 34
 (defun stack-outputs (the-stack)