use of org.cloudfoundry.client.v2.serviceinstances.UnionServiceInstanceEntity in project cf-java-client by cloudfoundry.
the class DefaultServices method toServiceInstance.
private static ServiceInstance toServiceInstance(UnionServiceInstanceResource resource, Optional<String> plan, List<String> applications, ServiceEntity serviceEntity) {
String extra = Optional.ofNullable(serviceEntity.getExtra()).orElse("");
Optional<String> documentationUrl = Optional.ofNullable(getExtraValue(extra, "documentationUrl"));
UnionServiceInstanceEntity serviceInstanceEntity = resource.getEntity();
LastOperation lastOperation = Optional.ofNullable(serviceInstanceEntity.getLastOperation()).orElse(LastOperation.builder().build());
return ServiceInstance.builder().applications(applications).dashboardUrl(serviceInstanceEntity.getDashboardUrl()).description(serviceEntity.getDescription()).documentationUrl(documentationUrl.orElse(null)).id(ResourceUtils.getId(resource)).lastOperation(lastOperation.getType()).message(lastOperation.getDescription()).name(serviceInstanceEntity.getName()).plan(plan.orElse(null)).service(serviceEntity.getLabel()).startedAt(lastOperation.getCreatedAt()).status(lastOperation.getState()).tags(serviceInstanceEntity.getTags()).type(ServiceInstanceType.from(serviceInstanceEntity.getType())).updatedAt(lastOperation.getUpdatedAt()).build();
}
Aggregations