Delete appconfig app
This commit is contained in:
parent
788ce9de6d
commit
f0cdca6147
1 changed files with 36 additions and 0 deletions
|
|
@ -89,6 +89,42 @@
|
||||||
(cancel-timer aws-reauth-timer))
|
(cancel-timer aws-reauth-timer))
|
||||||
(setq aws-reauth-timer (run-at-time 0 (* 60 aws-auto-reauth) auth-fn)))))
|
(setq aws-reauth-timer (run-at-time 0 (* 60 aws-auto-reauth) auth-fn)))))
|
||||||
|
|
||||||
|
;; Utility wrappers for the AWS CLI
|
||||||
|
(defun aws-delete-appconfig-app (application-id)
|
||||||
|
"Delete an AWS appconfig app and all dependencies, by its `APPLICATION-ID'."
|
||||||
|
(interactive "sApplication ID: ")
|
||||||
|
(let ((profiles (mapcar
|
||||||
|
(lambda (line)
|
||||||
|
(nth 2 (string-split line)))
|
||||||
|
(remove
|
||||||
|
""
|
||||||
|
(string-split (shell-command-to-string (format "aws appconfig list-configuration-profiles --application-id %s" application-id))
|
||||||
|
"\n"))))
|
||||||
|
(environments (mapcar
|
||||||
|
(lambda (line)
|
||||||
|
(nth 2 (string-split line)))
|
||||||
|
(remove
|
||||||
|
""
|
||||||
|
(string-split (shell-command-to-string (format "aws appconfig list-environments --application-id %s" application-id))
|
||||||
|
"\n"))))
|
||||||
|
(output-buffer (get-buffer-create (format "*aws-delete-app-%s*" application-id))))
|
||||||
|
(dolist (p profiles)
|
||||||
|
(let ((version-max (string-to-number
|
||||||
|
(car (last (string-split (car (string-split
|
||||||
|
(shell-command-to-string (format "aws appconfig list-hosted-configuration-versions --application-id %s --configuration-profile-id %s" application-id p))
|
||||||
|
"\n"))))))))
|
||||||
|
(dolist (v (number-sequence 1 version-max))
|
||||||
|
(shell-command (format "aws appconfig delete-hosted-configuration-version --application-id %s --configuration-profile-id %s --version-number %s" application-id p v)
|
||||||
|
output-buffer))
|
||||||
|
(shell-command (format "aws appconfig delete-configuration-profile --application-id %s --configuration-profile-id %s" application-id p)
|
||||||
|
output-buffer)))
|
||||||
|
(dolist (e environments)
|
||||||
|
(shell-command (format "aws appconfig delete-environment --application-id %s --environment-id %s" application-id e)
|
||||||
|
output-buffer))
|
||||||
|
(shell-command (format "aws appconfig delete-application --application-id %s" application-id)
|
||||||
|
output-buffer)
|
||||||
|
(message (format "Deleted application %s" application-id))))
|
||||||
|
|
||||||
(provide 'aws)
|
(provide 'aws)
|
||||||
|
|
||||||
;;; aws.el ends here
|
;;; aws.el ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue