Search in sources :

Example 1 with ApiServiceState

use of com.sequenceiq.mock.swagger.model.ApiServiceState in project cloudbreak by hortonworks.

the class ClusterResourceOperation method stopCommand.

public ResponseEntity<ApiCommand> stopCommand(String mockUuid, String clusterName) {
    ClouderaManagerDto read = clouderaManagerStoreService.read(mockUuid);
    Map<String, ApiServiceState> newStates = new HashMap<>();
    read.getServiceStates().forEach((service, apiServiceState) -> newStates.put(service, ApiServiceState.STOPPED));
    read.setServiceStates(newStates);
    read.setStatus(ApiServiceState.STOPPED);
    return responseCreatorComponent.exec(new ApiCommand().id(CommandId.CLUSTER_STOP).active(Boolean.TRUE).name("Stop"));
}
Also used : ClouderaManagerDto(com.sequenceiq.mock.clouderamanager.ClouderaManagerDto) ApiCommand(com.sequenceiq.mock.swagger.model.ApiCommand) ApiServiceState(com.sequenceiq.mock.swagger.model.ApiServiceState) HashMap(java.util.HashMap)

Example 2 with ApiServiceState

use of com.sequenceiq.mock.swagger.model.ApiServiceState in project cloudbreak by hortonworks.

the class ClusterResourceOperation method startCommand.

public ResponseEntity<ApiCommand> startCommand(String mockUuid, String clusterName) {
    ClouderaManagerDto read = clouderaManagerStoreService.read(mockUuid);
    Map<String, ApiServiceState> newStates = new HashMap<>();
    read.getServiceStates().forEach((service, apiServiceState) -> newStates.put(service, ApiServiceState.STARTED));
    read.setServiceStates(newStates);
    read.setStatus(ApiServiceState.STARTED);
    return responseCreatorComponent.exec(new ApiCommand().id(CommandId.CLUSTER_START).active(Boolean.TRUE).name("Start"));
}
Also used : ClouderaManagerDto(com.sequenceiq.mock.clouderamanager.ClouderaManagerDto) ApiCommand(com.sequenceiq.mock.swagger.model.ApiCommand) ApiServiceState(com.sequenceiq.mock.swagger.model.ApiServiceState) HashMap(java.util.HashMap)

Aggregations

ClouderaManagerDto (com.sequenceiq.mock.clouderamanager.ClouderaManagerDto)2 ApiCommand (com.sequenceiq.mock.swagger.model.ApiCommand)2 ApiServiceState (com.sequenceiq.mock.swagger.model.ApiServiceState)2 HashMap (java.util.HashMap)2