You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by bu...@apache.org on 2012/03/25 03:14:51 UTC

svn commit: r809900 - in /websites/staging/libcloud/trunk/content: ./ docs/compute-examples.html

Author: buildbot
Date: Sun Mar 25 01:14:51 2012
New Revision: 809900

Log:
Staging update by buildbot for libcloud

Added:
    websites/staging/libcloud/trunk/content/docs/compute-examples.html
Modified:
    websites/staging/libcloud/trunk/content/   (props changed)

Propchange: websites/staging/libcloud/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Mar 25 01:14:51 2012
@@ -1 +1 @@
-1304192
+1304973

Added: websites/staging/libcloud/trunk/content/docs/compute-examples.html
==============================================================================
--- websites/staging/libcloud/trunk/content/docs/compute-examples.html (added)
+++ websites/staging/libcloud/trunk/content/docs/compute-examples.html Sun Mar 25 01:14:51 2012
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+  <title>Compute -&gt; Examples | Apache Libcloud Documentation</title>
+  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
+  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
+  <script src="/js/clearlink.js" type="text/javascript"></script>
+  <script src="/js/libcloud.js" type="text/javascript"></script>
+  <link rel="stylesheet" href="/css/screen.css" type="text/css">
+  <link rel="stylesheet" href="/css/libcloud.css" type="text/css">
+  <link rel="stylesheet" href="/css/documentation.css" type="text/css">
+  <link rel="stylesheet" href="/css/code.css" type="text/css">
+  <link rel="icon" type="image/png" href="/images/favicon.png"/>
+  <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-23580482-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+</script>
+
+</head>
+<body>
+  <div class="container">
+    <div id="header" class="span-24 last">
+      
+      <h1>Apache Libcloud <span>a unified interface to the cloud</span></h1>
+      
+    </div>
+
+    <div id="banner" class="span-24 last">
+      
+      <h2>Libcloud
+                                             Documentation: Compute -&gt; Examples</h2>
+      
+  </div>
+
+    
+    <div id="sidebar" class="span-6 border">
+      
+<ul id="menu">
+    <li><a href="/index.html">Website home</a></li>
+    <li><a href="/docs/index.html">Documentation home</a></li>
+    <li><a href="/docs/components.html">Components</a></li>
+    <ul>
+        <li class="title">Compute</li>
+        <ul>
+            <li><a href="compute-overview.html">Overview</a></li>
+            <li><a href="compute-base-api.html">Base API</a></li>
+            <li><a href="compute-deployment.html">Deployment</a></li>
+        </ul>
+        <li class="title">Storage (new in 0.5.0)</li>
+        <ul>
+            <li><a href="storage-overview.html">Overview</a></li>
+            <li><a href="storage-base-api.html">Base API</a></li>
+            <li><a href="storage-examples.html">Examples</a></li>
+        </ul>
+        <li class="title">Load Balancer (new in 0.5.0)</li>
+        <ul>
+            <li><a href="load-balancer-overview.html">Overview</a></li>
+            <li><a href="load-balancer-base-api.html">Base API</a></li>
+            <li><a href="load-balancer-examples.html">Examples</a></li>
+        </ul>
+        <li class="title">DNS (new in 0.6.0)</li>
+        <ul>
+            <li><a href="dns-overview.html">Overview</a></li>
+            <li><a href="dns-base-api.html">Base API</a></li>
+            <li><a href="dns-examples.html">Examples</a></li>
+        </ul>
+    </ul>
+    <li>Development</li>
+    <ul>
+        <li><a href="writing-tests-and-using-the-fixture-framework.html">Writing tests and using the fixture framework</a></li>
+    </ul>
+    <li>Other</li>
+    <ul>
+        <li><a href="debugging.html">Debugging</a></li>
+        <li><a href="using-libcloud-in-multi-threaded-and-async-environments.html">Using Libcloud in multi-threaded and async environments</a></li>
+    </ul>
+    <li><a href="/apidocs">Generated API docs</a></li>
+</ul>
+
+
+
+    </div>
+    
+
+    <div id="main" class="span-16 last">
+      
+      <h2 id="examples">Examples</h2>
+<ul>
+<li><a href="#example-1-openstack-node-using-trystack">Create an OpenStack node using trystack.org provider</a></li>
+</ul>
+<h3 id="example-1-openstack-node-using-trystack">Create an OpenStack node using trystack.org provider</h3>
+
+<p><a href="https://trystack.org/">trystack.org</a> allows users to try out OpenStack for free.
+This example demonstrates how to launch an OpenStack node on the trystack.org provider using a generic
+OpenStack driver.</p>
+
+<p>Note: This example works with Libcloud 0.9.0 and above.</p>
+
+<div class="codehilite"><pre><span class="kn">from</span> <span class="nn">libcloud.compute.types</span> <span class="kn">import</span> <span class="n">Provider</span>
+<span class="kn">from</span> <span class="nn">libcloud.compute.providers</span> <span class="kn">import</span> <span class="n">get_driver</span>
+
+<span class="kn">import</span> <span class="nn">libcloud.security</span>
+
+<span class="c"># At the time this example was written, https://nova-api.trystack.org:5443</span>
+<span class="c"># was using a certificate issued by a Certificate Authority (CA)</span>
+<span class="c"># which is not included in the default Ubuntu certificates bundle (ca-certificates).</span>
+<span class="c"># Note: Code like this poses a security risk (MITM attack) and</span>
+<span class="c"># that&#39;s the reason why you should never use it for anything else</span>
+<span class="c"># besides testing. You have been warned.</span>
+<span class="n">libcloud</span><span class="o">.</span><span class="n">security</span><span class="o">.</span><span class="n">VERIFY_SSL_CERT</span> <span class="o">=</span> <span class="bp">False</span>
+
+<span class="n">OpenStack</span> <span class="o">=</span> <span class="n">get_driver</span><span class="p">(</span><span class="n">Provider</span><span class="o">.</span><span class="n">OPENSTACK</span><span class="p">)</span>
+
+<span class="n">driver</span> <span class="o">=</span> <span class="n">OpenStack</span><span class="p">(</span><span class="s">&#39;your username&#39;</span><span class="p">,</span> <span class="s">&#39;your password&#39;</span><span class="p">,</span>
+                   <span class="n">ex_force_auth_url</span><span class="o">=</span><span class="s">&#39;https://nova-api.trystack.org:5443/v2.0&#39;</span><span class="p">,</span>
+                   <span class="n">ex_force_auth_version</span><span class="o">=</span><span class="s">&#39;2.0_password&#39;</span><span class="p">)</span>
+
+<span class="n">nodes</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">list_nodes</span><span class="p">()</span>
+
+<span class="n">images</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">list_images</span><span class="p">()</span>
+<span class="n">sizes</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">list_sizes</span><span class="p">()</span>
+<span class="n">size</span> <span class="o">=</span> <span class="p">[</span><span class="n">s</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">sizes</span> <span class="k">if</span> <span class="n">s</span><span class="o">.</span><span class="n">ram</span> <span class="o">==</span> <span class="mi">512</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+<span class="n">image</span> <span class="o">=</span> <span class="p">[</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">images</span> <span class="k">if</span> <span class="n">i</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s">&#39;natty-server-cloudimg-amd64&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+
+<span class="n">node</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">create_node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;test node&#39;</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="n">image</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+</pre></div>
+      
+    </div>
+
+    <div id="footer" class="span-24">
+    <a href="http://www.apache.org/licenses/">License</a> | <a
+    href="/security.html">Security</a> | <a
+    href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a> |
+<a href="http://www.apache.org/foundation/thanks.html">Thanks</a> | <a
+    href="/credits.html">Credits</a> | <a href="/sitemap.html">Sitemap</a><br /><br />
+
+Copyright © 2009-2011, <a href="http://apache.org/">The Apache Software Foundation</a><br />
+Apache Libcloud, Libcloud, Apache, the Apache feather, and the Apache Libcloud
+project logo are trademarks of the Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+
+    </div>
+  </div>
+</body>
+</html>