use of com.citrix.netscaler.nitro.resource.config.network.Interface in project cloudstack by apache.
the class NetscalerResource method validateInterfaces.
private void validateInterfaces(final String publicInterface, final String privateInterface) throws ExecutionException {
try {
if (!_isSdx && !_cloudManaged) {
final Interface publicIf = Interface.get(_netscalerService, publicInterface);
final Interface privateIf = Interface.get(_netscalerService, privateInterface);
if (publicIf != null || privateIf != null) {
return;
} else {
throw new ExecutionException("Invalid interface name specified for public/private interfaces.");
}
}
} catch (final nitro_exception e) {
if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
throw new ExecutionException("Invalid interface name specified for public and private interfaces.");
} else {
throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
}
} catch (final Exception e) {
throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
}
}
Aggregations