use of org.eclipse.che.api.core.rest.shared.dto.LinkParameter in project che by eclipse.
the class MachineLinksInjector method injectLinks.
public MachineDto injectLinks(MachineDto machine, ServiceContext serviceContext) {
final List<Link> links = new ArrayList<>();
injectTerminalLink(machine, serviceContext, links);
injectExecAgentLink(machine, serviceContext, links);
// add workspace channel links
final Link workspaceChannelLink = createLink("GET", serviceContext.getBaseUriBuilder().path("ws").scheme("https".equals(serviceContext.getBaseUriBuilder().build().getScheme()) ? "wss" : "ws").build().toString(), null);
final LinkParameter channelParameter = newDto(LinkParameter.class).withName("channel").withRequired(true);
links.add(cloneDto(workspaceChannelLink).withRel(LINK_REL_ENVIRONMENT_OUTPUT_CHANNEL).withParameters(singletonList(cloneDto(channelParameter).withDefaultValue(format(ENVIRONMENT_OUTPUT_CHANNEL_TEMPLATE, machine.getWorkspaceId())))));
links.add(cloneDto(workspaceChannelLink).withRel(ENVIRONMENT_STATUS_CHANNEL_TEMPLATE).withParameters(singletonList(cloneDto(channelParameter).withDefaultValue(format(ENVIRONMENT_STATUS_CHANNEL_TEMPLATE, machine.getWorkspaceId())))));
return machine.withLinks(links);
}
Aggregations