use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.
the class UpdateTrafficTypeCmd method execute.
@Override
public void execute() {
PhysicalNetworkTrafficType result = _networkService.updatePhysicalNetworkTrafficType(getId(), getXenLabel(), getKvmLabel(), getVmwareLabel());
if (result != null) {
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
}
}
use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.
the class ListTrafficTypesCmd method execute.
@Override
public void execute() {
List<? extends PhysicalNetworkTrafficType> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
for (PhysicalNetworkTrafficType trafficType : trafficTypes) {
TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
trafficTypesResponses.add(trafficTypeResponse);
}
response.setResponses(trafficTypesResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.network.PhysicalNetworkTrafficType in project CloudStack-archive by CloudStack-extras.
the class AddTrafficTypeCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("TrafficType Id: " + getEntityId());
PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId());
if (result != null) {
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
use of com.cloud.network.PhysicalNetworkTrafficType in project cloudstack by apache.
the class ListTrafficTypesCmd method execute.
@Override
public void execute() {
Pair<List<? extends PhysicalNetworkTrafficType>, Integer> trafficTypes = _networkService.listTrafficTypes(getPhysicalNetworkId());
ListResponse<TrafficTypeResponse> response = new ListResponse<TrafficTypeResponse>();
List<TrafficTypeResponse> trafficTypesResponses = new ArrayList<TrafficTypeResponse>();
if (trafficTypes != null) {
for (PhysicalNetworkTrafficType trafficType : trafficTypes.first()) {
TrafficTypeResponse trafficTypeResponse = _responseGenerator.createTrafficTypeResponse(trafficType);
trafficTypesResponses.add(trafficTypeResponse);
}
response.setResponses(trafficTypesResponses, trafficTypes.second());
response.setResponseName(getCommandName());
}
this.setResponseObject(response);
}
use of com.cloud.network.PhysicalNetworkTrafficType in project cloudstack by apache.
the class AddTrafficTypeCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("TrafficType Id: " + getEntityId());
PhysicalNetworkTrafficType result = _networkService.getPhysicalNetworkTrafficType(getEntityId());
if (result != null) {
TrafficTypeResponse response = _responseGenerator.createTrafficTypeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
Aggregations