All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.client.lib.adapters.RawCloudRoute Maven / Gradle / Ivy

The newest version!
package org.cloudfoundry.client.lib.adapters;

import java.util.List;

import org.cloudfoundry.client.lib.domain.CloudDomain;
import org.cloudfoundry.client.lib.domain.CloudRoute;
import org.cloudfoundry.client.lib.domain.Derivable;
import org.cloudfoundry.client.lib.domain.ImmutableCloudRoute;
import org.cloudfoundry.client.v2.Resource;
import org.cloudfoundry.client.v2.routemappings.RouteMappingEntity;
import org.cloudfoundry.client.v2.routes.RouteEntity;
import org.immutables.value.Value;

@Value.Immutable
public abstract class RawCloudRoute extends RawCloudEntity {

    public abstract Resource getResource();

    public abstract List> getRouteMappingResources();

    public abstract Derivable getDomain();

    @Override
    public CloudRoute derive() {
        Resource resource = getResource();
        RouteEntity entity = resource.getEntity();
        return ImmutableCloudRoute.builder()
                                  .metadata(parseResourceMetadata(resource))
                                  .appsUsingRoute(getRouteMappingResources().size())
                                  .host(entity.getHost())
                                  .domain(getDomain().derive())
                                  .hasServiceUsingRoute(entity.getServiceInstanceId() != null)
                                  .build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy