mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-29 20:09:58 -05:00
144 lines
8.2 KiB
HTML
144 lines
8.2 KiB
HTML
|
|
||
|
|
||
|
<!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>vmware.vapi.bindings.common — vCloud Suite SDK for Python 6.0.0 documentation</title>
|
||
|
|
||
|
<link rel="stylesheet" href="../../../../_static/vapitheme.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
var DOCUMENTATION_OPTIONS = {
|
||
|
URL_ROOT: '../../../../',
|
||
|
VERSION: '6.0.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="top" title="vCloud Suite SDK for Python 6.0.0 documentation" href="../../../../index.html" />
|
||
|
<link rel="up" title="Module code" href="../../../index.html" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="related">
|
||
|
<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><a href="../../../../index.html">vCloud Suite SDK for Python 6.0.0 documentation</a> »</li>
|
||
|
<li><a href="../../../index.html" accesskey="U">Module code</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<div class="document">
|
||
|
<div class="documentwrapper">
|
||
|
<div class="bodywrapper">
|
||
|
<div class="body">
|
||
|
|
||
|
<h1>Source code for vmware.vapi.bindings.common</h1><div class="highlight"><pre>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd">Bindings common module that contains common code for skeletons and stubs</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="n">__author__</span> <span class="o">=</span> <span class="s">'VMware, Inc.'</span>
|
||
|
<span class="n">__copyright__</span> <span class="o">=</span> <span class="s">'Copyright 2013-2014 VMware, Inc. All rights reserved. -- VMware Confidential'</span>
|
||
|
|
||
|
|
||
|
<span class="kn">from</span> <span class="nn">vmware.vapi.exception</span> <span class="kn">import</span> <span class="n">CoreException</span>
|
||
|
|
||
|
|
||
|
<div class="viewcode-block" id="raise_core_exception"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.common.raise_core_exception">[docs]</a><span class="k">def</span> <span class="nf">raise_core_exception</span><span class="p">(</span><span class="n">msg_list</span><span class="p">):</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd"> Create and raise a CoreException from a list of messages</span>
|
||
|
|
||
|
<span class="sd"> :type msg_list: :class:`vmware.vapi.message.Message`</span>
|
||
|
<span class="sd"> :param msg_list: List of messages</span>
|
||
|
|
||
|
<span class="sd"> :raise: CoreException if msg list is not empty</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">exception</span> <span class="o">=</span> <span class="bp">None</span>
|
||
|
<span class="k">if</span> <span class="n">msg_list</span><span class="p">:</span>
|
||
|
<span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">msg_list</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="n">exception</span><span class="p">:</span>
|
||
|
<span class="n">exception</span> <span class="o">=</span> <span class="n">CoreException</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">cause</span><span class="o">=</span><span class="n">exception</span><span class="p">)</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="n">exception</span> <span class="o">=</span> <span class="n">CoreException</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
|
||
|
<span class="k">if</span> <span class="n">exception</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
|
||
|
<span class="k">raise</span> <span class="n">exception</span> <span class="c"># pylint: disable-msg=E0702</span>
|
||
|
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="NameToTypeResolver"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.common.NameToTypeResolver">[docs]</a><span class="k">class</span> <span class="nc">NameToTypeResolver</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd"> Helper class that resolves a fully qualified canonical type name to a type</span>
|
||
|
<span class="sd"> descriptor. The type name can be a structure name or an error name.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_map</span><span class="p">):</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd"> Initialize NameToTypeResolver</span>
|
||
|
|
||
|
<span class="sd"> :type type_map: :class:`dict` of :class:`str` and :class:`VapiStruct`</span>
|
||
|
<span class="sd"> :param type_map: Type map that contains the canonical names and the</span>
|
||
|
<span class="sd"> references to the binding classes for these types.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="bp">self</span><span class="o">.</span><span class="n">_type_map</span> <span class="o">=</span> <span class="n">type_map</span>
|
||
|
|
||
|
<div class="viewcode-block" id="NameToTypeResolver.resolve"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.common.NameToTypeResolver.resolve">[docs]</a> <span class="k">def</span> <span class="nf">resolve</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
|
||
|
<span class="sd">"""</span>
|
||
|
<span class="sd"> Type name to be resolved</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type_map</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span></div></div>
|
||
|
</pre></div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="sphinxsidebar">
|
||
|
<div class="sphinxsidebarwrapper">
|
||
|
<div id="searchbox" style="display: none">
|
||
|
<h3>Quick search</h3>
|
||
|
<form class="search" action="../../../../search.html" method="get">
|
||
|
<input type="text" name="q" />
|
||
|
<input type="submit" value="Go" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
<p class="searchtip" style="font-size: 90%">
|
||
|
Enter search terms or a module, class or function name.
|
||
|
</p>
|
||
|
</div>
|
||
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearer"></div>
|
||
|
</div>
|
||
|
<div class="related">
|
||
|
<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><a href="../../../../index.html">vCloud Suite SDK for Python 6.0.0 documentation</a> »</li>
|
||
|
<li><a href="../../../index.html" >Module code</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer">
|
||
|
© Copyright 2014, VMware, Inc..
|
||
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|