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

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

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

import org.cloudfoundry.client.lib.domain.CloudOrganization;
import org.cloudfoundry.client.lib.domain.CloudSpace;
import org.cloudfoundry.client.lib.domain.Derivable;
import org.cloudfoundry.client.lib.domain.ImmutableCloudSpace;
import org.cloudfoundry.client.lib.domain.annotation.Nullable;
import org.cloudfoundry.client.v2.Resource;
import org.cloudfoundry.client.v2.spaces.SpaceEntity;
import org.immutables.value.Value;

@Value.Immutable
public abstract class RawCloudSpace extends RawCloudEntity {

    @Value.Parameter
    public abstract Resource getResource();

    @Nullable
    public abstract Derivable getOrganization();

    @Override
    public CloudSpace derive() {
        Resource resource = getResource();
        SpaceEntity entity = resource.getEntity();
        return ImmutableCloudSpace.builder()
                                  .metadata(parseResourceMetadata(resource))
                                  .name(entity.getName())
                                  .organization(deriveFromNullable(getOrganization()))
                                  .build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy