Sha256: d5c7bbcb4fe6f0774dd9c711f658ef7a3d179a923e2a86195060e6e854337892
Contents?: true
Size: 1.17 KB
Versions: 29
Compression:
Stored size: 1.17 KB
Contents
module Fog module Compute class Vsphere # ClusterRuleInfo class Rule < Fog::Model identity :key attribute :datacenter attribute :cluster attribute :name attribute :enabled # Type should be a class - either # - RbVmomi::VIM::ClusterAntiAffinityRuleSpec # - RbVmomi::VIM::ClusterAffinityRuleSpec # - RbVmomi::VIM::ClusterVmHostRuleInfo attribute :type attribute :vm_ids def vms vm_ids.map {|id| service.servers.get(id, datacenter) } end def vms=(vms) self.vm_ids = vms.map(&:instance_uuid) end def save requires :datacenter, :cluster, :name, :enabled, :type, :vm_ids if vm_ids.length < 2 raise ArgumentError, "A rule must have at least 2 VMs" end if persisted? raise "Update is not supported yet" else self.key = service.create_rule(attributes) end reload end def destroy service.destroy_rule(attributes) end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems