use of net.nuage.vsp.acs.client.exception.NuageVspException in project cloudstack by apache.
the class NuageVspCommandWrapper method execute.
@Override
public final Answer execute(final T command, final NuageVspResource nuageVspResource) {
try {
boolean success = executeNuageVspCommand(command, nuageVspResource);
String detail = fillDetail(new StringBuilder(), command).append(" on ").append(nuageVspResource.getName()).toString();
return new Answer(command, success, detail);
} catch (NuageVspException | ConfigurationException e) {
s_logger.error("Failure during " + command + " on " + nuageVspResource.getName(), e);
return new Answer(command, e);
}
}
use of net.nuage.vsp.acs.client.exception.NuageVspException in project cloudstack by apache.
the class NuageVspSyncCmsIdCommandWrapper method execute.
@Override
public SyncNuageVspCmsIdAnswer execute(SyncNuageVspCmsIdCommand cmd, NuageVspResource nuageVspResource) {
NuageVspManagerClient client = null;
try {
client = nuageVspResource.getNuageVspManagerClient();
Pair<Boolean, String> answer;
switch(cmd.getSyncType()) {
case REGISTER:
String registeredNuageVspCmsId = client.registerNuageVspCmsId();
answer = Pair.of(StringUtils.isNotBlank(registeredNuageVspCmsId), registeredNuageVspCmsId);
break;
case UNREGISTER:
boolean success = client.unregisterNuageVspCmsId(cmd.getNuageVspCmsId());
answer = Pair.of(success, cmd.getNuageVspCmsId());
break;
default:
answer = client.auditNuageVspCmsId(cmd.getNuageVspCmsId(), cmd.getSyncType() == SyncNuageVspCmsIdCommand.SyncType.AUDIT_ONLY);
break;
}
return new SyncNuageVspCmsIdAnswer(answer.getLeft(), answer.getRight(), cmd.getSyncType());
} catch (ConfigurationException | NuageVspException e) {
return new SyncNuageVspCmsIdAnswer(cmd, e, cmd.getSyncType());
}
}
Aggregations