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());
}
}
}
Aggregations