this.instanceId = instanceId;
}
@Override
public InstanceStatus call() throws Exception {
DescribeInstanceStatusResult statusResult = this.ec2Client
.describeInstanceStatus(new DescribeInstanceStatusRequest()
.withInstanceIds(this.instanceId));
if (statusResult.getInstanceStatuses().isEmpty()) {
throw new NotFoundException(
format("DescribeInstanceStatus did not return any health status for %s",
this.instanceId));
}
return getOnlyElement(statusResult.getInstanceStatuses());
}