Sha256: 460bdde4e3fc4afb6e43cb7a4a18bddbce1aa1b0ec25678fa4087509bbae02a3

Contents?: true

Size: 1018 Bytes

Versions: 28

Compression:

Stored size: 1018 Bytes

Contents

module Fog
  module Compute
    class Vsphere
      class Real
        def destroy_group(attributes = {})
          cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
          group   = cluster.configurationEx.group.find {|g| g.name == attributes[:name]}
          raise Fog::Vsphere::Error::NotFound, "group #{attributes[:name]} not found" unless group
          delete_spec = RbVmomi::VIM.ClusterConfigSpecEx(groupSpec: [
            RbVmomi::VIM.ClusterGroupSpec(
              operation: RbVmomi::VIM.ArrayUpdateOperation('remove'),
              removeKey: group.name
            )
          ])
          cluster.ReconfigureComputeResource_Task(spec: delete_spec, modify: true).wait_for_completion
        end
      end
      class Mock
        def destroy_group(attributes = {})
          group = self.data[:groups][attributes[:name]]
          raise Fog::Vsphere::Error::NotFound unless group
          self.data[:groups].delete(attributes[:name])
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
fog-vsphere-1.5.2 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.5.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.5.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.4.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.3.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.2.2 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.2.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.2.0 lib/fog/vsphere/requests/compute/destroy_group.rb