Skip to content

Commit

Permalink
Update runbook and .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 11, 2024
1 parent e074bde commit a72a195
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
.idea
.vscode
.DS_Store
venv/
__pycache__/

Expand Down
81 changes: 81 additions & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,25 @@ <h1 id="index">Index</h1>
| <a href="#D"><strong>D</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#U"><strong>U</strong></a>
| <a href="#W"><strong>W</strong></a>

</div>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.EnvConfig.apikey">apikey (pyninja.squire.EnvConfig attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.exceptions.APIResponse">APIResponse</a>
</li>
<li><a href="index.html#pyninja.auth.authenticator">authenticator() (in module pyninja.auth)</a>
</li>
</ul></td>
</tr></table>
Expand All @@ -65,6 +73,10 @@ <h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.ServiceStatus.description">description (pyninja.squire.ServiceStatus attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.routers.docs">docs() (in module pyninja.routers)</a>
</li>
</ul></td>
</tr></table>
Expand Down Expand Up @@ -95,13 +107,35 @@ <h2 id="F">F</h2>
</ul></td>
</tr></table>

<h2 id="G">G</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.service.get_pid">get_pid() (in module pyninja.service)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.service.get_service_status">get_service_status() (in module pyninja.service)</a>
</li>
</ul></td>
</tr></table>

<h2 id="M">M</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
module

<ul>
<li><a href="index.html#module-pyninja.auth">pyninja.auth</a>
</li>
<li><a href="index.html#module-pyninja.exceptions">pyninja.exceptions</a>
</li>
<li><a href="index.html#module-pyninja.main">pyninja.main</a>
</li>
<li><a href="index.html#module-pyninja.routers">pyninja.routers</a>
</li>
<li><a href="index.html#module-pyninja.service">pyninja.service</a>
</li>
<li><a href="index.html#module-pyninja.squire">pyninja.squire</a>
</li>
</ul></li>
Expand All @@ -125,9 +159,44 @@ <h2 id="P">P</h2>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.ServiceStatus.pid">pid (pyninja.squire.ServiceStatus attribute)</a>
</li>
<li>
pyninja.auth

<ul>
<li><a href="index.html#module-pyninja.auth">module</a>
</li>
</ul></li>
<li>
pyninja.exceptions

<ul>
<li><a href="index.html#module-pyninja.exceptions">module</a>
</li>
</ul></li>
<li>
pyninja.main

<ul>
<li><a href="index.html#module-pyninja.main">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
pyninja.routers

<ul>
<li><a href="index.html#module-pyninja.routers">module</a>
</li>
</ul></li>
<li>
pyninja.service

<ul>
<li><a href="index.html#module-pyninja.service">module</a>
</li>
</ul></li>
<li>
pyninja.squire

<ul>
Expand All @@ -141,18 +210,30 @@ <h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.StatusPayload.service_name">service_name (pyninja.squire.StatusPayload attribute)</a>
</li>
<li><a href="index.html#pyninja.routers.service_status">service_status() (in module pyninja.routers)</a>
</li>
<li><a href="index.html#pyninja.squire.ServiceStatus">ServiceStatus (class in pyninja.squire)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.main.start">start() (in module pyninja.main)</a>
</li>
<li><a href="index.html#pyninja.squire.ServiceStatus.status_code">status_code (pyninja.squire.ServiceStatus attribute)</a>
</li>
<li><a href="index.html#pyninja.squire.StatusPayload">StatusPayload (class in pyninja.squire)</a>
</li>
</ul></td>
</tr></table>

<h2 id="U">U</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.exceptions.UnSupportedOS">UnSupportedOS</a>
</li>
</ul></td>
</tr></table>

<h2 id="W">W</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down
128 changes: 113 additions & 15 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,118 @@ <h1>Welcome to PyNinja’s documentation!<a class="headerlink" href="#welcome-to
</ul>
</div>
</section>
<section id="pyninja-main">
<h1>PyNinja - Main<a class="headerlink" href="#pyninja-main" title="Permalink to this heading"></a></h1>
<section id="module-pyninja.main">
<span id="pyninja-main"></span><h1>PyNinja - Main<a class="headerlink" href="#module-pyninja.main" title="Permalink to this heading"></a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="pyninja.main.start">
<span class="sig-prename descclassname"><span class="pre">pyninja.main.</span></span><span class="sig-name descname"><span class="pre">start</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#pyninja.main.start" title="Permalink to this definition"></a></dt>
<dd><p>Starter function for the API, which uses uvicorn server as trigger.</p>
</dd></dl>

</section>
<section id="authenticator">
<h1>Authenticator<a class="headerlink" href="#authenticator" title="Permalink to this heading"></a></h1>
<section id="module-pyninja.auth">
<span id="authenticator"></span><h1>Authenticator<a class="headerlink" href="#module-pyninja.auth" title="Permalink to this heading"></a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="pyninja.auth.authenticator">
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyninja.auth.</span></span><span class="sig-name descname"><span class="pre">authenticator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">token</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">HTTPBasicCredentials</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">Depends(HTTPBearer)</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#pyninja.auth.authenticator" title="Permalink to this definition"></a></dt>
<dd><p>Validates the token if mentioned as a dependency.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>token</strong> – Takes the authorization header token as an argument.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><a class="reference internal" href="#pyninja.exceptions.APIResponse" title="pyninja.exceptions.APIResponse"><strong>APIResponse</strong></a></p></li>
<li><p><strong>- 401</strong> – If authorization is invalid.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
<section id="exceptions">
<h1>Exceptions<a class="headerlink" href="#exceptions" title="Permalink to this heading"></a></h1>
<section id="module-pyninja.exceptions">
<span id="exceptions"></span><h1>Exceptions<a class="headerlink" href="#module-pyninja.exceptions" title="Permalink to this heading"></a></h1>
<dl class="py exception">
<dt class="sig sig-object py" id="pyninja.exceptions.APIResponse">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyninja.exceptions.</span></span><span class="sig-name descname"><span class="pre">APIResponse</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">status_code</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">detail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">headers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyninja.exceptions.APIResponse" title="Permalink to this definition"></a></dt>
<dd><p>Custom <code class="docutils literal notranslate"><span class="pre">HTTPException</span></code> from <code class="docutils literal notranslate"><span class="pre">FastAPI</span></code> to wrap an API response.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">APIResponse</span>
</pre></div>
</div>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="pyninja.exceptions.UnSupportedOS">
<em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyninja.exceptions.</span></span><span class="sig-name descname"><span class="pre">UnSupportedOS</span></span><a class="headerlink" href="#pyninja.exceptions.UnSupportedOS" title="Permalink to this definition"></a></dt>
<dd><p>Custom exception class for unsupported OS.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">UnSupportedOS</span>
</pre></div>
</div>
</dd></dl>

</section>
<section id="routers">
<h1>Routers<a class="headerlink" href="#routers" title="Permalink to this heading"></a></h1>
<section id="module-pyninja.routers">
<span id="routers"></span><h1>Routers<a class="headerlink" href="#module-pyninja.routers" title="Permalink to this heading"></a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="pyninja.routers.service_status">
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyninja.routers.</span></span><span class="sig-name descname"><span class="pre">service_status</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">payload</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pyninja.squire.StatusPayload" title="pyninja.squire.StatusPayload"><span class="pre">StatusPayload</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyninja.routers.service_status" title="Permalink to this definition"></a></dt>
<dd><p>API function to monitor a service.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>payload</strong> (<em>StatusPayload</em>) – Payload received as request body.</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><a class="reference internal" href="#pyninja.exceptions.APIResponse" title="pyninja.exceptions.APIResponse"><strong>APIResponse</strong></a></p></li>
<li><p><strong>Raises the HTTPStatus object with a status code and detail as response.</strong></p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pyninja.routers.docs">
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyninja.routers.</span></span><span class="sig-name descname"><span class="pre">docs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyninja.routers.docs" title="Permalink to this definition"></a></dt>
<dd><p>Redirect to docs page.</p>
</dd></dl>

</section>
<section id="service">
<h1>Service<a class="headerlink" href="#service" title="Permalink to this heading"></a></h1>
<section id="module-pyninja.service">
<span id="service"></span><h1>Service<a class="headerlink" href="#module-pyninja.service" title="Permalink to this heading"></a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="pyninja.service.get_pid">
<span class="sig-prename descclassname"><span class="pre">pyninja.service.</span></span><span class="sig-name descname"><span class="pre">get_pid</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#pyninja.service.get_pid" title="Permalink to this definition"></a></dt>
<dd><p>Get process ID for a particular service.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>service_name</strong> (<em>str</em>) – Name of the service.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Process ID running the service.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pyninja.service.get_service_status">
<span class="sig-prename descclassname"><span class="pre">pyninja.service.</span></span><span class="sig-name descname"><span class="pre">get_service_status</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">service_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pyninja.squire.ServiceStatus" title="pyninja.squire.ServiceStatus"><span class="pre">ServiceStatus</span></a></span></span><a class="headerlink" href="#pyninja.service.get_service_status" title="Permalink to this definition"></a></dt>
<dd><p>Get service status.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>service_name</strong> (<em>str</em>) – Name of the service.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Returns an instance of the ServiceStatus.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#pyninja.squire.ServiceStatus" title="pyninja.squire.ServiceStatus">ServiceStatus</a></p>
</dd>
</dl>
</dd></dl>

</section>
<section id="squire">
<h1>Squire<a class="headerlink" href="#squire" title="Permalink to this heading"></a></h1>
Expand Down Expand Up @@ -221,11 +319,11 @@ <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Pe
<h3><a href="#">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Welcome to PyNinja’s documentation!</a></li>
<li><a class="reference internal" href="#pyninja-main">PyNinja - Main</a></li>
<li><a class="reference internal" href="#authenticator">Authenticator</a></li>
<li><a class="reference internal" href="#exceptions">Exceptions</a></li>
<li><a class="reference internal" href="#routers">Routers</a></li>
<li><a class="reference internal" href="#service">Service</a></li>
<li><a class="reference internal" href="#module-pyninja.main">PyNinja - Main</a></li>
<li><a class="reference internal" href="#module-pyninja.auth">Authenticator</a></li>
<li><a class="reference internal" href="#module-pyninja.exceptions">Exceptions</a></li>
<li><a class="reference internal" href="#module-pyninja.routers">Routers</a></li>
<li><a class="reference internal" href="#module-pyninja.service">Service</a></li>
<li><a class="reference internal" href="#squire">Squire</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
25 changes: 25 additions & 0 deletions docs/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ <h1>Python Module Index</h1>
<td>
<code class="xref">pyninja</code></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-pyninja.auth"><code class="xref">pyninja.auth</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-pyninja.exceptions"><code class="xref">pyninja.exceptions</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-pyninja.main"><code class="xref">pyninja.main</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-pyninja.routers"><code class="xref">pyninja.routers</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="index.html#module-pyninja.service"><code class="xref">pyninja.service</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
Expand Down
Loading

0 comments on commit a72a195

Please sign in to comment.