Sha256: 133a3f05569e412b59c9b90e70d9a322c57eeb9a992062c2781f16233b4234a5
Contents?: true
Size: 1.12 KB
Versions: 23
Compression:
Stored size: 1.12 KB
Contents
module Fog module Vsphere class Compute # 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
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
fog-vsphere-3.1.1 | lib/fog/vsphere/models/compute/rule.rb |
fog-vsphere-3.1.0 | lib/fog/vsphere/models/compute/rule.rb |
fog-vsphere-3.0.0 | lib/fog/vsphere/models/compute/rule.rb |