This file is indexed.

/usr/share/doc/python-openstacksdk-doc/html/contributors/layout.html is in python-openstacksdk-doc 0.9.5-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>How the SDK is organized &#8212; python-openstacksdk 1.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="top" title="python-openstacksdk 1.0 documentation" href="../index.html" />
    <link rel="up" title="Contributing to the OpenStack SDK" href="index.html" />
    <link rel="next" title="Creating a New Resource" href="create/resource.html" />
    <link rel="prev" title="Testing" href="testing.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="create/resource.html" title="Creating a New Resource"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Testing"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">python-openstacksdk 1.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Contributing to the OpenStack SDK</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="how-the-sdk-is-organized">
<h1>How the SDK is organized<a class="headerlink" href="#how-the-sdk-is-organized" title="Permalink to this headline"></a></h1>
<p>The following diagram shows how the project is laid out.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">openstack</span><span class="o">/</span>
    <span class="n">connection</span><span class="o">.</span><span class="n">py</span>
    <span class="n">resource</span><span class="o">.</span><span class="n">py</span>
    <span class="n">session</span><span class="o">.</span><span class="n">py</span>
    <span class="n">compute</span><span class="o">/</span>
        <span class="n">compute_service</span><span class="o">.</span><span class="n">py</span>
        <span class="n">v2</span><span class="o">/</span>
            <span class="n">server</span><span class="o">.</span><span class="n">py</span>
            <span class="n">_proxy</span><span class="o">.</span><span class="n">py</span>
    <span class="n">tests</span><span class="o">/</span>
        <span class="n">compute</span><span class="o">/</span>
            <span class="n">v2</span><span class="o">/</span>
                <span class="n">test_server</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<div class="section" id="session">
<h2>Session<a class="headerlink" href="#session" title="Permalink to this headline"></a></h2>
<p>The <a class="reference internal" href="../users/session.html#openstack.session.Session" title="openstack.session.Session"><code class="xref py py-class docutils literal"><span class="pre">openstack.session.Session</span></code></a> manages an authenticator,
transport, and user profile. It exposes methods corresponding to
HTTP verbs, and injects your authentication token into a request,
determines any service preferences callers may have set, gets the endpoint
from the authenticator, and sends the request out through the transport.</p>
</div>
<div class="section" id="resource">
<h2>Resource<a class="headerlink" href="#resource" title="Permalink to this headline"></a></h2>
<p>The <a class="reference internal" href="../users/resource.html#openstack.resource.Resource" title="openstack.resource.Resource"><code class="xref py py-class docutils literal"><span class="pre">openstack.resource.Resource</span></code></a> base class is the building block
of any service implementation. <code class="docutils literal"><span class="pre">Resource</span></code> objects correspond to the
resources each service&#8217;s REST API works with, so the
<a class="reference internal" href="../users/resources/compute/v2/server.html#openstack.compute.v2.server.Server" title="openstack.compute.v2.server.Server"><code class="xref py py-class docutils literal"><span class="pre">openstack.compute.v2.server.Server</span></code></a> subclass maps to the compute
service&#8217;s <code class="docutils literal"><span class="pre">https://openstack:1234/v2/servers</span></code> resource.</p>
<p>The base <code class="docutils literal"><span class="pre">Resource</span></code> contains methods to support the typical
<a class="reference external" href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a>
operations supported by REST APIs, and handles the construction of URLs
and calling the appropriate HTTP verb on the given <code class="docutils literal"><span class="pre">Session</span></code>.</p>
<p>Values sent to or returned from the service are implemented as attributes
on the <code class="docutils literal"><span class="pre">Resource</span></code> subclass with type <a class="reference internal" href="../users/resource.html#openstack.resource.prop" title="openstack.resource.prop"><code class="xref py py-class docutils literal"><span class="pre">openstack.resource.prop</span></code></a>.
The <code class="docutils literal"><span class="pre">prop</span></code> is created with the exact name of what the API expects,
and can optionally include a <code class="docutils literal"><span class="pre">type</span></code> to be validated against on requests.
You should choose an attribute name that follows PEP-8, regardless of what
the server-side expects, as this <code class="docutils literal"><span class="pre">prop</span></code> becomes a mapping between the two.:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">is_public</span> <span class="o">=</span> <span class="n">resource</span><span class="o">.</span><span class="n">prop</span><span class="p">(</span><span class="s1">&#39;os-flavor-access:is_public&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
</pre></div>
</div>
<p>There are six additional attributes which the <code class="docutils literal"><span class="pre">Resource</span></code> class checks
before making requests to the REST API. <code class="docutils literal"><span class="pre">allow_create</span></code>, <code class="docutils literal"><span class="pre">allow_retreive</span></code>,
<code class="docutils literal"><span class="pre">allow_update</span></code>, <code class="docutils literal"><span class="pre">allow_delete</span></code>, <code class="docutils literal"><span class="pre">allow_head</span></code>, and <code class="docutils literal"><span class="pre">allow_list</span></code> are set
to <code class="docutils literal"><span class="pre">True</span></code> or <code class="docutils literal"><span class="pre">False</span></code>, and are checked before making the corresponding
method call.</p>
<p>The <code class="docutils literal"><span class="pre">base_path</span></code> attribute should be set to the URL which corresponds to
this resource. Many <code class="docutils literal"><span class="pre">base_path</span></code>s are simple, such as <code class="docutils literal"><span class="pre">&quot;/servers&quot;</span></code>.
For <code class="docutils literal"><span class="pre">base_path</span></code>s which are composed of non-static information, Python&#8217;s
string replacement is used, e.g., <code class="docutils literal"><span class="pre">base_path</span> <span class="pre">=</span> <span class="pre">&quot;/servers/%(server_id)s/ips&quot;</span></code>.</p>
<p><code class="docutils literal"><span class="pre">resource_key</span></code> and <code class="docutils literal"><span class="pre">resources_key</span></code> are attributes to set when a
<code class="docutils literal"><span class="pre">Resource</span></code> returns more than one item in a response, or otherwise
requires a key to obtain the response value. For example, the <code class="docutils literal"><span class="pre">Server</span></code>
class sets <code class="docutils literal"><span class="pre">resource_key</span> <span class="pre">=</span> <span class="pre">&quot;server&quot;</span></code> as an individual <code class="docutils literal"><span class="pre">Server</span></code> is
stored in a dictionary keyed with the singular noun,
and <code class="docutils literal"><span class="pre">resource_keys</span> <span class="pre">=</span> <span class="pre">&quot;servers&quot;</span></code> as multiple <code class="docutils literal"><span class="pre">Server</span></code>s are stored in
a dictionary keyed with the plural noun in the response.</p>
</div>
<div class="section" id="proxy">
<h2>Proxy<a class="headerlink" href="#proxy" title="Permalink to this headline"></a></h2>
<p>Each service implements a <code class="docutils literal"><span class="pre">Proxy</span></code> class, within the
<code class="docutils literal"><span class="pre">openstack/&lt;program_name&gt;/vX/_proxy.py</span></code> module. For example, the v2 compute
service&#8217;s <code class="docutils literal"><span class="pre">Proxy</span></code> exists in <code class="docutils literal"><span class="pre">openstack/compute/v2/_proxy.py</span></code>.</p>
<p>This <code class="docutils literal"><span class="pre">Proxy</span></code> class manages a <code class="xref py py-class docutils literal"><span class="pre">Session</span></code> and
provides a higher-level interface for users to work with via a
<a class="reference internal" href="../users/connection.html#openstack.connection.Connection" title="openstack.connection.Connection"><code class="xref py py-class docutils literal"><span class="pre">Connection</span></code></a> instance. Rather than requiring
users to maintain their own session and work with lower-level
<a class="reference internal" href="../users/resource.html#openstack.resource.Resource" title="openstack.resource.Resource"><code class="xref py py-class docutils literal"><span class="pre">Resource</span></code></a> objects, the <code class="docutils literal"><span class="pre">Proxy</span></code> interface
offers a place to make things easier for the caller.</p>
<p>Each <code class="docutils literal"><span class="pre">Proxy</span></code> class implements methods which act on the underlying
<code class="docutils literal"><span class="pre">Resource</span></code> classes which represent the service. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">list_flavors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">params</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">flavor</span><span class="o">.</span><span class="n">Flavor</span><span class="o">.</span><span class="n">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="p">,</span> <span class="o">**</span><span class="n">params</span><span class="p">)</span>
</pre></div>
</div>
<p>This method is operating on the <code class="docutils literal"><span class="pre">openstack.compute.v2.flavor.Flavor.list</span></code>
method. For the time being, it simply passes on the <code class="docutils literal"><span class="pre">Session</span></code> maintained
by the <code class="docutils literal"><span class="pre">Proxy</span></code>, and returns what the underlying <code class="docutils literal"><span class="pre">Resource.list</span></code> method
does.</p>
<p>The implementations and method signatures of <code class="docutils literal"><span class="pre">Proxy</span></code> methods are currently
under construction, as we figure out the best way to implement them in a
way which will apply nicely across all of the services.</p>
</div>
<div class="section" id="connection">
<h2>Connection<a class="headerlink" href="#connection" title="Permalink to this headline"></a></h2>
<p>The <a class="reference internal" href="../users/connection.html#openstack.connection.Connection" title="openstack.connection.Connection"><code class="xref py py-class docutils literal"><span class="pre">openstack.connection.Connection</span></code></a> class builds atop a <code class="docutils literal"><span class="pre">Session</span></code>
object, and provides a higher level interface constructed of <code class="docutils literal"><span class="pre">Proxy</span></code>
objects from each of the services.</p>
<p>The <code class="docutils literal"><span class="pre">Connection</span></code> class&#8217; primary purpose is to act as a high-level interface
to this SDK, managing the lower level connecton bits and exposing the
<code class="docutils literal"><span class="pre">Resource</span></code> objects through their corresponding <a class="reference internal" href="#proxy">Proxy</a> object.</p>
<p>If you&#8217;ve built proper <code class="docutils literal"><span class="pre">Resource</span></code> objects and implemented methods on the
corresponding <code class="docutils literal"><span class="pre">Proxy</span></code> object, the high-level interface to your service
should now be exposed.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">How the SDK is organized</a><ul>
<li><a class="reference internal" href="#session">Session</a></li>
<li><a class="reference internal" href="#resource">Resource</a></li>
<li><a class="reference internal" href="#proxy">Proxy</a></li>
<li><a class="reference internal" href="#connection">Connection</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="testing.html"
                        title="previous chapter">Testing</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="create/resource.html"
                        title="next chapter">Creating a New Resource</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/contributors/layout.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="create/resource.html" title="Creating a New Resource"
             >next</a> |</li>
        <li class="right" >
          <a href="testing.html" title="Testing"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">python-openstacksdk 1.0 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >Contributing to the OpenStack SDK</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2016, OpenStack Foundation.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.
    </div>
  </body>
</html>