Search in sources :

Example 16 with StackViewV4Responses

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses in project cloudbreak by hortonworks.

the class DistroXV1ControllerTest method testListUsesListAuthorizationService.

@Test
void testListUsesListAuthorizationService() {
    StackViewV4Responses expected = new StackViewV4Responses();
    when(datahubFiltering.filterDataHubs(any(), anyString(), anyString())).thenReturn(expected);
    StackViewV4Responses actual = distroXV1Controller.list(NAME, CRN);
    assertEquals(expected, actual);
    verify(datahubFiltering).filterDataHubs(AuthorizationResourceAction.DESCRIBE_DATAHUB, NAME, CRN);
}
Also used : StackViewV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses) Test(org.junit.jupiter.api.Test)

Example 17 with StackViewV4Responses

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses in project cloudbreak by hortonworks.

the class StackOperations method listByEnvironmentCrn.

public StackViewV4Responses listByEnvironmentCrn(Long workspaceId, String environmentCrn, List<StackType> stackTypes) {
    Set<StackViewV4Response> stackViewResponses;
    LOGGER.info("List for Stack in workspace {} and environmentCrn {}.", workspaceId, environmentCrn);
    stackViewResponses = stackApiViewService.retrieveStackViewsByWorkspaceIdAndEnvironmentCrn(workspaceId, environmentCrn, stackTypes).stream().map(s -> stackApiViewToStackViewV4ResponseConverter.convert(s)).collect(Collectors.toSet());
    LOGGER.info("Adding environment name and credential to the responses.");
    NameOrCrn nameOrCrn = StringUtils.isEmpty(environmentCrn) ? NameOrCrn.empty() : NameOrCrn.ofCrn(environmentCrn);
    environmentServiceDecorator.prepareEnvironmentsAndCredentialName(stackViewResponses, nameOrCrn);
    LOGGER.info("Adding SDX CRN and name to the responses.");
    sdxServiceDecorator.prepareMultipleSdxAttributes(stackViewResponses);
    return new StackViewV4Responses(stackViewResponses);
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) StackViewV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)

Example 18 with StackViewV4Responses

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses in project cloudbreak by hortonworks.

the class StackUpgradeOperations method validateAttachedDataHubsForDataLake.

private void validateAttachedDataHubsForDataLake(String accountId, Long workspaceId, Stack stack, UpgradeV4Response upgradeResponse) {
    if (entitlementService.runtimeUpgradeEnabled(accountId) && StackType.DATALAKE == stack.getType()) {
        LOGGER.info("Checking that the attached DataHubs of the Data lake are both in stopped state and upgradeable only in case if " + "Data lake runtime upgrade is enabled in [{}] account on [{}] cluster.", accountId, stack.getName());
        StackViewV4Responses stackViewV4Responses = stackOperations.listByEnvironmentCrn(workspaceId, stack.getEnvironmentCrn(), List.of(StackType.WORKLOAD));
        if (!entitlementService.datahubRuntimeUpgradeEnabled(accountId)) {
            upgradeResponse.appendReason(upgradePreconditionService.checkForNonUpgradeableAttachedClusters(stackViewV4Responses));
        }
        upgradeResponse.appendReason(upgradePreconditionService.checkForRunningAttachedClusters(stackViewV4Responses, stack));
    }
}
Also used : StackViewV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)

Example 19 with StackViewV4Responses

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses in project cloudbreak by hortonworks.

the class StackOperations method listByStackIds.

public StackViewV4Responses listByStackIds(Long workspaceId, List<Long> stackIds, String environmentCrn, List<StackType> stackTypes) {
    Set<StackViewV4Response> stackViewResponses;
    stackViewResponses = stackApiViewService.retrieveStackViewsByStackIdsAndEnvironmentCrn(workspaceId, stackIds, environmentCrn, stackTypes).stream().map(s -> stackApiViewToStackViewV4ResponseConverter.convert(s)).collect(Collectors.toSet());
    LOGGER.info("Adding environment name and credential to the responses.");
    NameOrCrn nameOrCrn = Strings.isNullOrEmpty(environmentCrn) ? NameOrCrn.empty() : NameOrCrn.ofCrn(environmentCrn);
    environmentServiceDecorator.prepareEnvironmentsAndCredentialName(stackViewResponses, nameOrCrn);
    LOGGER.info("Adding SDX CRN and name to the responses.");
    sdxServiceDecorator.prepareMultipleSdxAttributes(stackViewResponses);
    return new StackViewV4Responses(stackViewResponses);
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) StackViewV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)

Example 20 with StackViewV4Responses

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses in project cloudbreak by hortonworks.

the class StackOperations method listByEnvironmentName.

public StackViewV4Responses listByEnvironmentName(Long workspaceId, String environmentName, List<StackType> stackTypes) {
    Set<StackViewV4Response> stackViewResponses;
    LOGGER.info("List for Stack in workspace {} and environmentName {}.", workspaceId, environmentName);
    stackViewResponses = stackApiViewService.retrieveStackViewsByWorkspaceIdAndEnvironmentName(workspaceId, environmentName, stackTypes).stream().map(s -> stackApiViewToStackViewV4ResponseConverter.convert(s)).collect(Collectors.toSet());
    LOGGER.info("Adding environment name and credential to the responses.");
    NameOrCrn nameOrCrn = StringUtils.isEmpty(environmentName) ? NameOrCrn.empty() : NameOrCrn.ofName(environmentName);
    environmentServiceDecorator.prepareEnvironmentsAndCredentialName(stackViewResponses, nameOrCrn);
    LOGGER.info("Adding SDX CRN and name to the responses.");
    sdxServiceDecorator.prepareMultipleSdxAttributes(stackViewResponses);
    return new StackViewV4Responses(stackViewResponses);
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) StackViewV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)

Aggregations

StackViewV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)33 Test (org.junit.jupiter.api.Test)19 StackViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)18 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)14 Test (org.junit.Test)8 PollingConfig (com.sequenceiq.environment.util.PollingConfig)4 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)3 UpgradeV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.upgrade.UpgradeV4Request)3 UpgradeOptionV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeOptionV4Response)3 UpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response)3 Image (com.sequenceiq.cloudbreak.cloud.model.Image)3 StackInstanceCount (com.sequenceiq.cloudbreak.domain.projection.StackInstanceCount)3 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)3 RepairValidation (com.sequenceiq.cloudbreak.service.cluster.model.RepairValidation)3 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)3 Environment (com.sequenceiq.environment.environment.domain.Environment)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ClusterViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.views.ClusterViewV4Response)2 DistroXMultiDeleteV1Request (com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXMultiDeleteV1Request)2