@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); hashCode = prime * hashCode + ((getClusters() == null) ? 0 : getClusters().hashCode()); return hashCode; }
/** * <p> * A list of <code>Cluster</code> objects, where each object describes one cluster. * </p> * * @param clusters * A list of <code>Cluster</code> objects, where each object describes one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withClusters(java.util.Collection<Cluster> clusters) { setClusters(clusters); return this; }
/** * <p> * A value that indicates the starting point for the next set of response records in a subsequent request. If a * value is returned in a response, you can retrieve the next set of records by providing this returned marker value * in the <code>Marker</code> parameter and retrying the command. If the <code>Marker</code> field is empty, all * response records have been retrieved for the request. * </p> * * @param marker * A value that indicates the starting point for the next set of response records in a subsequent request. If * a value is returned in a response, you can retrieve the next set of records by providing this returned * marker value in the <code>Marker</code> parameter and retrying the command. If the <code>Marker</code> * field is empty, all response records have been retrieved for the request. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withMarker(String marker) { setMarker(marker); return this; }
final AmazonRedshiftClient client = new AmazonRedshiftClient(credentials).withRegion(com.amazonaws.regions.Regions.US_WEST_2); final DescribeClustersResult describeResult = client.describeClusters(); describeResult.getClusters() .stream() .forEach(cluster -> System.out.println(String.format("Cluster: %s \nNumber of nodes: %d", cluster.getClusterIdentifier(), cluster.getNumberOfNodes())));
public DescribeClustersResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeClustersResult describeClustersResult = new DescribeClustersResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeClustersResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeClustersResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Clusters", targetDepth)) { describeClustersResult.withClusters(new ArrayList<Cluster>()); continue; } if (context.testExpression("Clusters/Cluster", targetDepth)) { describeClustersResult.withClusters(ClusterStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeClustersResult; } } } }
private void describe(String dbInstanceIdentifier) throws Exception { while (true) { DescribeDBInstancesRequest request = new DescribeDBInstancesRequest() .withDBInstanceIdentifier(dbInstanceIdentifier); DescribeClustersResult response = client.describeClusters(new DescribeClustersRequest() .withClusterIdentifier(INSTANCE_ID) ); Cluster dbInstance = response.getClusters().get(0); if (!dbInstance.getClusterStatus().equalsIgnoreCase("creating")) { System.out.println("Done! " + response); System.out.println(dbInstance.getEndpoint().getAddress()); System.out.println(dbInstance.getEndpoint().getPort()); break; } System.out.println("Not done - will wait 10s: " + response); Thread.sleep(10000L); } }
public DescribeClustersResult unmarshall(StaxUnmarshallerContext context) throws Exception { DescribeClustersResult describeClustersResult = new DescribeClustersResult(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return describeClustersResult; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Marker", targetDepth)) { describeClustersResult.setMarker(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Clusters", targetDepth)) { describeClustersResult.withClusters(new ArrayList<Cluster>()); continue; } if (context.testExpression("Clusters/Cluster", targetDepth)) { describeClustersResult.withClusters(ClusterStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return describeClustersResult; } } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeClustersResult == false) return false; DescribeClustersResult other = (DescribeClustersResult) obj; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; if (other.getClusters() == null ^ this.getClusters() == null) return false; if (other.getClusters() != null && other.getClusters().equals(this.getClusters()) == false) return false; return true; }
/** * <p> * A list of <code>Cluster</code> objects, where each object describes one cluster. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setClusters(java.util.Collection)} or {@link #withClusters(java.util.Collection)} if you want to override * the existing values. * </p> * * @param clusters * A list of <code>Cluster</code> objects, where each object describes one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withClusters(Cluster... clusters) { if (this.clusters == null) { setClusters(new com.amazonaws.internal.SdkInternalList<Cluster>(clusters.length)); } for (Cluster ele : clusters) { this.clusters.add(ele); } return this; }
/** * <p> * A value that indicates the starting point for the next set of response records in a subsequent request. If a * value is returned in a response, you can retrieve the next set of records by providing this returned marker value * in the <code>Marker</code> parameter and retrying the command. If the <code>Marker</code> field is empty, all * response records have been retrieved for the request. * </p> * * @param marker * A value that indicates the starting point for the next set of response records in a subsequent request. If * a value is returned in a response, you can retrieve the next set of records by providing this returned * marker value in the <code>Marker</code> parameter and retrying the command. If the <code>Marker</code> * field is empty, all response records have been retrieved for the request. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withMarker(String marker) { setMarker(marker); return this; }
/** * 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 (getMarker() != null) sb.append("Marker: ").append(getMarker()).append(","); if (getClusters() != null) sb.append("Clusters: ").append(getClusters()); sb.append("}"); return sb.toString(); }
/** * <p> * A list of <code>Cluster</code> objects, where each object describes one cluster. * </p> * * @param clusters * A list of <code>Cluster</code> objects, where each object describes one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withClusters(java.util.Collection<Cluster> clusters) { setClusters(clusters); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); hashCode = prime * hashCode + ((getClusters() == null) ? 0 : getClusters().hashCode()); return hashCode; }
/** * <p> * A list of <code>Cluster</code> objects, where each object describes one cluster. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setClusters(java.util.Collection)} or {@link #withClusters(java.util.Collection)} if you want to override * the existing values. * </p> * * @param clusters * A list of <code>Cluster</code> objects, where each object describes one cluster. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeClustersResult withClusters(Cluster... clusters) { if (this.clusters == null) { setClusters(new com.amazonaws.internal.SdkInternalList<Cluster>(clusters.length)); } for (Cluster ele : clusters) { this.clusters.add(ele); } return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeClustersResult == false) return false; DescribeClustersResult other = (DescribeClustersResult) obj; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; if (other.getClusters() == null ^ this.getClusters() == null) return false; if (other.getClusters() != null && other.getClusters().equals(this.getClusters()) == false) return false; return true; }
/** * 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 (getMarker() != null) sb.append("Marker: ").append(getMarker()).append(","); if (getClusters() != null) sb.append("Clusters: ").append(getClusters()); sb.append("}"); return sb.toString(); }
do{ result= redshiftClient.describeClusters(new DescribeClustersRequest().withMarker(nextMarker)); redshiftList.addAll(result.getClusters()); nextMarker = result.getMarker(); }while(nextMarker!=null);