Search in sources :

Example 1 with ClusterStateChangeReason

use of com.amazonaws.services.elasticmapreduce.model.ClusterStateChangeReason in project herd by FINRAOS.

the class MockEmrOperationsImpl method listEmrClusters.

@Override
public ListClustersResult listEmrClusters(AmazonElasticMapReduceClient emrClient, ListClustersRequest listClustersRequest) {
    List<ClusterSummary> clusterSummaryList = new ArrayList<>();
    for (MockEmrJobFlow cluster : emrClusters.values()) {
        if (!listClustersRequest.getClusterStates().isEmpty() && listClustersRequest.getClusterStates().contains(cluster.getStatus())) {
            ClusterSummary clusterSummary = new ClusterSummary();
            clusterSummary.withId(cluster.getJobFlowId()).withName(cluster.getJobFlowName()).withStatus(new ClusterStatus().withState(cluster.getStatus()).withStateChangeReason(new ClusterStateChangeReason().withCode(cluster.getStatusChangeReason().getCode()).withMessage(cluster.getStatusChangeReason().getMessage())).withTimeline(new ClusterTimeline().withCreationDateTime(cluster.getStatusTimeline().getCreationTime() != null ? cluster.getStatusTimeline().getCreationTime().toGregorianCalendar().getTime() : null).withEndDateTime(cluster.getStatusTimeline().getEndTime() != null ? cluster.getStatusTimeline().getEndTime().toGregorianCalendar().getTime() : null).withReadyDateTime(cluster.getStatusTimeline().getReadyTime() != null ? cluster.getStatusTimeline().getReadyTime().toGregorianCalendar().getTime() : null)));
            clusterSummaryList.add(clusterSummary);
        }
    }
    if (StringUtils.isBlank(listClustersRequest.getMarker())) {
        return new ListClustersResult().withClusters(clusterSummaryList).withMarker(MOCK_EMR_MAKER);
    } else {
        return new ListClustersResult().withClusters(clusterSummaryList);
    }
}
Also used : ClusterStateChangeReason(com.amazonaws.services.elasticmapreduce.model.ClusterStateChangeReason) ClusterSummary(com.amazonaws.services.elasticmapreduce.model.ClusterSummary) ArrayList(java.util.ArrayList) ListClustersResult(com.amazonaws.services.elasticmapreduce.model.ListClustersResult) ClusterStatus(com.amazonaws.services.elasticmapreduce.model.ClusterStatus) ClusterTimeline(com.amazonaws.services.elasticmapreduce.model.ClusterTimeline)

Aggregations

ClusterStateChangeReason (com.amazonaws.services.elasticmapreduce.model.ClusterStateChangeReason)1 ClusterStatus (com.amazonaws.services.elasticmapreduce.model.ClusterStatus)1 ClusterSummary (com.amazonaws.services.elasticmapreduce.model.ClusterSummary)1 ClusterTimeline (com.amazonaws.services.elasticmapreduce.model.ClusterTimeline)1 ListClustersResult (com.amazonaws.services.elasticmapreduce.model.ListClustersResult)1 ArrayList (java.util.ArrayList)1