Sha256: 66a518269e1a6b525ae0698bd81dc9e4a7590bc53822a1e4739e9d21c2079ac6
Contents?: true
Size: 1.02 KB
Versions: 23
Compression:
Stored size: 1.02 KB
Contents
module Fog module Vsphere class Compute class Real def list_groups(filters = {}) cluster = get_raw_cluster(filters[:cluster], filters[:datacenter]) cluster.configurationEx.group.map { |g| group_attributes g, filters } end protected def group_attributes(group, filters) attributes = {} attributes[:datacenter] = filters[:datacenter] attributes[:cluster] = filters[:cluster] attributes[:name] = group[:name] attributes[:type] = group.class if group.class.to_s == 'ClusterVmGroup' then attributes[:vm_ids] = group[:vm].map { |vm| vm.config.instanceUuid } end if group.class.to_s == 'ClusterHostGroup' then attributes[:hosts] = group[:host].map(&:name) end attributes end end class Mock def list_groups(filters = {}) data[:groups].values.select { |g| g[:datacenter] == filters[:datacenter] && g[:cluster] == filters[:cluster] } end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems