Sha256: 587fa9a5b98fbbed713ddaa4fe4626c7b378c73cee5ee68149e8dbd26116a7d7
Contents?: true
Size: 1.31 KB
Versions: 23
Compression:
Stored size: 1.31 KB
Contents
module Fog module Vsphere class Compute class Real def list_rules(filters = {}) cluster = get_raw_cluster(filters[:cluster], filters[:datacenter]) cluster.configurationEx.rule.map { |r| rule_attributes r, filters } end protected def rule_attributes(rule, filters) attributes = {} attributes[:datacenter] = filters[:datacenter] attributes[:cluster] = filters[:cluster] attributes[:key] = rule[:key] attributes[:name] = rule[:name] attributes[:enabled] = rule[:enabled] attributes[:type] = rule.class if rule.class.to_s == 'ClusterAntiAffinityRuleSpec' || rule.class.to_s == 'ClusterAffinityRuleSpec' attributes[:vm_ids] = rule[:vm].map { |vm| vm.config.instanceUuid } elsif rule.class.to_s == 'ClusterVmHostRuleInfo' attributes[:mandatory] = rule[:mandatory] attributes[:vmGroupName] = rule[:vmGroupName] attributes[:affineHostGroupName] = rule[:affineHostGroupName] end attributes end end class Mock def list_rules(filters = {}) data[:rules].values.select { |r| r[:datacenter] == filters[:datacenter] && r[:cluster] == filters[:cluster] } end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems