Search in sources :

Example 16 with NameOrCrn

use of com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn in project cloudbreak by hortonworks.

the class DistroXUpgradeV1Controller method upgradeCluster.

private DistroXUpgradeV1Response upgradeCluster(String clusterNameOrCrn, DistroXUpgradeV1Request distroxUpgradeRequest, NameOrCrn nameOrCrn) {
    String accountId = ThreadBasedUserCrnProvider.getAccountId();
    boolean dataHubRuntimeUpgradeEnabled = upgradeAvailabilityService.isRuntimeUpgradeEnabledByAccountId(accountId);
    boolean dataHubOsUpgradeEntitled = upgradeAvailabilityService.isOsUpgradeEnabledByAccountId(accountId);
    return upgradeCluster(clusterNameOrCrn, distroxUpgradeRequest, nameOrCrn, new InternalUpgradeSettings(false, dataHubRuntimeUpgradeEnabled, dataHubOsUpgradeEntitled));
}
Also used : InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings)

Example 17 with NameOrCrn

use of com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn in project cloudbreak by hortonworks.

the class DistroXUpgradeV1Controller method upgradeClusterByNameInternal.

@Override
@InternalOnly
public DistroXUpgradeV1Response upgradeClusterByNameInternal(@ResourceName String clusterName, @Valid DistroXUpgradeV1Request distroxUpgradeRequest, @InitiatorUserCrn String initiatorUserCrn) {
    NameOrCrn nameOrCrn = NameOrCrn.ofName(clusterName);
    boolean dataHubRuntimeUpgradeEnabled = upgradeAvailabilityService.isRuntimeUpgradeEnabledByUserCrn(initiatorUserCrn);
    boolean dataHubOsUpgradeEntitled = upgradeAvailabilityService.isOsUpgradeEnabledByUserCrn(initiatorUserCrn);
    return upgradeCluster(clusterName, distroxUpgradeRequest, nameOrCrn, new InternalUpgradeSettings(true, dataHubRuntimeUpgradeEnabled, dataHubOsUpgradeEntitled));
}
Also used : InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) NameOrCrn(com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn) InternalOnly(com.sequenceiq.authorization.annotation.InternalOnly)

Example 18 with NameOrCrn

use of com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn in project cloudbreak by hortonworks.

the class StackOperations method putPassword.

public FlowIdentifier putPassword(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UserNamePasswordV4Request userNamePasswordJson) {
    Stack stack = nameOrCrn.hasName() ? stackService.getByNameInWorkspace(nameOrCrn.getName(), workspaceId) : stackService.getNotTerminatedByCrnInWorkspace(nameOrCrn.getCrn(), workspaceId);
    UpdateClusterV4Request updateClusterJson = userNamePasswordV4RequestToUpdateClusterV4RequestConverter.convert(userNamePasswordJson);
    return clusterCommonService.put(stack.getResourceCrn(), updateClusterJson);
}
Also used : UpdateClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UpdateClusterV4Request) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 19 with NameOrCrn

use of com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn 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 NameOrCrn

use of com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn 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

NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)19 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)11 Test (org.junit.Test)8 StackViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)7 Test (org.junit.jupiter.api.Test)6 UpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response)4 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)4 UpdateStackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.autoscales.request.UpdateStackV4Request)3 CertificatesRotationV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.CertificatesRotationV4Request)3 InternalUpgradeSettings (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings)3 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)3 StackViewV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Responses)3 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)3 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)3 InternalOnly (com.sequenceiq.authorization.annotation.InternalOnly)2 UpdateClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UpdateClusterV4Request)2 ImageInfoV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.ImageInfoV4Response)2 CredentialResponse (com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse)2 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)2 StackImageChangeV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackImageChangeV4Request)1