/** * Simplified method form for invoking the ListClusters operation with an AsyncHandler. * * @see #listClustersAsync(ListClustersRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<ListClustersResult> listClustersAsync( com.amazonaws.handlers.AsyncHandler<ListClustersRequest, ListClustersResult> asyncHandler) { return listClustersAsync(new ListClustersRequest(), asyncHandler); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCreatedAfter() == null) ? 0 : getCreatedAfter().hashCode()); hashCode = prime * hashCode + ((getCreatedBefore() == null) ? 0 : getCreatedBefore().hashCode()); hashCode = prime * hashCode + ((getClusterStates() == null) ? 0 : getClusterStates().hashCode()); hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); return hashCode; }
/** * <p> * The cluster state filters to apply when listing clusters. * </p> * * @param clusterStates * The cluster state filters to apply when listing clusters. * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterState */ public ListClustersRequest withClusterStates(ClusterState... clusterStates) { com.amazonaws.internal.SdkInternalList<String> clusterStatesCopy = new com.amazonaws.internal.SdkInternalList<String>(clusterStates.length); for (ClusterState value : clusterStates) { clusterStatesCopy.add(value.toString()); } if (getClusterStates() == null) { setClusterStates(clusterStatesCopy); } else { getClusterStates().addAll(clusterStatesCopy); } return this; }
ListClustersRequest listClustersRequest = new ListClustersRequest().withClusterStates(getActiveEmrClusterStates()); String markerForListClusters = listClustersRequest.getMarker(); emrOperations.listEmrClusters(getEmrClient(awsParams), listClustersRequest.withMarker(markerForListClusters));
ListClustersRequest listClustersRequest = new ListClustersRequest().withClusterStates(EMR_VALID_STATE); ListClustersRequest listClustersRequestWithMarker = new ListClustersRequest().withClusterStates(EMR_VALID_STATE).withMarker(MARKER);
ListClustersResult clusterResult ; do{ clusterResult = emrClient.listClusters(new ListClustersRequest().withMarker(marker)); clusters.addAll(clusterResult.getClusters()); marker = clusterResult.getMarker();
@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); } }
@Override public ListClustersResult answer(InvocationOnMock invocation) throws Throwable { ListClustersRequest listClustersRequest = invocation.getArgument(1); String marker = listClustersRequest.getMarker(); ListClustersResult listClustersResult = new ListClustersResult(); listClustersResult.setClusters(new ArrayList<>()); /* * When no marker is given, this is the request for the first page. * Return a known marker. The expectation is that the next call to this method should have a request with this expected marker. */ if (marker == null) { listClustersResult.setMarker("pagination_marker"); } /* * When a marker is given, this is expected to be the subsequent call. */ else { // Assert that the correct marker is passed in assertEquals("pagination_marker", marker); ClusterSummary clusterSummary = new ClusterSummary(); clusterSummary.setId(expectedClusterId); clusterSummary.setName(clusterName); listClustersResult.getClusters().add(clusterSummary); } return listClustersResult; } });
ListClustersRequest listClustersRequest = new ListClustersRequest().withClusterStates(getActiveEmrClusterStates()); String markerForListClusters = listClustersRequest.getMarker(); emrOperations.listEmrClusters(getEmrClient(awsParams), listClustersRequest.withMarker(markerForListClusters));
/** * <p> * The cluster state filters to apply when listing clusters. * </p> * * @param clusterStates * The cluster state filters to apply when listing clusters. * @return Returns a reference to this object so that method calls can be chained together. * @see ClusterState */ public ListClustersRequest withClusterStates(ClusterState... clusterStates) { com.amazonaws.internal.SdkInternalList<String> clusterStatesCopy = new com.amazonaws.internal.SdkInternalList<String>(clusterStates.length); for (ClusterState value : clusterStates) { clusterStatesCopy.add(value.toString()); } if (getClusterStates() == null) { setClusterStates(clusterStatesCopy); } else { getClusterStates().addAll(clusterStatesCopy); } return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListClustersRequest == false) return false; ListClustersRequest other = (ListClustersRequest) obj; if (other.getCreatedAfter() == null ^ this.getCreatedAfter() == null) return false; if (other.getCreatedAfter() != null && other.getCreatedAfter().equals(this.getCreatedAfter()) == false) return false; if (other.getCreatedBefore() == null ^ this.getCreatedBefore() == null) return false; if (other.getCreatedBefore() != null && other.getCreatedBefore().equals(this.getCreatedBefore()) == false) return false; if (other.getClusterStates() == null ^ this.getClusterStates() == null) return false; if (other.getClusterStates() != null && other.getClusterStates().equals(this.getClusterStates()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; return true; }
/** * Simplified method form for invoking the ListClusters operation. * * @see #listClustersAsync(ListClustersRequest) */ @Override public java.util.concurrent.Future<ListClustersResult> listClustersAsync() { return listClustersAsync(new ListClustersRequest()); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCreatedAfter() != null) sb.append("CreatedAfter: ").append(getCreatedAfter()).append(","); if (getCreatedBefore() != null) sb.append("CreatedBefore: ").append(getCreatedBefore()).append(","); if (getClusterStates() != null) sb.append("ClusterStates: ").append(getClusterStates()).append(","); if (getMarker() != null) sb.append("Marker: ").append(getMarker()); sb.append("}"); return sb.toString(); }
/** * Simplified method form for invoking the ListClusters operation. * * @see #listClustersAsync(ListClustersRequest) */ @Override public java.util.concurrent.Future<ListClustersResult> listClustersAsync() { return listClustersAsync(new ListClustersRequest()); }
/** * Marshall the given parameter object. */ public void marshall(ListClustersRequest listClustersRequest, ProtocolMarshaller protocolMarshaller) { if (listClustersRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listClustersRequest.getCreatedAfter(), CREATEDAFTER_BINDING); protocolMarshaller.marshall(listClustersRequest.getCreatedBefore(), CREATEDBEFORE_BINDING); protocolMarshaller.marshall(listClustersRequest.getClusterStates(), CLUSTERSTATES_BINDING); protocolMarshaller.marshall(listClustersRequest.getMarker(), MARKER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * Simplified method form for invoking the ListClusters operation with an AsyncHandler. * * @see #listClustersAsync(ListClustersRequest, com.amazonaws.handlers.AsyncHandler) */ @Override public java.util.concurrent.Future<ListClustersResult> listClustersAsync( com.amazonaws.handlers.AsyncHandler<ListClustersRequest, ListClustersResult> asyncHandler) { return listClustersAsync(new ListClustersRequest(), asyncHandler); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCreatedAfter() == null) ? 0 : getCreatedAfter().hashCode()); hashCode = prime * hashCode + ((getCreatedBefore() == null) ? 0 : getCreatedBefore().hashCode()); hashCode = prime * hashCode + ((getClusterStates() == null) ? 0 : getClusterStates().hashCode()); hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); return hashCode; }
@Override public ListClustersResult listClusters() { return listClusters(new ListClustersRequest()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListClustersRequest == false) return false; ListClustersRequest other = (ListClustersRequest) obj; if (other.getCreatedAfter() == null ^ this.getCreatedAfter() == null) return false; if (other.getCreatedAfter() != null && other.getCreatedAfter().equals(this.getCreatedAfter()) == false) return false; if (other.getCreatedBefore() == null ^ this.getCreatedBefore() == null) return false; if (other.getCreatedBefore() != null && other.getCreatedBefore().equals(this.getCreatedBefore()) == false) return false; if (other.getClusterStates() == null ^ this.getClusterStates() == null) return false; if (other.getClusterStates() != null && other.getClusterStates().equals(this.getClusterStates()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; return true; }
@Override public ListClustersResult listClusters() { return listClusters(new ListClustersRequest()); }