Search in sources :

Example 6 with ResourceBasicView

use of com.sequenceiq.cloudbreak.common.dal.ResourceBasicView in project cloudbreak by hortonworks.

the class DatalakeService method addSharedServiceResponse.

public void addSharedServiceResponse(ClusterApiView cluster, ClusterViewV4Response clusterResponse) {
    SharedServiceV4Response sharedServiceResponse = new SharedServiceV4Response();
    if (cluster.getStack().getDatalakeCrn() != null) {
        LOGGER.debug("Add shared service response by datalakeCrn");
        Optional<ResourceBasicView> datalakeStack = stackService.getResourceBasicViewByResourceCrn(cluster.getStack().getDatalakeCrn());
        datalakeStack.ifPresent(s -> {
            sharedServiceResponse.setSharedClusterId(s.getId());
            sharedServiceResponse.setSharedClusterName(s.getName());
        });
    }
    clusterResponse.setSharedServiceResponse(sharedServiceResponse);
}
Also used : ResourceBasicView(com.sequenceiq.cloudbreak.common.dal.ResourceBasicView) SharedServiceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response)

Example 7 with ResourceBasicView

use of com.sequenceiq.cloudbreak.common.dal.ResourceBasicView in project cloudbreak by hortonworks.

the class DatalakeService method prepareDatalakeRequest.

public void prepareDatalakeRequest(Stack source, StackV4Request stackRequest) {
    if (!Strings.isNullOrEmpty(source.getDatalakeCrn())) {
        LOGGER.debug("Prepare datalake request by datalakecrn");
        SharedServiceV4Request sharedServiceRequest = new SharedServiceV4Request();
        Optional<ResourceBasicView> datalakeStack = stackService.getResourceBasicViewByResourceCrn(source.getDatalakeCrn());
        datalakeStack.ifPresent(s -> {
            sharedServiceRequest.setDatalakeName(s.getName());
        });
        stackRequest.setSharedService(sharedServiceRequest);
    }
}
Also used : ResourceBasicView(com.sequenceiq.cloudbreak.common.dal.ResourceBasicView) SharedServiceV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.sharedservice.SharedServiceV4Request)

Aggregations

ResourceBasicView (com.sequenceiq.cloudbreak.common.dal.ResourceBasicView)7 HashMap (java.util.HashMap)3 Test (org.junit.jupiter.api.Test)3 SharedServiceV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response)2 AccountAwareResource (com.sequenceiq.cloudbreak.common.dal.model.AccountAwareResource)2 SharedServiceV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.sharedservice.SharedServiceV4Request)1 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)1 AccountAwareResourceRepository (com.sequenceiq.cloudbreak.common.dal.repository.AccountAwareResourceRepository)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Map (java.util.Map)1 Optional (java.util.Optional)1