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

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

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

import org.cloudfoundry.client.lib.domain.CloudServiceInstance;
import org.cloudfoundry.client.lib.domain.CloudServiceKey;
import org.cloudfoundry.client.lib.domain.Derivable;
import org.cloudfoundry.client.lib.domain.ImmutableCloudServiceKey;
import org.cloudfoundry.client.v2.Resource;
import org.cloudfoundry.client.v2.servicekeys.ServiceKeyEntity;
import org.immutables.value.Value;

@Value.Immutable
public abstract class RawCloudServiceKey extends RawCloudEntity {

    public abstract Resource getResource();

    public abstract Derivable getServiceInstance();

    @Override
    public CloudServiceKey derive() {
        Resource resource = getResource();
        ServiceKeyEntity entity = resource.getEntity();
        return ImmutableCloudServiceKey.builder()
                                       .metadata(parseResourceMetadata(resource))
                                       .name(entity.getName())
                                       .serviceInstance(getServiceInstance().derive())
                                       .credentials(entity.getCredentials())
                                       .build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy