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.7.0.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.1.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.1.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.0.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-2.0.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.13.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.13.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.12.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.11.3 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.11.2 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.11.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.11.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.10.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.9.2 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.9.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.9.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.8.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.7.1 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.7.0 lib/fog/vsphere/requests/compute/destroy_group.rb
fog-vsphere-1.6.0 lib/fog/vsphere/requests/compute/destroy_group.rb