mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-23 01:49:59 -05:00
168 lines
10 KiB
HTML
168 lines
10 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.enum — vSphere Automation SDK for Python 6.5.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.5.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="vSphere Automation SDK for Python 6.5.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">vSphere Automation SDK for Python 6.5.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.enum</h1><div class="highlight"><pre>
|
|
<span class="sd">"""</span>
|
|
<span class="sd">Bindings data classes</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 (c) 2015-2016 VMware, Inc. All rights reserved.'</span>
|
|
|
|
<span class="kn">import</span> <span class="nn">six</span>
|
|
|
|
|
|
<span class="c"># Disabling the pylint complaint about badly implemented container</span>
|
|
<span class="c"># as we don't need __setitem__, __delitem__ and __getitem__</span>
|
|
<div class="viewcode-block" id="Enum"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.enum.Enum">[docs]</a><span class="k">class</span> <span class="nc">Enum</span><span class="p">(</span><span class="n">six</span><span class="o">.</span><span class="n">text_type</span><span class="p">):</span> <span class="c"># pylint: disable=R0924</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Representation of IDL Enum in python language bindings</span>
|
|
<span class="sd"> """</span>
|
|
<span class="n">_binding_type</span> <span class="o">=</span> <span class="bp">None</span>
|
|
<span class="n">_values</span> <span class="o">=</span> <span class="p">[]</span>
|
|
|
|
<span class="nd">@classmethod</span>
|
|
<span class="k">def</span> <span class="nf">_set_binding_type</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">binding_type</span><span class="p">):</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Set the underlying BindingType for this VapiStruct.</span>
|
|
|
|
<span class="sd"> :type binding_type: :class:`vmware.vapi.data.value.BindingType`</span>
|
|
<span class="sd"> :param binding_type: BindingType for this VapiStruct</span>
|
|
<span class="sd"> """</span>
|
|
<span class="n">cls</span><span class="o">.</span><span class="n">_binding_type</span> <span class="o">=</span> <span class="n">binding_type</span>
|
|
|
|
<span class="nd">@classmethod</span>
|
|
<div class="viewcode-block" id="Enum.get_binding_type"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.enum.Enum.get_binding_type">[docs]</a> <span class="k">def</span> <span class="nf">get_binding_type</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Returns the corresponding BindingType for the VapiStruct class</span>
|
|
|
|
<span class="sd"> :rtype: :class:`vmware.vapi.data.value.BindingType` or ``None``</span>
|
|
<span class="sd"> :return: BindingType for this VapiStruct</span>
|
|
<span class="sd"> """</span>
|
|
<span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_binding_type</span>
|
|
</div>
|
|
<span class="nd">@classmethod</span>
|
|
<div class="viewcode-block" id="Enum.get_values"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.enum.Enum.get_values">[docs]</a> <span class="k">def</span> <span class="nf">get_values</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Returns the list of all the possible enum values</span>
|
|
|
|
<span class="sd"> :rtype: :class:`list` of :class:`vmware.vapi.bindings.enum.Enum`</span>
|
|
<span class="sd"> :return: List of all possible enum values</span>
|
|
<span class="sd"> """</span>
|
|
<span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">_values</span>
|
|
</div>
|
|
<span class="nd">@classmethod</span>
|
|
<span class="k">def</span> <span class="nf">_set_values</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Set the list of the enum values and assign them to respective class</span>
|
|
<span class="sd"> attributes</span>
|
|
|
|
<span class="sd"> :type :class:`list` of :class:`vmware.vapi.bindings.enum.Enum`</span>
|
|
<span class="sd"> :param List of all possible enum values</span>
|
|
<span class="sd"> """</span>
|
|
<span class="n">cls</span><span class="o">.</span><span class="n">_values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>
|
|
<span class="k">for</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">cls</span><span class="o">.</span><span class="n">_values</span><span class="p">:</span>
|
|
<span class="nb">setattr</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="n">val</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
|
|
|
|
<div class="viewcode-block" id="Enum.is_unknown"><a class="viewcode-back" href="../../../../vmware.vapi.bindings.html#vmware.vapi.bindings.enum.Enum.is_unknown">[docs]</a> <span class="k">def</span> <span class="nf">is_unknown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
|
<span class="sd">"""</span>
|
|
<span class="sd"> Returns whether the enum value stored is one of the known values or not</span>
|
|
|
|
<span class="sd"> :rtype: :class:`bool`</span>
|
|
<span class="sd"> :return: True if the enum value is not known</span>
|
|
<span class="sd"> """</span>
|
|
<span class="k">return</span> <span class="ow">not</span> <span class="p">(</span><span class="bp">self</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_values</span><span class="p">)</span>
|
|
</div>
|
|
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
|
<span class="n">class_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
|
|
<span class="k">return</span> <span class="s">'</span><span class="si">%s</span><span class="s">(string=</span><span class="si">%s</span><span class="s">)'</span> <span class="o">%</span> <span class="p">(</span><span class="n">class_name</span><span class="p">,</span> <span class="n">six</span><span class="o">.</span><span class="n">text_type</span><span class="o">.</span><span class="n">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></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">vSphere Automation SDK for Python 6.5.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> |