Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 4b137326f38b5adf1f9ffd3dbbb48a7b > files > 521

deltacloud-core-doc-0.4.0-4.fc15.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>realms (Deltacloud::Drivers::VSphere::VSphereDriver)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/deltacloud/drivers/vsphere/vsphere_driver.rb, line 120</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">realms</span>(<span class="ruby-identifier">credentials</span>, <span class="ruby-identifier">opts</span>=<span class="ruby-keyword kw">nil</span>)
      <span class="ruby-identifier">vsphere</span> = <span class="ruby-identifier">new_client</span>(<span class="ruby-identifier">credentials</span>)
      <span class="ruby-identifier">safely</span> <span class="ruby-keyword kw">do</span>
        <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opts</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:id</span>]
          <span class="ruby-identifier">datastore</span> = <span class="ruby-identifier">find_datastore</span>(<span class="ruby-identifier">credentials</span>, <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:id</span>])
          [<span class="ruby-identifier">convert_realm</span>(<span class="ruby-identifier">datastore</span>)]
        <span class="ruby-keyword kw">else</span>
          <span class="ruby-identifier">rootFolder</span> = <span class="ruby-identifier">vsphere</span>.<span class="ruby-identifier">serviceInstance</span>.<span class="ruby-identifier">content</span>.<span class="ruby-identifier">rootFolder</span>
          <span class="ruby-identifier">rootFolder</span>.<span class="ruby-identifier">childEntity</span>.<span class="ruby-identifier">grep</span>(<span class="ruby-constant">RbVmomi</span><span class="ruby-operator">::</span><span class="ruby-constant">VIM</span><span class="ruby-operator">::</span><span class="ruby-constant">Datacenter</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dc</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">dc</span>.<span class="ruby-identifier">datastoreFolder</span>.<span class="ruby-identifier">childEntity</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">datastore</span><span class="ruby-operator">|</span> <span class="ruby-identifier">convert_realm</span>(<span class="ruby-identifier">datastore</span>) }
          <span class="ruby-keyword kw">end</span>.<span class="ruby-identifier">flatten</span>
        <span class="ruby-keyword kw">end</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span></pre>
</body>
</html>