app/views/index.scala.html (61 lines of code) (raw):
@(documentation: Seq[(String,String,String)])
@main("Prism API") {
<h1>Prism API</h1>
<p>This server is running the Prism API: the API that provides near real-time information about infrastructure.</p>
<h2>Removed fields</h2>
<p>Some fields have recently been removed from certain objects as they were duplicated in the object metadata.</p>
<p>This includes the account and accountName fields that were previously on instances objects.</p>
<h2>Examples</h2>
<p>For the sake of everyones sanity, this page lists the endpoints that are available to experiment with.</p>
<ul>
<li><a href="@routes.Api.instanceList">Instances</a> - filter using any key as a query param e.g.
<a href="@(s"${routes.Api.instanceList}?vendor=aws")">vendor=aws</a> or a more complex example
<a href="@(s"${routes.Api.instanceList}?mainclasses~=soulmates.*&stage!=PROD")">mainclasses~=soulmates.*&stage!=PROD</a>
</li>
<li><a href="@routes.Api.securityGroupList">Security Groups</a></li>
<li><a href="@routes.Api.roleList">Roles</a></li>
<li><a href="@routes.Api.stackList">Stacks</a></li>
<li><a href="@routes.Api.appList">Apps</a> - again, filters work with either key</li>
</ul>
<h2>Query parameters</h2>
<p>Fields that are prefixed with an _ control the query format in some way - they are meta paramters. Fields that
are not prefixed with an _ are interpreted as field filters. Field filters are only useful when the endpoint returns
an array of objects, and they are used to filter the objects that are returned. You simply add a query parameter
with the same name as a top level field and the parameter value will be used to find matching objects.</p>
<p>Some simple examples:</p>
<table>
<tbody>
<tr><td><code>_brief</code> or <code>_brief=true</code></td><td>return only the id of objects</td></tr>
<tr><td><code>_length</code> or <code>_length=true</code></td><td>add companion fields to objects detailing the size of any arrays that are members of the object</td></tr>
<tr><td><code>_precodey</code> or <code>_precodey=true</code></td><td>output json results in precodeified format</td></tr>
<tr><td><code>_reference=uri</code></td><td>output references to objects as Prism object URI (default is Prism ARN ID)</td></tr>
<tr><td><code>_reference=inline</code></td><td>expand references with inline objects</td></tr>
<tr><td><code>stage=TEST</code></td><td>return objects whose stage field has the value of TEST</td></tr>
<tr><td><code>stage!=TEST</code></td><td>invert - return objects whose stage field does not have the value of TEST</td></tr>
<tr><td><code>role~=id.*</code></td><td>regexs - return objects whose role field matches the regular expression id.* (i.e. starts with id)</td></tr>
<tr><td><code>role!~=id.*</code></td><td>inverted regex - return objects whose role field does not match the regular expression</td></tr>
<tr><td><code>stage=TEST&role~=id.*</code></td><td>multiple fields - an exact match of stage and a regex match of role; this returns objects whose stage field has value of TEST <strong>AND</strong> whose role field matches the regular expression</td></tr>
<tr><td><code>stage=TEST&stage=CODE </code></td><td>fields can be specified twice - here we return objects whose stage field has the value of TEST <strong>OR</strong> CODE</td></tr>
<tr><td><code>stage!=TEST&stage!=CODE </code></td><td><strong>this makes no sense</strong> - here we return objects whose stage field has a value that is not TEST <strong>OR</strong> not CODE (i.e. all objects)</td></tr>
<tr><td><code>tag.MongoReplSet=prodprv1</code></td><td>Nested fields can be filtered using periods to separate the fields</td></tr>
</tbody>
</table>
<p>Note that multiple filters for the same field have the sense of an OR operation and then the filters for each
individual field have the sense of an AND operation.</p>
<h2>Play routes</h2>
<table>
<tbody>
@documentation.map { route =>
<tr>
<td>@route._1</td>
<td>@route._2</td>
<td>@route._3</td>
</tr>
}
</tbody>
</table>
<div>
<br />
<small>Build Number: @prism.BuildInfo.buildNumber Commit: @prism.BuildInfo.gitCommitId</small>
</div>
}