@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamNames() == null) ? 0 : getStreamNames().hashCode()); hashCode = prime * hashCode + ((getHasMoreStreams() == null) ? 0 : getHasMoreStreams().hashCode()); return hashCode; }
/** * <p> * If set to <code>true</code>, there are more streams available to list. * </p> * * @param hasMoreStreams * If set to <code>true</code>, there are more streams available to list. * @return Returns a reference to this object so that method calls can be chained together. */ public ListStreamsResult withHasMoreStreams(Boolean hasMoreStreams) { setHasMoreStreams(hasMoreStreams); return this; }
/** * <p> * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> request. * </p> * * @param streamNames * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> * request. * @return Returns a reference to this object so that method calls can be chained together. */ public ListStreamsResult withStreamNames(java.util.Collection<String> streamNames) { setStreamNames(streamNames); return this; }
/** * Gets a list of all Amazon Kinesis streams * * @param kinesisClient The {@link com.amazonaws.services.kinesis.AmazonKinesisClient} with Amazon Kinesis read privileges * @return list of Amazon Kinesis streams */ public static List<String> listAllStreams(AmazonKinesisClient kinesisClient) { ListStreamsRequest listStreamsRequest = new ListStreamsRequest(); listStreamsRequest.setLimit(10); ListStreamsResult listStreamsResult = kinesisClient.listStreams(listStreamsRequest); List<String> streamNames = listStreamsResult.getStreamNames(); while (listStreamsResult.isHasMoreStreams()) { if (!streamNames.isEmpty()) { listStreamsRequest.setExclusiveStartStreamName(streamNames.get(streamNames.size() - 1)); } listStreamsResult = kinesisClient.listStreams(listStreamsRequest); streamNames.addAll(listStreamsResult.getStreamNames()); } return streamNames; }
public ListStreamsResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListStreamsResult listStreamsResult = new ListStreamsResult(); if (context.testExpression("StreamNames", targetDepth)) { context.nextToken(); listStreamsResult.setStreamNames(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context)); listStreamsResult.setHasMoreStreams(context.getUnmarshaller(Boolean.class).unmarshall(context));
/** * <p> * The names of the streams that are associated with the AWS account making * the <code>ListStreams</code> request. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param streamNames <p> * The names of the streams that are associated with the AWS * account making the <code>ListStreams</code> request. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListStreamsResult withStreamNames(String... streamNames) { if (getStreamNames() == null) { this.streamNames = new java.util.ArrayList<String>(streamNames.length); } for (String value : streamNames) { this.streamNames.add(value); } return this; }
@Override public Set<String> listStreams() { AmazonKinesis amazonKinesis = KinesisClient.create(properties); ListStreamsResult listStreamsResult = amazonKinesis.listStreams(); List<String> streamNames = listStreamsResult.getStreamNames(); Set<String> streamNamesCollection = new HashSet(streamNames); while (listStreamsResult.isHasMoreStreams() && !streamNames.isEmpty()) { listStreamsResult = amazonKinesis.listStreams(streamNames.get(streamNames.size() - 1)); streamNames = listStreamsResult.getStreamNames(); streamNamesCollection.addAll(streamNames); } return streamNamesCollection; } }
public ListStreamsResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListStreamsResult listStreamsResult = new ListStreamsResult(); AwsJsonReader reader = context.getReader(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("StreamNames")) { listStreamsResult.setStreamNames(new ListUnmarshaller<String>( StringJsonUnmarshaller.getInstance() ) .unmarshall(context)); } else if (name.equals("HasMoreStreams")) { listStreamsResult.setHasMoreStreams(BooleanJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return listStreamsResult; }
@Override protected void doScan() { ListStreamsResult result = getClient().listStreams(); for(String name: result.getStreamNames()) { try { scanStream(name); } catch (RuntimeException e) { maybeThrow(e,"problem scanning kinesis"); } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListStreamsResult == false) return false; ListStreamsResult other = (ListStreamsResult) obj; if (other.getStreamNames() == null ^ this.getStreamNames() == null) return false; if (other.getStreamNames() != null && other.getStreamNames().equals(this.getStreamNames()) == false) return false; if (other.getHasMoreStreams() == null ^ this.getHasMoreStreams() == null) return false; if (other.getHasMoreStreams() != null && other.getHasMoreStreams().equals(this.getHasMoreStreams()) == false) return false; return true; }
@Override public Set<String> listStreams() { AmazonKinesis amazonKinesis = KinesisClient.create(properties); ListStreamsResult listStreamsResult = amazonKinesis.listStreams(); List<String> streamNames = listStreamsResult.getStreamNames(); Set<String> streamNamesCollection = new HashSet(streamNames); while (listStreamsResult.isHasMoreStreams() && !streamNames.isEmpty()) { listStreamsResult = amazonKinesis.listStreams(streamNames.get(streamNames.size() - 1)); streamNames = listStreamsResult.getStreamNames(); streamNamesCollection.addAll(streamNames); } return streamNamesCollection; } }
public ListStreamsResult unmarshall(JsonUnmarshallerContext context) throws Exception { ListStreamsResult listStreamsResult = new ListStreamsResult(); if (context.testExpression("StreamNames", targetDepth)) { context.nextToken(); listStreamsResult.setStreamNames(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context)); listStreamsResult.setHasMoreStreams(context.getUnmarshaller(Boolean.class).unmarshall(context));
/** * <p> * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> request. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setStreamNames(java.util.Collection)} or {@link #withStreamNames(java.util.Collection)} if you want to * override the existing values. * </p> * * @param streamNames * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> * request. * @return Returns a reference to this object so that method calls can be chained together. */ public ListStreamsResult withStreamNames(String... streamNames) { if (this.streamNames == null) { setStreamNames(new com.amazonaws.internal.SdkInternalList<String>(streamNames.length)); } for (String ele : streamNames) { this.streamNames.add(ele); } return this; }
/** * <p> * If set to <code>true</code>, there are more streams available to list. * </p> * * @param hasMoreStreams * If set to <code>true</code>, there are more streams available to list. * @return Returns a reference to this object so that method calls can be chained together. */ public ListStreamsResult withHasMoreStreams(Boolean hasMoreStreams) { setHasMoreStreams(hasMoreStreams); 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 (getStreamNames() != null) sb.append("StreamNames: ").append(getStreamNames()).append(","); if (getHasMoreStreams() != null) sb.append("HasMoreStreams: ").append(getHasMoreStreams()); sb.append("}"); return sb.toString(); }
/** * Gets a list of all Amazon Kinesis streams * * @param kinesisClient * The {@link com.amazonaws.services.kinesis.AmazonKinesisClient} with Amazon Kinesis read privileges * @return list of Amazon Kinesis streams */ public static List<String> listAllStreams(AmazonKinesisClient kinesisClient) { ListStreamsRequest listStreamsRequest = new ListStreamsRequest(); listStreamsRequest.setLimit(10); ListStreamsResult listStreamsResult = kinesisClient.listStreams(listStreamsRequest); List<String> streamNames = listStreamsResult.getStreamNames(); while (listStreamsResult.isHasMoreStreams()) { if (streamNames.size() > 0) { listStreamsRequest.setExclusiveStartStreamName(streamNames.get(streamNames.size() - 1)); } listStreamsResult = kinesisClient.listStreams(listStreamsRequest); streamNames.addAll(listStreamsResult.getStreamNames()); } return streamNames; }
/** * <p> * The names of the streams that are associated with the AWS account making * the <code>ListStreams</code> request. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param streamNames <p> * The names of the streams that are associated with the AWS * account making the <code>ListStreams</code> request. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ListStreamsResult withStreamNames(java.util.Collection<String> streamNames) { setStreamNames(streamNames); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamNames() == null) ? 0 : getStreamNames().hashCode()); hashCode = prime * hashCode + ((getHasMoreStreams() == null) ? 0 : getHasMoreStreams().hashCode()); return hashCode; }
/** * <p> * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> request. * </p> * * @param streamNames * The names of the streams that are associated with the AWS account making the <code>ListStreams</code> * request. * @return Returns a reference to this object so that method calls can be chained together. */ public ListStreamsResult withStreamNames(java.util.Collection<String> streamNames) { setStreamNames(streamNames); return this; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListStreamsResult == false) return false; ListStreamsResult other = (ListStreamsResult) obj; if (other.getStreamNames() == null ^ this.getStreamNames() == null) return false; if (other.getStreamNames() != null && other.getStreamNames().equals(this.getStreamNames()) == false) return false; if (other.getHasMoreStreams() == null ^ this.getHasMoreStreams() == null) return false; if (other.getHasMoreStreams() != null && other.getHasMoreStreams().equals(this.getHasMoreStreams()) == false) return false; return true; } }