Search in sources :

Example 1 with LastOperation

use of org.cloudfoundry.client.v2.serviceinstances.LastOperation 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();
}
Also used : UnionServiceInstanceEntity(org.cloudfoundry.client.v2.serviceinstances.UnionServiceInstanceEntity) LastOperation(org.cloudfoundry.client.v2.serviceinstances.LastOperation)

Aggregations

LastOperation (org.cloudfoundry.client.v2.serviceinstances.LastOperation)1 UnionServiceInstanceEntity (org.cloudfoundry.client.v2.serviceinstances.UnionServiceInstanceEntity)1