public AgentStatusRepresentation create(AgentStatus status) {
Builder<SlotStatusRepresentation> builder = ImmutableList.builder();
for (SlotStatus slot : status.getSlotStatuses()) {
builder.add(SlotStatusRepresentation.from(slot, Integer.MAX_VALUE, repository));
}
return new AgentStatusRepresentation(
status.getAgentId(),
safeTruncate(status.getAgentId(), shortIdPrefixSize),
status.getInstanceId(),
status.getState(),
status.getInternalUri(),
status.getExternalUri(),
status.getLocation(),
trimLeadingSegments(status.getLocation(), '/', commonLocationParts),
status.getInstanceType(),
builder.build(),
status.getResources(),
status.getVersion());
}
}