New Paste

 

Administrate




Pastebin on unaen.org

PasteID: 1ym
Pasted by copec, 2021-04-26 17:50:57 GMT
Expires Never
Paste size 1.96 Kb
Tools Raw   Download
 
  1. (defclass uri ()  
  2.   ((scheme      :initarg :scheme      :accessor scheme      :initform nil)  
  3.    (userinfo    :initarg :userinfo    :accessor userinfo    :initform nil)  
  4.    (host        :initarg :host        :accessor host        :initform nil)  
  5.    (port        :initarg :port        :accessor port        :initform nil)  
  6.    (path        :initarg :path        :accessor path        :initform nil)  
  7.    (query       :initarg :query       :accessor query       :initform nil)  
  8.    (fragment    :initarg :fragment    :accessor fragment    :initform nil)))  
  9.   
  10. (defparameter *plesk-xml-uri-defaults*  
  11.   (make-instance 'uri  
  12. 		 :scheme "https"  
  13. 		 :port   "8443"  
  14. 		 :path   "enterprise/control/agent.php"))  
  15.   
  16. (defmethod uri->string ((uri uri) &rest uri-keys)  
  17.   "https://en.wikipedia.org/wiki/Uniform_Resource_Identifier"  
  18.   (let* ((scheme   (or (getf uri-keys :scheme)   (scheme uri)))  
  19. 	 (userinfo (or (getf uri-keys :userinfo) (userinfo uri)))  
  20. 	 (host     (or (getf uri-keys :host)     (host uri)))  
  21. 	 (port     (or (getf uri-keys :port)     (port uri)))  
  22. 	 (path     (or (getf uri-keys :path)     (path uri)))  
  23. 	 (query    (or (getf uri-keys :query)    (query uri)))  
  24. 	 (fragment (or (getf uri-keys :fragment) (fragment uri)))  
  25. 	 (authority (concatenate 'string  
  26. 				 userinfo  
  27. 				 (when userinfo  
  28. 				   "@")  
  29. 				 host  
  30. 				 (when port  
  31. 				   ":")  
  32. 				 port)))   
  33.     (concatenate 'string  
  34. 		 scheme  
  35. 		 ":"  
  36. 		 (when authority  
  37. 		   "//")  
  38. 		 authority  
  39. 		 (when path  
  40. 		   "/")  
  41. 		 path  
  42. 		 (when query  
  43. 		   "?")  
  44. 		 query  
  45. 		 (when fragment  
  46. 		   "#")  
  47. 		 fragment)))  
  48. 	        
  49. (defun get-all-dns-plesk (server-name servers-config)  
  50.   (let ((server-config (gethash server-name servers-config)))  
  51.     (when server-config  
  52.       (with-accessors ((ip ip) (api-key api-key)) server-config  
  53. 	  (drakma:http-request (uri->string *plesk-xml-uri-defaults* :host ip)  
  54. 			       :method :post  
  55. 			       :additional-headers (list (cons "KEY" api-key))  
  56. 			       :content *get-all-dns-plesk-xml-packet*)))))  
  57.  
 
 
 
 
Written by Xan Manning, 2010.