Search in sources :

Example 21 with ConnectionResources

use of io.cloudslang.content.vmware.connection.ConnectionResources in project cs-actions by CloudSlang.

the class ClusterComputeResourceService method deleteHostGroup.

public Map<String, String> deleteHostGroup(HttpInputs httpInputs, VmInputs vmInputs) throws Exception {
    ConnectionResources connectionResources = new ConnectionResources(httpInputs);
    try {
        ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName());
        ClusterHostGroup clusterHostGroup = new ClusterHostGroup();
        clusterHostGroup.setName(vmInputs.getHostGroupName());
        ClusterGroupSpec clusterGroupSpec = new ClusterGroupSpec();
        clusterGroupSpec.setInfo(clusterHostGroup);
        clusterGroupSpec.setOperation(ArrayUpdateOperation.REMOVE);
        clusterGroupSpec.setRemoveKey(vmInputs.getHostGroupName());
        return reconfigureClusterGroup(vmInputs, connectionResources, clusterMor, clusterGroupSpec);
    } finally {
        if (httpInputs.isCloseSession()) {
            connectionResources.getConnection().disconnect();
            clearConnectionFromContext(httpInputs.getGlobalSessionObject());
        }
    }
}
Also used : ConnectionResources(io.cloudslang.content.vmware.connection.ConnectionResources) MorObjectHandler(io.cloudslang.content.vmware.services.helpers.MorObjectHandler)

Aggregations

ConnectionResources (io.cloudslang.content.vmware.connection.ConnectionResources)21 MorObjectHandler (io.cloudslang.content.vmware.services.helpers.MorObjectHandler)17 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)12 ResponseHelper (io.cloudslang.content.vmware.services.helpers.ResponseHelper)8 VmUtils (io.cloudslang.content.vmware.services.utils.VmUtils)3 VirtualMachineConfigSpec (com.vmware.vim25.VirtualMachineConfigSpec)2 VmConfigSpecs (io.cloudslang.content.vmware.services.utils.VmConfigSpecs)2 CustomizationSpec (com.vmware.vim25.CustomizationSpec)1 DynamicProperty (com.vmware.vim25.DynamicProperty)1 GuestOsDescriptor (com.vmware.vim25.GuestOsDescriptor)1 HttpNfcLeaseDeviceUrl (com.vmware.vim25.HttpNfcLeaseDeviceUrl)1 HttpNfcLeaseInfo (com.vmware.vim25.HttpNfcLeaseInfo)1 ObjectContent (com.vmware.vim25.ObjectContent)1 OvfCreateImportSpecResult (com.vmware.vim25.OvfCreateImportSpecResult)1 VirtualMachineCloneSpec (com.vmware.vim25.VirtualMachineCloneSpec)1 VirtualMachineConfigOption (com.vmware.vim25.VirtualMachineConfigOption)1 VirtualMachineConfigSummary (com.vmware.vim25.VirtualMachineConfigSummary)1 VirtualMachineRelocateSpec (com.vmware.vim25.VirtualMachineRelocateSpec)1 VirtualMachineSummary (com.vmware.vim25.VirtualMachineSummary)1 AsyncProgressUpdater (io.cloudslang.content.vmware.entities.AsyncProgressUpdater)1