Search in sources :

Example 51 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackV2Controller method putStop.

@Override
public Response putStop(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getPublicStack(name, user);
    if (!cloudParameterCache.isStartStopSupported(stack.cloudPlatform())) {
        throw new BadRequestException(String.format("Stop is not supported on %s cloudplatform", stack.cloudPlatform()));
    }
    UpdateStackJson updateStackJson = new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.STOPPED);
    updateStackJson.setWithClusterEvent(true);
    return stackCommonService.put(stack.getId(), updateStackJson);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) UpdateStackJson(com.sequenceiq.cloudbreak.api.model.UpdateStackJson) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 52 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackV2Controller method putPassword.

@Override
public Response putPassword(String name, UserNamePasswordJson userNamePasswordJson) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getPublicStack(name, user);
    UpdateClusterJson updateClusterJson = conversionService.convert(userNamePasswordJson, UpdateClusterJson.class);
    return clusterCommonController.put(stack.getId(), updateClusterJson);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Stack(com.sequenceiq.cloudbreak.domain.Stack) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)

Example 53 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackV2Controller method postStackForBlueprint.

@Override
public GeneratedBlueprintResponse postStackForBlueprint(StackV2Request stackRequest) throws Exception {
    IdentityUser user = authenticatedUserService.getCbUser();
    stackRequest.setAccount(user.getAccount());
    stackRequest.setOwner(user.getUserId());
    BlueprintPreparationObject blueprintPreparationObject = conversionService.convert(stackRequest, BlueprintPreparationObject.class);
    String blueprintText = centralBlueprintUpdater.getBlueprintText(blueprintPreparationObject);
    return new GeneratedBlueprintResponse(blueprintText);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) GeneratedBlueprintResponse(com.sequenceiq.cloudbreak.api.model.GeneratedBlueprintResponse)

Example 54 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackV2Controller method putRepair.

@Override
public Response putRepair(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getPublicStack(name, user);
    UpdateStackJson updateStackJson = new UpdateStackJson();
    updateStackJson.setStatus(StatusRequest.REPAIR_FAILED_NODES);
    updateStackJson.setWithClusterEvent(true);
    return stackCommonService.put(stack.getId(), updateStackJson);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) UpdateStackJson(com.sequenceiq.cloudbreak.api.model.UpdateStackJson) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 55 with IdentityUser

use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser in project cloudbreak by hortonworks.

the class StackV2Controller method putScaling.

@Override
public Response putScaling(String name, StackScaleRequestV2 updateRequest) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Stack stack = stackService.getPublicStack(name, user);
    if (!cloudParameterCache.isScalingSupported(stack.cloudPlatform())) {
        throw new BadRequestException(String.format("Scaling is not supported on %s cloudplatform", stack.cloudPlatform()));
    }
    updateRequest.setStackId(stack.getId());
    UpdateStackJson updateStackJson = conversionService.convert(updateRequest, UpdateStackJson.class);
    if (updateStackJson.getInstanceGroupAdjustment().getScalingAdjustment() > 0) {
        return stackCommonService.put(stack.getId(), updateStackJson);
    } else {
        UpdateClusterJson updateClusterJson = conversionService.convert(updateRequest, UpdateClusterJson.class);
        return clusterCommonController.put(stack.getId(), updateClusterJson);
    }
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) UpdateStackJson(com.sequenceiq.cloudbreak.api.model.UpdateStackJson) Stack(com.sequenceiq.cloudbreak.domain.Stack) UpdateClusterJson(com.sequenceiq.cloudbreak.api.model.UpdateClusterJson)

Aggregations

IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)133 Test (org.junit.Test)14 Stack (com.sequenceiq.cloudbreak.domain.Stack)13 UserFilterField (com.sequenceiq.cloudbreak.common.service.user.UserFilterField)9 Async (org.springframework.scheduling.annotation.Async)9 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)8 Credential (com.sequenceiq.cloudbreak.domain.Credential)8 FlexSubscription (com.sequenceiq.cloudbreak.domain.FlexSubscription)8 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)7 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)7 ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)7 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)6 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)6 Before (org.junit.Before)6 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)6 UpdateStackJson (com.sequenceiq.cloudbreak.api.model.UpdateStackJson)5 Template (com.sequenceiq.cloudbreak.domain.Template)5 ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)4 Network (com.sequenceiq.cloudbreak.domain.Network)4 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)4