Added Joyent Triton as a Docker service provider with driver.

Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e61bad54
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e61bad54
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e61bad54

Branch: refs/heads/trunk
Commit: e61bad54fad40c9c9cf0d3ea334c399f2d028af9
Parents: fe7ba5c
Author: anthony-shaw <anthony.p.s...@gmail.com>
Authored: Wed Dec 23 15:31:42 2015 +1100
Committer: anthony-shaw <anthony.p.s...@gmail.com>
Committed: Wed Dec 23 15:31:42 2015 +1100

----------------------------------------------------------------------
 docs/_static/images/provider_logos/triton.svg   | 107 +++++++++++++++++++
 docs/container/drivers/joyent.rst               |  57 ++++++++++
 .../container/joyent/instantiate_driver.py      |   9 ++
 libcloud/container/drivers/joyent.py            |  72 +++++++++++++
 libcloud/container/providers.py                 |   2 +
 libcloud/container/types.py                     |   1 +
 6 files changed, 248 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/docs/_static/images/provider_logos/triton.svg
----------------------------------------------------------------------
diff --git a/docs/_static/images/provider_logos/triton.svg 
b/docs/_static/images/provider_logos/triton.svg
new file mode 100644
index 0000000..505257e
--- /dev/null
+++ b/docs/_static/images/provider_logos/triton.svg
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 
6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px"
+        width="298.2px" height="62.8px" viewBox="0 0 298.2 62.8" 
enable-background="new 0 0 298.2 62.8" xml:space="preserve">
+<g>
+       <g id="XMLID_35277_">
+               <path id="XMLID_35290_" fill-rule="evenodd" clip-rule="evenodd" 
fill="#3E3E3F" d="M99.1,15.8c0.4,0.3,0.8,0.5,1.3,0.5
+                       
c0.8,0,1-0.5,1-1.2V9.4h0.9v4.7c0,0.4,0,0.9,0,1.3c0,1.1-0.6,1.7-1.9,1.7c-0.9,0-1.5-0.4-1.8-0.6L99.1,15.8z
 M107.7,14.1
+                       
c0-1.4-0.4-2.3-1.5-2.3c-1.1,0-1.6,0.9-1.6,2.1c0,1.1,0.2,2.4,1.5,2.4C107.2,16.4,107.7,15.4,107.7,14.1z
 M106.2,11.1
+                       
c0.8,0,2.3,0.2,2.3,2.8c0,2.2-1.1,3.1-2.5,3.1c-1.4,0-2.3-1-2.3-3C103.7,11.7,105.1,11.1,106.2,11.1
 M114,16.7v-5.4h-0.9v3.4
+                       
c0,0.8-0.5,1.3-1.4,1.3c-1.2,0-1.3-0.7-1.3-1.5v-3.2h-0.9v3.4c0,1.3,0.6,1.8,1.6,1.9c-0.6,0.4-1.2,1-1.2,1.9
+                       
c0,0.9,0.6,1.4,1.7,1.4c1.2,0,1.9-0.6,2.2-1.7C113.9,17.9,114,17.2,114,16.7z 
M111.7,19.3c1,0,1.4-0.9,1.4-2.1v-1
+                       
c-1.4,0.6-2.3,1.2-2.3,2.3C110.8,19,111.1,19.3,111.7,19.3z 
M117.6,11.1c-1.7,0-2.6,1.4-2.6,3.1c0,1.7,0.7,2.9,2.5,2.9
+                       
c0.9,0,1.6-0.4,1.8-0.6l-0.3-0.6c-0.2,0.2-0.7,0.5-1.5,0.5c-1.2,0-1.7-1-1.7-1.9c0.1,0,0.2,0,0.3,0c1.1,0,3.1-0.3,3.1-1.9
+                       C119.3,11.7,118.7,11.1,117.6,11.1z 
M117.6,11.8c-1.2,0-1.7,1.1-1.7,2c0.1,0,0.1,0,0.2,0c0.8,0,2.4-0.2,2.4-1.2
+                       C118.5,12.1,118.1,11.8,117.6,11.8z 
M121.3,16.9v-3.7c0-0.7,0.7-1.4,1.5-1.4c1,0,1.1,0.7,1.1,1.5v3.6h0.9v-3.8
+                       
c0-1.3-0.6-1.9-1.8-1.9c-0.7,0-1.4,0.3-1.8,1l-0.1-0.8h-0.8l0.1,0.9v4.8H121.3z 
M126.2,9v6.3c0,0.8,0,1.7,1.6,1.7
+                       
c0.5,0,1-0.1,1.3-0.4l-0.3-0.6c-0.2,0.1-0.5,0.3-0.9,0.3c-0.5,0-0.8-0.2-0.8-1V12h1.6v-0.8h-1.6V9H126.2z"/>
+               <g id="XMLID_35316_">
+                       <g>
+                               <path id="XMLID_112_" fill="#3E3E3F" 
d="M98,23.4h31.5V30h-10.8v22.9h-9.8V30H98V23.4z"/>
+                               <path id="XMLID_109_" fill="#3E3E3F" 
d="M132.4,23.4H156c7.2,0,9.9,3.3,9.9,8.2c0,3.9-2.1,6.1-4.7,6.7v0.1
+                                       
c1.9,0.6,3.3,2.1,3.6,5.3c0.5,5.8,0.6,7.7,1.9,9.2h-10.8c-0.5-1.3-0.6-3-0.6-4.4c0-4.6-1.5-5.5-4-5.5h-9v9.8h-9.8V23.4z
+                                        
M142.2,36.4h9.5c2.4,0,3.7-1.2,3.7-3.3c0-1.9-1.3-3.2-3.7-3.2h-9.5V36.4z"/>
+                               <path id="XMLID_107_" fill="#3E3E3F" 
d="M170,23.4h9.8v29.5H170V23.4z"/>
+                               <path id="XMLID_105_" fill="#3E3E3F" 
d="M182.9,23.4h31.5V30h-10.8v22.9h-9.8V30h-10.8V23.4z"/>
+                               <path id="XMLID_102_" fill="#3E3E3F" 
d="M233.3,22.5c10.4,0,19.2,3.4,19.2,15.7c0,12.2-8.8,15.7-19.2,15.7
+                                       
c-10.4,0-19.2-3.4-19.2-15.7C214.1,25.9,222.9,22.5,233.3,22.5z 
M233.3,47.2c5.3,0,8.8-2.9,8.8-9.1c0-6.2-3.5-9.1-8.8-9.1
+                                       
c-5.2,0-8.8,2.9-8.8,9.1C224.5,44.3,228.1,47.2,233.3,47.2z"/>
+                               <path id="XMLID_100_" fill="#3E3E3F" 
d="M254.5,23.4h11.3l13.7,18.5h0.1V23.4h9.5v29.5h-10.9l-14.1-18.6H264v18.6h-9.5V23.4z"/>
+                       </g>
+               </g>
+               <g id="XMLID_35331_">
+                       <path id="XMLID_35332_" fill="#3E3E3F" 
d="M294.4,23.9h-0.9v2.5H293v-2.5h-0.9v-0.4h2.3V23.9z 
M298.2,26.4h-0.5V24h0l-0.9,2.4
+                               
h-0.3l-0.9-2.4h0v2.4H295v-2.9h0.7l0.9,2.2l0.8-2.2h0.7V26.4z"/>
+               </g>
+       </g>
+       <g id="XMLID_34924_">
+               <g id="XMLID_34928_" opacity="0.5">
+                       <polygon id="XMLID_34929_" fill="#3B5967" 
points="42.8,42.8 42.8,44.7 58.1,60.1 60.1,60.1 60.1,58.1 44.7,42.8             
      "/>
+               </g>
+               <path id="XMLID_34930_" fill="#C42C28" 
d="M42.8,21.1c0,0,0-0.1,0-0.1c0,0,0-0.1,0-0.1c0,0,0-0.1-0.1-0.1c0,0,0-0.1-0.1-0.1
+                       
c-0.1-0.1-0.1-0.1-0.2-0.2l-20-20c-0.1-0.1-0.1-0.1-0.2-0.2c0,0-0.1,0-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1,0-0.1,0
+                       
c0,0-0.1,0-0.1,0c-0.1,0-0.2,0-0.3,0h-20C1.3,0,1.2,0,1.1,0c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0.1c0,0-0.1,0-0.1,0.1
+                       
C0.5,0.3,0.3,0.5,0.2,0.6c0,0,0,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1c0,0,0,0.1,0,0.1c0,0,0,0.1,0,0.1c0,0.1,0,0.2,0,0.3v20
+                       
c0,0.1,0,0.2,0,0.3c0,0,0,0.1,0,0.1c0,0,0,0.1,0,0.1c0,0,0,0.1,0.1,0.1c0,0,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.2l20,20
+                       
c0.1,0.1,0.1,0.1,0.2,0.2c0,0,0.1,0,0.1,0.1c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0c0.1,0,0.2,0,0.3,0h20
+                       
c0.8,0,1.4-0.6,1.4-1.4v-20C42.8,21.3,42.8,21.2,42.8,21.1z 
M2.7,4.7L20,22v16.1L2.7,20.8V4.7z M22,20L4.7,2.7h16.1L38.1,20H22z
+                        M22.8,40.1V22.8h17.3v17.3H22.8z"/>
+               <g id="XMLID_34935_" opacity="0.5">
+                       <polygon id="XMLID_34936_" fill="#C52B27" 
points="22.8,22.8 22.8,24.7 38.1,40.1 40.1,40.1 40.1,38.1 24.7,22.8             
      "/>
+                       <polygon id="XMLID_34937_" fill="#C52B27" 
points="20,2.7 20,18.1 22,20 22.8,20 22.8,4.7 20.8,2.7                        
"/>
+                       <polygon id="XMLID_34938_" fill="#C52B27" 
points="18.1,20 2.7,20 2.7,20.8 4.7,22.8 20,22.8 20,22                        
"/>
+                       <path id="XMLID_34940_" fill="#C52B27" 
d="M41.8,42.7c0,0,0.1,0,0.1,0C41.9,42.7,41.9,42.7,41.8,42.7z"/>
+                       <path id="XMLID_34941_" fill="#C52B27" 
d="M42.6,42.1c0,0,0,0.1-0.1,0.1C42.6,42.2,42.6,42.1,42.6,42.1z"/>
+                       <path id="XMLID_34942_" fill="#C52B27" 
d="M42.7,41.8c0,0,0,0.1,0,0.1C42.7,41.9,42.7,41.9,42.7,41.8z"/>
+                       <path id="XMLID_34944_" fill="#C52B27" 
d="M42.8,41.4c0,0.1,0,0.2,0,0.3C42.8,41.6,42.8,41.5,42.8,41.4z"/>
+                       <path id="XMLID_34946_" fill="#C52B27" 
d="M41.4,42.8c0.1,0,0.2,0,0.3,0C41.6,42.8,41.5,42.8,41.4,42.8z"/>
+                       <path id="XMLID_34947_" fill="#C52B27" 
d="M42.1,42.6c0,0,0.1,0,0.1-0.1C42.2,42.6,42.1,42.6,42.1,42.6z"/>
+               </g>
+               <path id="XMLID_34948_" fill="#F16323" 
d="M62.8,21.1c0,0,0-0.1,0-0.1c0,0,0-0.1,0-0.1c0,0,0-0.1-0.1-0.1c0,0,0-0.1-0.1-0.1
+                       
c-0.1-0.1-0.1-0.1-0.2-0.2l-20-20c-0.1-0.1-0.1-0.1-0.2-0.2c0,0-0.1,0-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1,0-0.1,0
+                       
c0,0-0.1,0-0.1,0c-0.1,0-0.2,0-0.3,0h-20c0.1,0,0.2,0,0.3,0h0c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0h0c0.1,0,0.1,0.1,0.2,0.1
+                       
c0,0,0,0,0,0l0,0c0.1,0.1,0.1,0.1,0.2,0.2l2.3,2.3h16.1L58.1,20H42l0.4,0.4c0.1,0.1,0.1,0.1,0.2,0.2c0,0,0,0.1,0.1,0.1
+                       
c0,0,0.1,0.1,0.1,0.1c0,0,0,0.1,0,0.1c0,0,0,0.1,0,0.1c0,0.1,0,0.2,0,0.3v1.4h17.3v17.3H42.8v1.4c0,0.1,0,0.2,0,0.3
+                       
c0,0,0,0.1,0,0.1c0,0,0,0.1,0,0.1c0,0,0,0.1-0.1,0.1c0,0,0,0.1-0.1,0.1c-0.1,0.2-0.2,0.3-0.4,0.4c0,0-0.1,0-0.1,0.1
+                       
c0,0-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0c-0.1,0-0.2,0-0.3,0h20c0.8,0,1.4-0.6,1.4-1.4v-20
+                       C62.8,21.3,62.8,21.2,62.8,21.1z"/>
+               <path fill="#BDBEC0" 
d="M41.4,42.8h-1.4v17.3H22.8V42.8h-1.4c-0.1,0-0.2,0-0.3,0c0,0-0.1,0-0.1,0c0,0-0.1,0-0.1,0
+                       
c0,0-0.1,0-0.1-0.1c0,0-0.1,0-0.1-0.1c-0.1-0.1-0.1-0.1-0.2-0.2L20,42v16.1L2.7,40.9V24.7l-2.3-2.3c-0.1-0.1-0.1-0.1-0.2-0.2l0,0
+                       
c0,0,0,0,0-0.1c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0-0.1l0,0C0,21.7,0,21.5,0,21.4v20c0,0.1,0,0.2,0,0.3c0,0,0,0.1,0,0.1
+                       
c0,0,0,0.1,0,0.1c0,0,0,0.1,0.1,0.1c0,0,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.2l20,20c0.1,0.1,0.1,0.1,0.2,0.2c0,0,0.1,0,0.1,0.1
+                       
c0,0,0.1,0.1,0.1,0.1c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0c0.1,0,0.2,0,0.3,0h20c0.8,0,1.4-0.6,1.4-1.4V42.8H41.4z"/>
+               <g id="XMLID_34949_">
+                       <polygon id="XMLID_34950_" opacity="0.5" fill="#F16323" 
points="42.8,20 42.8,4.7 40.9,2.7 40.1,2.7 40.1,18.1 42,20                      
"/>
+                       <polygon id="XMLID_34951_" opacity="0.5" fill="#F16323" 
points="42.8,22.8 42.8,24.7 58.1,40.1 60.1,40.1 60.1,38.1 44.7,22.8 
+                                                       "/>
+                       <path id="XMLID_34952_" opacity="0.5" fill="#F16323" 
d="M41.8,0.1c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0.1c0,0,0.1,0,0.1,0.1
+                               
c0.1,0.1,0.1,0.1,0.2,0.2l0,0c-0.2-0.3-0.6-0.4-1-0.4c0.1,0,0.2,0,0.3,0C41.7,0,41.8,0.1,41.8,0.1z"/>
+               </g>
+               <g id="XMLID_34953_" opacity="0.5">
+                       <path id="XMLID_34954_" fill="#F19922" 
d="M62,0.1c0,0,0.1,0,0.1,0.1c0,0,0,0,0.1,0C62.1,0.2,62.1,0.1,62,0.1z"/>
+                       <path id="XMLID_34955_" fill="#F19922" 
d="M62.4,0.4c-0.1-0.1-0.1-0.1-0.2-0.2C62.3,0.3,62.4,0.3,62.4,0.4z"/>
+                       <polygon id="XMLID_34956_" fill="#F19922" 
points="60.1,2.7 60.1,18.1 62,20 62.8,20 62.8,4.7 60.9,2.7                    
"/>
+                       <path id="XMLID_34957_" fill="#F19922" 
d="M61.8,0.1C61.9,0.1,61.9,0.1,61.8,0.1c0,0-0.1,0-0.1,0C61.8,0,61.8,0.1,61.8,0.1z"/>
+                       <polygon id="XMLID_34958_" fill="#F19922" 
points="62.8,22.8 62.8,24.7 78.2,40.1 80.1,40.1 80.1,38.1 64.8,22.8             
      "/>
+               </g>
+               <polygon id="XMLID_34959_" opacity="0.5" fill="#83D2E6" 
points="64.8,42.8 62.8,42.8 62.8,44.7 78.2,60.1 80.1,60.1 80.1,58.1             
+                       "/>
+               <path id="XMLID_34960_" fill="#83D2E6" 
d="M81.5,42.8h-1.4v17.3H62.8v1.4c0,0.8-0.6,1.4-1.4,1.4h20c0.8,0,1.4-0.6,1.4-1.4v-20
+                       C82.9,42.2,82.2,42.8,81.5,42.8z"/>
+               <path id="XMLID_34961_" fill="#5A88A9" 
d="M61.5,42.8h-1.4v17.3H42.8v1.4c0,0.8-0.6,1.4-1.4,1.4h20c0.8,0,1.4-0.6,1.4-1.4V42.8
+                       H61.5z"/>
+               <g id="XMLID_34962_" opacity="0.5">
+                       <polygon id="XMLID_34963_" fill="#BDBEC0" 
points="38.1,60.1 40.1,60.1 40.1,58.2 24.7,42.8 22.8,42.8 22.8,44.8             
      "/>
+                       <polygon id="XMLID_34964_" fill="#BDBEC0" 
points="2.7,40.9 4.7,42.8 20,42.8 20,42 18.1,40.1 2.7,40.1                    
"/>
+               </g>
+               <path id="XMLID_34965_" fill="#F19922" 
d="M82.8,21.1c0,0,0-0.1,0-0.1c0,0,0-0.1,0-0.1c0,0,0-0.1-0.1-0.1c0,0,0-0.1-0.1-0.1
+                       
c-0.1-0.1-0.1-0.1-0.2-0.2l-20-20c-0.1-0.1-0.1-0.1-0.2-0.2c0,0-0.1,0-0.1-0.1c0,0-0.1-0.1-0.1-0.1c0,0-0.1,0-0.1,0
+                       
c0,0-0.1,0-0.1,0c-0.1,0-0.2,0-0.3,0h-20c0.1,0,0.2,0,0.3,0c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0c0,0,0.1,0,0.1,0.1c0,0,0.1,0,0.1,0.1
+                       
c0.1,0.1,0.1,0.1,0.2,0.2l2.3,2.3h16.1L78.2,20H62l0.4,0.4c0.1,0.1,0.1,0.1,0.2,0.2c0,0,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1
+                       
c0,0,0,0.1,0,0.1c0,0,0,0.1,0,0.1c0,0.1,0,0.2,0,0.3v1.4h17.3v17.3H62.8v1.4c0,0.8-0.6,1.4-1.4,1.4h20c0.8,0,1.4-0.6,1.4-1.4v-20
+                       C82.9,21.3,82.8,21.2,82.8,21.1z"/>
+       </g>
+</g>
+</svg>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/docs/container/drivers/joyent.rst
----------------------------------------------------------------------
diff --git a/docs/container/drivers/joyent.rst 
b/docs/container/drivers/joyent.rst
new file mode 100644
index 0000000..c2a2233
--- /dev/null
+++ b/docs/container/drivers/joyent.rst
@@ -0,0 +1,57 @@
+Joyent Triton Container Driver Documentation
+==================================
+
+`Joyent Triton`_ is a Docker hosting service, provided by service provider 
`Joyent`.
+Docker-native tools and elastic hosts make deploying on Triton as easy as 
running Docker on your laptop.
+There is no special software to install or configure.
+Mix Docker containers with container-native Linux to extend the benefits of 
containerization to legacy applications and stateful services.
+
+.. figure:: /_static/images/provider_logos/triton.svg
+    :align: center
+    :width: 300
+    :target: http://joyent.com/
+
+Instantiating the driver
+-------------------------------------
+
+Download the script:
+
+    curl -O 
https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh
+    
+Now execute the script, substituting the correct values:
+
+    bash sdc-docker-setup.sh <CLOUDAPI_URL> <ACCOUNT_USERNAME> 
~/.ssh/<PRIVATE_KEY_FILE>
+
+This should output something similar to the following:
+
+    Setting up Docker client for SDC using:
+        CloudAPI:        https://us-east-1.api.joyent.com
+        Account:         jill
+        Key:             /Users/localuser/.ssh/sdc-docker.id_rsa
+    
+    If you have a pass phrase on your key, the openssl command will
+    prompt you for your pass phrase now and again later.
+    
+    Verifying CloudAPI access.
+    CloudAPI access verified.
+    
+    Generating client certificate from SSH private key.
+    writing RSA key
+    Wrote certificate files to /Users/localuser/.sdc/docker/jill
+    
+    Get Docker host endpoint from cloudapi.
+    Docker service endpoint is: tcp://us-east-1.docker.joyent.com:2376
+    
+    * * *
+    Success. Set your environment as follows:
+    
+        export DOCKER_CERT_PATH=/Users/localuser/.sdc/docker/jill
+        export DOCKER_HOST=tcp://us-east-1.docker.joyent.com:2376
+        export DOCKER_CLIENT_TIMEOUT=300
+        export DOCKER_TLS_VERIFY=1
+        
+.. literalinclude:: /examples/container/joyent/instantiate_driver.py
+   :language: python
+   
+.. _`Joyent Triton`: 
https://www.joyent.com/blog/understanding-triton-containers
+.. _`Joyent`: https://www.joyent.com/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/docs/examples/container/joyent/instantiate_driver.py
----------------------------------------------------------------------
diff --git a/docs/examples/container/joyent/instantiate_driver.py 
b/docs/examples/container/joyent/instantiate_driver.py
new file mode 100644
index 0000000..97f011e
--- /dev/null
+++ b/docs/examples/container/joyent/instantiate_driver.py
@@ -0,0 +1,9 @@
+from libcloud.container.types import Provider
+from libcloud.container.providers import get_driver
+
+cls = get_driver(Provider.JOYENT)
+
+conn = cls(host='us-east-1.docker.joyent.com', port=2376,
+           key_file='key.pem', cert_file='~/.sdc/docker/admin/ca.pem')
+
+conn.list_images()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/libcloud/container/drivers/joyent.py
----------------------------------------------------------------------
diff --git a/libcloud/container/drivers/joyent.py 
b/libcloud/container/drivers/joyent.py
new file mode 100644
index 0000000..f236808
--- /dev/null
+++ b/libcloud/container/drivers/joyent.py
@@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+from libcloud.container.providers import Provider
+
+from libcloud.container.drivers.docker import (DockerContainerDriver,
+                                               DockerConnection)
+
+
+class JoyentContainerDriver(DockerContainerDriver):
+    """
+    Joyent Triton container driver class.
+
+    >>> from libcloud.container.providers import get_driver
+    >>> driver = get_driver('joyent')
+    >>> conn = driver(host='https://us-east-1.docker.joyent.com',
+        port=2376, key_file='key.pem', cert_file='cert.pem')
+    """
+
+    type = Provider.JOYENT
+    name = 'Joyent'
+    website = 'http://joyent.com'
+    connectionCls = DockerConnection
+
+    def __init__(self, key=None, secret=None, secure=False, host='localhost',
+                 port=2376, key_file=None, cert_file=None):
+
+        super(JoyentContainerDriver, self).__init__(key=key, secret=secret,
+                                                    secure=secure, host=host,
+                                                    port=port,
+                                                    key_file=key_file,
+                                                    cert_file=cert_file)
+        if host.startswith('https://'):
+            secure = True
+
+        # strip the prefix
+        prefixes = ['http://', 'https://']
+        for prefix in prefixes:
+            if host.startswith(prefix):
+                host = host.strip(prefix)
+
+        if key_file or cert_file:
+            # docker tls authentication-
+            # https://docs.docker.com/articles/https/
+            # We pass two files, a key_file with the
+            # private key and cert_file with the certificate
+            # libcloud will handle them through LibcloudHTTPSConnection
+            if not (key_file and cert_file):
+                raise Exception(
+                    'Needs both private key file and '
+                    'certificate file for tls authentication')
+            self.connection.key_file = key_file
+            self.connection.cert_file = cert_file
+            self.connection.secure = True
+        else:
+            self.connection.secure = secure
+
+        self.connection.host = host
+        self.connection.port = port

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/libcloud/container/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/container/providers.py b/libcloud/container/providers.py
index 0afd200..45daa88 100644
--- a/libcloud/container/providers.py
+++ b/libcloud/container/providers.py
@@ -22,6 +22,8 @@ DRIVERS = {
     ('libcloud.container.drivers.dummy', 'DummyContainerDriver'),
     Provider.DOCKER:
     ('libcloud.container.drivers.docker', 'DockerContainerDriver'),
+    Provider.JOYENT:
+    ('libcloud.container.drivers.joyent', 'JoyentContainerDriver'),
 }
 
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/e61bad54/libcloud/container/types.py
----------------------------------------------------------------------
diff --git a/libcloud/container/types.py b/libcloud/container/types.py
index ce57f06..559d779 100644
--- a/libcloud/container/types.py
+++ b/libcloud/container/types.py
@@ -42,6 +42,7 @@ class Type(object):
 class Provider(object):
     DUMMY = 'dummy'
     DOCKER = 'docker'
+    JOYENT = 'joyent'
 
 
 class ContainerState(Type):

Reply via email to