Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace outdated landing page with redirect.
For now, so's not to sew confusion, redirect the GitHub:Pages to the GitHub project page. Closes #20.
- Loading branch information
1 parent
7658fdd
commit 3da821e
Showing
4 changed files
with
5 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
.AppleDouble | |||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,337 +1,11 @@ | |||
|
|||
<!DOCTYPE html> | <!DOCTYPE html> | ||
<html> | <html> | ||
<head> | <head> | ||
<title>Node EC2 X</title> | <title>Node EC2</title> | ||
<meta http-equiv="refresh" content="0;URL='http://github.com/bigeasy/node-ec2'"> | |||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | ||
<link rel="stylesheet" media="all" href="site/idl.css"> | |||
</head> | </head> | ||
<body> | <body> | ||
|
<p>Nothing to see here. Move along.</p> | ||
<a href="http://github.com/bigeasy/node-ec2"><img style="position: fixed; top: 0; right: | |||
0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" | |||
alt="Fork me on GitHub" /></a> | |||
|
|||
<div id="container"> | |||
<div id="api"> | |||
<h1>Node EC2</h1> | |||
|
|||
|
|||
|
|||
|
|||
<h2 class="heading">Synopsis</h3> | |||
|
|||
|
|||
|
|||
<h2 class="heading">Installing</h3> | |||
|
|||
|
|||
|
|||
<h2 class="heading">Reference</h3> | |||
|
|||
|
|||
|
|||
<h3 class="namespace depth-0">ec2</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-1">createClient</h3> | |||
|
|||
|
|||
|
|||
<h3 class="class depth-1">AmazonEC2Client</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-2">call</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-2">poll</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-2">execute</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-2">"error"</h3> | |||
|
|||
|
|||
|
|||
<h3 class="function depth-2">"end"</h3> | |||
|
|||
|
|||
|
|||
<h2 class="heading">Docco</h3> | |||
|
|||
|
|||
|
|||
<h3 class="docco depth-0"><a href="./documentation/amazon.html">amazon.coffee</a></h3> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 class="docco depth-0"><a href="./documentation/request.html">request.coffee</a></h3> | |||
|
|||
|
|||
|
|||
|
|||
<h3 class="docco depth-0"><a href="./documentation/response.html">response.coffee</a></h3> | |||
|
|||
|
|||
|
|||
</div> | |||
<div id="narrative"> | |||
|
|||
|
|||
|
|||
|
|||
<h1>Node EC2</h1> | |||
|
|||
<p>Evended Node.js bindings to the EC2 Query API.</p> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2>Synopsis</h2> | |||
|
|||
<p>Node EC2 is a thin layer over the Amazon Query API.</p> | |||
|
|||
<p>Because <code>node-ec2</code> is a thin layer over the Amazon Query API, you can use the | |||
<a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?query-apis.html">Amazon API | |||
Reference</a> | |||
to find your way around. Node EC2 calls translate directly to Amazon Query API.</p> | |||
|
|||
<p>Other than converting parameter maps to signed query strings and converting the | |||
XML responses to JSON objects, there is no syntactic sugar. See Rationale.</p> | |||
|
|||
<p>Here's an example using | |||
<a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-RunInstances.html">RunInstances</a>.</p> | |||
|
|||
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">ec2</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s2">"ec2"</span><span class="p">);</span> | |||
|
|||
<span class="c1">// Create an instance of the AmazonEC2Client.</span> | |||
<span class="kd">var</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">ec2</span><span class="p">.</span><span class="nx">createClient</span><span class="p">(</span> | |||
<span class="p">{</span> <span class="nx">key</span><span class="o">:</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">[</span><span class="s2">"AWS_ACCESS_KEY_ID"</span><span class="p">]</span> | |||
<span class="p">,</span> <span class="nx">secret</span><span class="o">:</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">[</span><span class="s2">"AWS_SECRET_ACCESS_KEY"</span><span class="p">]</span> | |||
<span class="p">});</span> | |||
|
|||
<span class="c1">// Track the progress of the API invocation in the lexical scope.</span> | |||
<span class="kd">var</span> <span class="nx">instanceId</span><span class="p">,</span> | |||
<span class="nx">reservationId</span><span class="p">;</span> | |||
|
|||
<span class="c1">// Call the "RunInstances" action to create a new EC2 instance. The Amazon Query</span> | |||
<span class="c1">// API call will return immediately, but the instance will take a while to boot.</span> | |||
<span class="nx">client</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="s2">"RunInstances"</span><span class="p">,</span> <span class="p">{</span> | |||
<span class="nx">ImageId</span><span class="o">:</span> <span class="s2">"ami-2d4aa444"</span><span class="p">,</span> <span class="nx">KeyName</span><span class="o">:</span> <span class="s2">"launch_key"</span> | |||
<span class="p">},</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">response</span><span class="p">)</span> <span class="p">{</span> | |||
<span class="nx">reservationId</span> <span class="o">=</span> <span class="nx">response</span><span class="p">.</span><span class="nx">reservationId</span><span class="p">;</span> | |||
<span class="nx">instanceId</span> <span class="o">=</span> <span class="nx">response</span><span class="p">.</span><span class="nx">instancesSet</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">instanceId</span><span class="p">;</span> | |||
<span class="p">});</span> | |||
|
|||
<span class="c1">// Therefore, we poll the "DescribeInstances" action, calling it once every</span> | |||
<span class="c1">// second until the instance state indicates that it is running.</span> | |||
<span class="nx">client</span><span class="p">.</span><span class="nx">poll</span><span class="p">(</span><span class="s2">"DescribeInstances"</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">struct</span><span class="p">)</span> <span class="p">{</span> | |||
<span class="kd">var</span> <span class="nx">reservation</span> <span class="o">=</span> <span class="nx">struct</span><span class="p">.</span><span class="nx">reservationSet</span><span class="p">.</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">reservation</span><span class="p">)</span> <span class="p">{</span> | |||
<span class="k">return</span> <span class="nx">reservation</span><span class="p">.</span><span class="nx">reservationId</span> <span class="o">==</span> <span class="nx">reservationId</span><span class="p">;</span> | |||
<span class="p">})[</span><span class="mi">0</span><span class="p">];</span> | |||
<span class="kd">var</span> <span class="nx">instance</span> <span class="o">=</span> <span class="nx">reservation</span><span class="p">.</span><span class="nx">instancesSet</span><span class="p">.</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">instance</span><span class="p">)</span> <span class="p">{</span> | |||
<span class="k">return</span> <span class="nx">instance</span><span class="p">.</span><span class="nx">instanceId</span> <span class="o">==</span> <span class="nx">instanceId</span><span class="p">;</span> | |||
<span class="p">})[</span><span class="mi">0</span><span class="p">];</span> | |||
<span class="k">return</span> <span class="nx">instance</span><span class="p">.</span><span class="nx">instanceState</span><span class="p">.</span><span class="nx">name</span> <span class="o">==</span> <span class="s2">"running"</span><span class="p">;</span> | |||
<span class="p">});</span> | |||
|
|||
<span class="c1">// When all of the Amazon Query API calls and polls complete, we know that our</span> | |||
<span class="c1">// Amazon EC2 instance is ready for use.</span> | |||
<span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s2">"end"</span><span class="p">,</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> | |||
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"Instance created with id: "</span> <span class="o">+</span> <span class="nx">instanceId</span><span class="p">);</span> | |||
<span class="p">});</span> | |||
|
|||
<span class="c1">// Run the trasaction described above.</span> | |||
<span class="nx">client</span><span class="p">.</span><span class="nx">execute</span><span class="p">();</span> | |||
</pre></div> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2>Installing</h2> | |||
|
|||
<p>The easiest way to install is using npm.</p> | |||
|
|||
<div class='highlight'><pre>npm install ec2</pre></div> | |||
|
|||
<p>You can also checkout the source code for incusion in your <code>NODE_PATH</code> using | |||
<code>git</code>. </p> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
<h2>Reference</h2> | |||
|
|||
|
|||
|
|||
<h3 class="namespace">ec2</h3> | |||
|
|||
|
|||
|
|||
<p>Node EC2 exports the ec2 namespace, which includes a single factory method to | |||
crate the Amazon EC2 Query API client object.</p> | |||
|
|||
<div class="highlight"><pre><span class="kd">var</span> <span class="nx">ec2</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s2">"ec2"</span><span class="p">);</span> | |||
</pre></div> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<h3 class="function">ec2.createClient()</h3> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<p>Creates an {{AmazonEC2Client}} object for use in </p> | |||
|
|||
|
|||
|
|||
<h3 class="class">ec2.AmazonEC2Client()</h3> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
<p>Communicates with the Amazon Query API.</p> | |||
|
|||
|
|||
|
|||
|
|||
<h3 class="function">call(name[, parameters][, callback])</h3> | |||
|
|||
|
|||
|
|||
|
|||
<div class="parameter"> | |||
<h4>name</h4> | |||
|
|||
<p>The Amazon EC2 Query API action to perform.</p> | |||
|
|||
</div> | |||
|
|||
<div class="parameter"> | |||
<h4>parameters</h4> | |||
|
|||
<p>Named parameters for the Amazon EC2 Query API action.</p> | |||
|
|||
</div> | |||
|
|||
<div class="parameter"> | |||
<h4>callback</h4> | |||
|
|||
<p>A callback function that is called with JSON object containing the Amazon EC2 | |||
Query API repsonse when the Amazon EC2 Query API action completes.</p> | |||
|
|||
</div> | |||
|
|||
|
|||
|
|||
<p>Call an Amazon Query API action.</p> | |||
|
|||
|
|||
|
|||
|
|||
<h3 class="function">poll(name[, parameters][, callback])</h3> | |||
|
|||
|
|||
|
|||
|
|||
<div class="parameter"> | |||
<h4>name</h4> | |||
|
|||
<p>The Amazon EC2 Query API action to perform.</p> | |||
|
|||
</div> | |||
|
|||
<div class="parameter"> | |||
<h4>parameters</h4> | |||
|
|||
<p>Named parameters for the Amazon EC2 Query API action.</p> | |||
|
|||
</div> | |||
|
|||
<div class="parameter"> | |||
<h4>callback</h4> | |||
|
|||
<p>A callback function that is called with JSON object containing the Amazon EC2 | |||
Query API repsonse when the Amazon EC2 Query API action completes. If the | |||
callback function returns <code>false</code> the query is performed again.</p> | |||
|
|||
</div> | |||
|
|||
|
|||
|
|||
<p>Call an Amazon Query API action while a condition is false.</p> | |||
|
|||
|
|||
|
|||
|
|||
<h3 class="function">execute()</h3> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<p>Run the query.</p> | |||
|
|||
|
|||
|
|||
<h3 class="event">on("error", function (error, statusCode) {})</h3> | |||
|
|||
|
|||
|
|||
<div class="parameter"> | |||
<h4>error</h4> | |||
|
|||
<p>The error response structure.</p> | |||
|
|||
</div> | |||
|
|||
<div class="parameter"> | |||
<h4>statusCode</h4> | |||
|
|||
<p>The HTTP status code for the error response.</p> | |||
|
|||
</div> | |||
|
|||
|
|||
|
|||
<p>Called when there is any error, both network errors, and exceptions thrown by | |||
callbacks, so that you have a chance to release instances if things go wrong.</p> | |||
|
|||
|
|||
|
|||
<h3 class="event">on("end", function () {})</h3> | |||
|
|||
|
|||
|
|||
|
|||
|
|||
<p>Called when all queries have completed successfully.</p> | |||
|
|||
|
|||
</div> | |||
</div> | |||
</body> | </body> | ||
</html> | </html> |
Submodule master
deleted from
dd9873