mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Refactoring the delete vlan ip range cmd
This commit is contained in:
parent
5a8313cc51
commit
c2f517fa81
@ -18,29 +18,18 @@
|
|||||||
|
|
||||||
package com.cloud.api.commands;
|
package com.cloud.api.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.api.BaseCmd;
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.api.Implementation;
|
||||||
import com.cloud.api.Parameter;
|
import com.cloud.api.Parameter;
|
||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.BaseCmd.Manager;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
|
||||||
import com.cloud.user.User;
|
|
||||||
import com.cloud.utils.Pair;
|
|
||||||
|
|
||||||
|
@Implementation(method="deleteVlanIpRange", manager=Manager.ConfigManager)
|
||||||
public class DeleteVlanIpRangeCmd extends BaseCmd {
|
public class DeleteVlanIpRangeCmd extends BaseCmd {
|
||||||
public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
|
public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName());
|
||||||
|
|
||||||
private static final String s_name = "deletevlaniprangeresponse";
|
private static final String s_name = "deletevlaniprangeresponse";
|
||||||
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.ID, Boolean.TRUE));
|
|
||||||
s_properties.add(new Pair<Enum, Boolean>(BaseCmd.Properties.USER_ID, Boolean.FALSE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
//////////////// API parameters /////////////////////
|
//////////////// API parameters /////////////////////
|
||||||
@ -66,30 +55,34 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return s_name;
|
return s_name;
|
||||||
}
|
}
|
||||||
public List<Pair<Enum, Boolean>> getProperties() {
|
|
||||||
return s_properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
public String getResponse() {
|
||||||
Long vlanDbId = (Long) params.get(BaseCmd.Properties.ID.getName());
|
// TODO Auto-generated method stub
|
||||||
Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
return null;
|
||||||
|
|
||||||
if (userId == null) {
|
|
||||||
userId = Long.valueOf(User.UID_SYSTEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the VLAN and its public IP addresses
|
// @Override
|
||||||
boolean success = false;
|
// public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
try {
|
// Long vlanDbId = (Long) params.get(BaseCmd.Properties.ID.getName());
|
||||||
success = getManagementServer().deleteVlanAndPublicIpRange(userId, vlanDbId);
|
// Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName());
|
||||||
} catch (InvalidParameterValueException ex) {
|
//
|
||||||
s_logger.error("Exception deleting VLAN", ex);
|
// if (userId == null) {
|
||||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VLAN: " + ex.getMessage());
|
// userId = Long.valueOf(User.UID_SYSTEM);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
// // Delete the VLAN and its public IP addresses
|
||||||
returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), success));
|
// boolean success = false;
|
||||||
return returnValues;
|
// try {
|
||||||
}
|
// success = getManagementServer().deleteVlanAndPublicIpRange(userId, vlanDbId);
|
||||||
|
// } catch (InvalidParameterValueException ex) {
|
||||||
|
// s_logger.error("Exception deleting VLAN", ex);
|
||||||
|
// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VLAN: " + ex.getMessage());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<Pair<String, Object>> returnValues = new ArrayList<Pair<String, Object>>();
|
||||||
|
// returnValues.add(new Pair<String, Object>(BaseCmd.Properties.SUCCESS.getName(), success));
|
||||||
|
// return returnValues;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import com.cloud.api.commands.CreateServiceOfferingCmd;
|
|||||||
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
||||||
import com.cloud.api.commands.DeletePodCmd;
|
import com.cloud.api.commands.DeletePodCmd;
|
||||||
import com.cloud.api.commands.DeleteServiceOfferingCmd;
|
import com.cloud.api.commands.DeleteServiceOfferingCmd;
|
||||||
|
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
|
||||||
import com.cloud.api.commands.UpdateCfgCmd;
|
import com.cloud.api.commands.UpdateCfgCmd;
|
||||||
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
||||||
import com.cloud.api.commands.UpdatePodCmd;
|
import com.cloud.api.commands.UpdatePodCmd;
|
||||||
@ -232,6 +233,7 @@ public interface ConfigurationManager extends Manager {
|
|||||||
* @return success/failure
|
* @return success/failure
|
||||||
*/
|
*/
|
||||||
boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException;
|
boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException;
|
||||||
|
boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds/deletes private IPs
|
* Adds/deletes private IPs
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import com.cloud.api.commands.CreateServiceOfferingCmd;
|
|||||||
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
import com.cloud.api.commands.DeleteDiskOfferingCmd;
|
||||||
import com.cloud.api.commands.DeletePodCmd;
|
import com.cloud.api.commands.DeletePodCmd;
|
||||||
import com.cloud.api.commands.DeleteServiceOfferingCmd;
|
import com.cloud.api.commands.DeleteServiceOfferingCmd;
|
||||||
|
import com.cloud.api.commands.DeleteVlanIpRangeCmd;
|
||||||
import com.cloud.api.commands.UpdateCfgCmd;
|
import com.cloud.api.commands.UpdateCfgCmd;
|
||||||
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
import com.cloud.api.commands.UpdateDiskOfferingCmd;
|
||||||
import com.cloud.api.commands.UpdatePodCmd;
|
import com.cloud.api.commands.UpdatePodCmd;
|
||||||
@ -1925,4 +1926,18 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteVlanAnIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException {
|
||||||
|
|
||||||
|
Long vlanDbId = cmd.getId();
|
||||||
|
Long userId = UserContext.current().getUserId();
|
||||||
|
|
||||||
|
if (userId == null) {
|
||||||
|
userId = Long.valueOf(User.UID_SYSTEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteVlanAndPublicIpRange(userId, vlanDbId);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -468,7 +468,7 @@ public interface ManagementServer {
|
|||||||
* @param vlanDbId
|
* @param vlanDbId
|
||||||
* @return success/failure
|
* @return success/failure
|
||||||
*/
|
*/
|
||||||
boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException;
|
// boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for vlan by the specified search criteria
|
* Searches for vlan by the specified search criteria
|
||||||
|
|||||||
@ -1828,10 +1828,10 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _configMgr.createVlanAndPublicIpRange(userId, vlanType, zoneId, accountId, podId, vlanId, vlanGateway, vlanNetmask, startIP, endIP);
|
return _configMgr.createVlanAndPublicIpRange(userId, vlanType, zoneId, accountId, podId, vlanId, vlanGateway, vlanNetmask, startIP, endIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException {
|
// public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException {
|
||||||
return _configMgr.deleteVlanAndPublicIpRange(userId, vlanDbId);
|
// return _configMgr.deleteVlanAndPublicIpRange(userId, vlanDbId);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException {
|
public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user