use of org.broadinstitute.dsde.workbench.client.sam.model.SystemStatus in project terra-cli by DataBiosphere.
the class Server method ping.
/**
* Ping the service URLs to check their status. Return true if all return OK.
*
* <p>Each of the status checks in this method swallow all exceptions. This means that the CLI
* treats all network or API exceptions when calling "/status" the same as a bad status code.
*/
public boolean ping() {
boolean samUriSpecified = (samUri != null);
SystemStatus samStatus = null;
if (samUriSpecified) {
try {
samStatus = SamService.unauthenticated(this).getStatus();
logger.info("SAM status: {}", samStatus);
} catch (Exception ex) {
logger.error("Error getting SAM status.", ex);
}
}
boolean wsmUriSpecified = (workspaceManagerUri != null);
boolean wsmStatusIsOk = true;
if (wsmUriSpecified) {
try {
WorkspaceManagerService.unauthenticated(this).getStatus();
logger.info("WSM status: {}", wsmStatusIsOk);
} catch (Exception ex) {
logger.error("Error getting WSM status.", ex);
wsmStatusIsOk = false;
}
}
boolean dataRepoUriSpecified = (dataRepoUri != null);
RepositoryStatusModel tdrStatus = null;
if (dataRepoUriSpecified) {
try {
tdrStatus = DataRepoService.unauthenticated(this).getStatus();
logger.info("TDR status: {}", tdrStatus);
} catch (Exception ex) {
logger.error("Error getting TDR status.", ex);
}
}
return (!samUriSpecified || (samStatus != null && samStatus.getOk())) && (!wsmUriSpecified || wsmStatusIsOk) && (!dataRepoUriSpecified || (tdrStatus != null && tdrStatus.isOk()));
}
Aggregations