Class: RbVmomi::VIM::Datacenter
- Inherits:
-
Object
- Object
- RbVmomi::VIM::Datacenter
- Defined in:
- lib/rvc/extensions/Datacenter.rb,
lib/rvc/modules/spbm.rb
Overview
Copyright © 2011 VMware, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Class Method Summary collapse
Instance Method Summary collapse
- #children ⇒ Object
- #ls_text(r) ⇒ Object
- #rvc_children_profiles ⇒ Object
- #rvc_children_storage ⇒ Object
- #rvc_list_children_profiles ⇒ Object
-
#traverse_one(arc) ⇒ Object
For compatibility with previous RVC versions.
Class Method Details
.folder? ⇒ Boolean
48 49 50 |
# File 'lib/rvc/extensions/Datacenter.rb', line 48 def self.folder? true end |
Instance Method Details
#children ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rvc/extensions/Datacenter.rb', line 26 def children vmFolder, datastoreFolder, networkFolder, hostFolder = collect *%w(vmFolder datastoreFolder networkFolder hostFolder) { 'vms' => vmFolder, 'datastores' => datastoreFolder, 'networks' => networkFolder, 'computers' => hostFolder, } end |
#ls_text(r) ⇒ Object
22 23 24 |
# File 'lib/rvc/extensions/Datacenter.rb', line 22 def ls_text r " (datacenter)" end |
#rvc_children_profiles ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/rvc/modules/spbm.rb', line 64 def rvc_children_profiles conn = _connection _catch_spbm_resets(conn) do pbm = conn.pbm pm = pbm.serviceContent.profileManager profileIds = pm.PbmQueryProfile( :resourceType => {:resourceType => "STORAGE"}, :profileCategory => "REQUIREMENT" ) if profileIds.length > 0 profiles = pm.PbmRetrieveContent(:profileIds => profileIds) else profiles = [] end Hash[profiles.map do |x| x.instance_variable_set(:@connection, pbm) x.instance_variable_set(:@dc, self) [x.name, x] end] end end |
#rvc_children_storage ⇒ Object
58 59 60 61 62 |
# File 'lib/rvc/modules/spbm.rb', line 58 def rvc_children_storage { 'vmprofiles' => RVC::FakeFolder.new(self, :rvc_children_profiles), } end |
#rvc_list_children_profiles ⇒ Object
52 53 54 55 56 |
# File 'lib/rvc/modules/spbm.rb', line 52 def rvc_list_children_profiles { 'storage' => RVC::FakeFolder.new(self, :rvc_children_storage), } end |
#traverse_one(arc) ⇒ Object
For compatibility with previous RVC versions
38 39 40 41 42 43 44 45 46 |
# File 'lib/rvc/extensions/Datacenter.rb', line 38 def traverse_one arc children = self.rvc_children return children[arc] if children.member? arc if arc == 'vm' then return vmFolder elsif arc == 'datastore' then return datastoreFolder elsif arc == 'network' then return networkFolder elsif arc == 'host' then return hostFolder end end |