|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| 7 | + <title>API Documentation</title> |
| 8 | + |
| 9 | + <link href="../stylesheets/screen.css" rel="stylesheet" type="text/css" media="screen" /> |
| 10 | + <link href="../stylesheets/print.css" rel="stylesheet" type="text/css" media="print" /> |
| 11 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
| 12 | + <script src="../javascripts/all_nosearch.js" type="text/javascript"></script> |
| 13 | + |
| 14 | + </head> |
| 15 | + |
| 16 | + <body class="includes includes_availabilityzone"> |
| 17 | + <a href="#" id="nav-button"> |
| 18 | + <span> |
| 19 | + NAV |
| 20 | + <img src="../images/navbar.png" /> |
| 21 | + </span> |
| 22 | + </a> |
| 23 | + <div class="tocify-wrapper"> |
| 24 | + <img src="../images/logo.png" /> |
| 25 | + <div id="toc"> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + <div class="page-wrapper"> |
| 29 | + <div class="dark-box"></div> |
| 30 | + <div class="content"> |
| 31 | + <h1 id="availability-zones">Availability Zones</h1> |
| 32 | + |
| 33 | +<h2 id="availability-zone">Availability Zone</h2> |
| 34 | + |
| 35 | +<blockquote> |
| 36 | +<p>Example</p> |
| 37 | +</blockquote> |
| 38 | +<pre class="highlight json"><code><span class="p">{</span><span class="w"> |
| 39 | + </span><span class="nt">"available"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> |
| 40 | + </span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ap-northeast-1a"</span><span class="p">,</span><span class="w"> |
| 41 | + </span><span class="nt">"region"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/api/infra/v1/region/az/ap-northeast-1/"</span><span class="p">,</span><span class="w"> |
| 42 | + </span><span class="nt">"resource_uri"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/api/infra/v1/az/aws/ap-northeast-1/ap-northeast-1a/"</span><span class="w"> |
| 43 | +</span><span class="p">}</span><span class="w"> |
| 44 | +</span></code></pre> |
| 45 | + |
| 46 | +<p>An Availability Zone is an isolated location inside a region. Providers that support availability zones: AWS</p> |
| 47 | + |
| 48 | +<h3 id="attributes">Attributes</h3> |
| 49 | + |
| 50 | +<table><thead> |
| 51 | +<tr> |
| 52 | +<th>Attribute</th> |
| 53 | +<th>Description</th> |
| 54 | +</tr> |
| 55 | +</thead><tbody> |
| 56 | +<tr> |
| 57 | +<td>available</td> |
| 58 | +<td>Whether the availability zone is currently available for new node deployments</td> |
| 59 | +</tr> |
| 60 | +<tr> |
| 61 | +<td>name</td> |
| 62 | +<td>An identifier for the availability zone</td> |
| 63 | +</tr> |
| 64 | +<tr> |
| 65 | +<td>region</td> |
| 66 | +<td>The resource URI of the region where the availability zone is allocated</td> |
| 67 | +</tr> |
| 68 | +<tr> |
| 69 | +<td>resource_uri</td> |
| 70 | +<td>A unique API endpoint that represents the zone</td> |
| 71 | +</tr> |
| 72 | +</tbody></table> |
| 73 | + |
| 74 | +<h2 id="list-all-availability-zones">List all availability zones</h2> |
| 75 | +<pre class="highlight python"><code><span class="kn">import</span> <span class="nn">dockercloud</span> |
| 76 | + |
| 77 | +<span class="n">az</span> <span class="o">=</span> <span class="n">dockercloud</span><span class="o">.</span><span class="n">AZ</span><span class="o">.</span><span class="nb">list</span><span class="p">()</span> |
| 78 | +</code></pre> |
| 79 | +<pre class="highlight http"><code><span class="nf">GET</span> <span class="nn">/api/infra/v1/az/</span> <span class="k">HTTP</span><span class="o">/</span><span class="m">1.1</span> |
| 80 | +<span class="na">Host</span><span class="p">:</span> <span class="s">cloud.docker.com</span> |
| 81 | +<span class="na">Authorization</span><span class="p">:</span> <span class="s">Basic dXNlcm5hbWU6YXBpa2V5</span> |
| 82 | +<span class="na">Accept</span><span class="p">:</span> <span class="s">application/json</span> |
| 83 | +</code></pre> |
| 84 | +<pre class="highlight go"><code><span class="k">import</span><span class="x"> </span><span class="s">"github.com/docker/go-dockercloud/dockercloud"</span><span class="x"> |
| 85 | + |
| 86 | +</span><span class="n">az</span><span class="p">,</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">dockercloud</span><span class="o">.</span><span class="n">ListAZ</span><span class="p">()</span><span class="x"> |
| 87 | +</span><span class="k">if</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="no">nil</span><span class="x"> </span><span class="p">{</span><span class="x"> |
| 88 | + </span><span class="n">log</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="x"> |
| 89 | +</span><span class="p">}</span><span class="x"> |
| 90 | + |
| 91 | +</span><span class="n">log</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="n">az</span><span class="p">)</span><span class="x"> |
| 92 | +</span></code></pre> |
| 93 | +<pre class="highlight shell"><code>docker-cloud nodecluster az |
| 94 | +</code></pre> |
| 95 | + |
| 96 | +<p>Lists all availability zones from all regions of all supported cloud providers. Returns a list of <code class="prettyprint">Availability Zone</code> objects.</p> |
| 97 | + |
| 98 | +<h3 id="endpoint-type">Endpoint Type</h3> |
| 99 | + |
| 100 | +<p>Available in Docker Cloud’s <strong>REST API</strong></p> |
| 101 | + |
| 102 | +<h3 id="http-request">HTTP Request</h3> |
| 103 | + |
| 104 | +<p><code class="prettyprint">GET /api/infra/v1/az/</code></p> |
| 105 | + |
| 106 | +<h3 id="query-parameters">Query Parameters</h3> |
| 107 | + |
| 108 | +<table><thead> |
| 109 | +<tr> |
| 110 | +<th>Parameter</th> |
| 111 | +<th>Description</th> |
| 112 | +</tr> |
| 113 | +</thead><tbody> |
| 114 | +<tr> |
| 115 | +<td>name</td> |
| 116 | +<td>Filter by availability zone name</td> |
| 117 | +</tr> |
| 118 | +<tr> |
| 119 | +<td>region</td> |
| 120 | +<td>Filter by resource URI of the target region</td> |
| 121 | +</tr> |
| 122 | +</tbody></table> |
| 123 | + |
| 124 | +<h2 id="get-an-individual-availability-zone">Get an individual availability zone</h2> |
| 125 | +<pre class="highlight python"><code><span class="kn">import</span> <span class="nn">dockercloud</span> |
| 126 | + |
| 127 | +<span class="n">az</span> <span class="o">=</span> <span class="n">dockercloud</span><span class="o">.</span><span class="n">AZ</span><span class="o">.</span><span class="n">fetch</span><span class="p">(</span><span class="s">"aws/sa-east-1/sa-east-1a"</span><span class="p">)</span> |
| 128 | +</code></pre> |
| 129 | +<pre class="highlight go"><code><span class="k">import</span><span class="x"> </span><span class="s">"github.com/docker/go-dockercloud/dockercloud"</span><span class="x"> |
| 130 | + |
| 131 | +</span><span class="n">az</span><span class="p">,</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">:=</span><span class="x"> </span><span class="n">dockercloud</span><span class="o">.</span><span class="n">GetAZ</span><span class="p">(</span><span class="s">"aws/sa-east-1/sa-east-1a"</span><span class="p">)</span><span class="x"> |
| 132 | +</span><span class="k">if</span><span class="x"> </span><span class="n">err</span><span class="x"> </span><span class="o">!=</span><span class="x"> </span><span class="no">nil</span><span class="x"> </span><span class="p">{</span><span class="x"> |
| 133 | + </span><span class="n">log</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="x"> |
| 134 | +</span><span class="p">}</span><span class="x"> |
| 135 | + |
| 136 | +</span><span class="n">log</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="n">az</span><span class="p">)</span><span class="x"> |
| 137 | +</span></code></pre> |
| 138 | +<pre class="highlight http"><code><span class="nf">GET</span> <span class="nn">/api/infra/v1/az/aws/sa-east-1/sa-east-1a/</span> <span class="k">HTTP</span><span class="o">/</span><span class="m">1.1</span> |
| 139 | +<span class="na">Host</span><span class="p">:</span> <span class="s">cloud.docker.com</span> |
| 140 | +<span class="na">Authorization</span><span class="p">:</span> <span class="s">Basic dXNlcm5hbWU6YXBpa2V5</span> |
| 141 | +<span class="na">Accept</span><span class="p">:</span> <span class="s">application/json</span> |
| 142 | +</code></pre> |
| 143 | + |
| 144 | +<p>Get all the details of a specific availability zone</p> |
| 145 | + |
| 146 | +<h3 id="endpoint-type">Endpoint Type</h3> |
| 147 | + |
| 148 | +<p>Available in Docker Cloud’s <strong>REST API</strong></p> |
| 149 | + |
| 150 | +<h3 id="http-request">HTTP Request</h3> |
| 151 | + |
| 152 | +<p><code class="prettyprint">GET /api/infra/v1/az/(provider.name)/(region.name)/(name)/</code></p> |
| 153 | + |
| 154 | +<h3 id="path-parameters">Path Parameters</h3> |
| 155 | + |
| 156 | +<table><thead> |
| 157 | +<tr> |
| 158 | +<th>Parameter</th> |
| 159 | +<th>Description</th> |
| 160 | +</tr> |
| 161 | +</thead><tbody> |
| 162 | +<tr> |
| 163 | +<td>name</td> |
| 164 | +<td>The name of the availability zone to retrieve</td> |
| 165 | +</tr> |
| 166 | +<tr> |
| 167 | +<td>provider</td> |
| 168 | +<td>The name of the provider</td> |
| 169 | +</tr> |
| 170 | +<tr> |
| 171 | +<td>region</td> |
| 172 | +<td>The name of the region</td> |
| 173 | +</tr> |
| 174 | +</tbody></table> |
| 175 | + |
| 176 | + </div> |
| 177 | + <div class="dark-box"> |
| 178 | + </div> |
| 179 | + </div> |
| 180 | + <div class="google-analytics"> |
| 181 | + <!-- Google Tag Manager --> |
| 182 | + <noscript> |
| 183 | + <iframe src="//www.googletagmanager.com/ns.html?id=GTM-WLGFZV" |
| 184 | + height="0" width="0" style="display:none;visibility:hidden"></iframe> |
| 185 | + </noscript> |
| 186 | + <script> |
| 187 | + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': |
| 188 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], |
| 189 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= |
| 190 | + '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); |
| 191 | + })(window,document,'script','dataLayer','GTM-WLGFZV'); |
| 192 | + </script> |
| 193 | + <!-- End Google Tag Manager --> |
| 194 | + </div> |
| 195 | + </body> |
| 196 | +</html> |
0 commit comments