Search in sources :

Example 31 with Stack

use of com.sequenceiq.cloudbreak.domain.Stack 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 32 with Stack

use of com.sequenceiq.cloudbreak.domain.Stack 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 33 with Stack

use of com.sequenceiq.cloudbreak.domain.Stack 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 34 with Stack

use of com.sequenceiq.cloudbreak.domain.Stack 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)

Example 35 with Stack

use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.

the class StackV2Controller method putReinstall.

@Override
public Response putReinstall(String name, ReinstallRequestV2 reinstallRequestV2) {
    IdentityUser user = authenticatedUserService.getCbUser();
    reinstallRequestV2.setAccount(user.getAccount());
    Stack stack = stackService.getPublicStack(name, user);
    UpdateClusterJson updateClusterJson = conversionService.convert(reinstallRequestV2, 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)

Aggregations

Stack (com.sequenceiq.cloudbreak.domain.Stack)207 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)74 Test (org.junit.Test)70 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)32 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)30 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)26 DetailedStackStatus (com.sequenceiq.cloudbreak.api.model.DetailedStackStatus)23 ArrayList (java.util.ArrayList)20 List (java.util.List)20 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)18 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)18 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)18 HashMap (java.util.HashMap)18 HashSet (java.util.HashSet)18 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)17 Map (java.util.Map)17 Matchers.anyString (org.mockito.Matchers.anyString)16 HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)15 Set (java.util.Set)15 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)14