use of com.amazonaws.services.ec2.model.GetConsoleOutputResult in project cloudbreak by hortonworks.
the class AwsInstanceConnector method getConsoleOutput.
@Override
public String getConsoleOutput(AuthenticatedContext authenticatedContext, CloudInstance vm) {
if (!verifyHostKey) {
throw new CloudOperationNotSupportedException("Host key verification is disabled on AWS");
}
AmazonEC2Client amazonEC2Client = awsClient.createAccess(new AwsCredentialView(authenticatedContext.getCloudCredential()), authenticatedContext.getCloudContext().getLocation().getRegion().value());
GetConsoleOutputRequest getConsoleOutputRequest = new GetConsoleOutputRequest().withInstanceId(vm.getInstanceId());
GetConsoleOutputResult getConsoleOutputResult = amazonEC2Client.getConsoleOutput(getConsoleOutputRequest);
try {
return getConsoleOutputResult.getOutput() == null ? "" : getConsoleOutputResult.getDecodedOutput();
} catch (Exception ex) {
LOGGER.debug(ex.getMessage(), ex);
return "";
}
}
Aggregations