setNextToken(nextToken); return this;
/** * <p> * The name of the data stream whose shards you want to list. * </p> * <p> * You cannot specify this parameter if you specify the <code>NextToken</code> parameter. * </p> * * @param streamName * The name of the data stream whose shards you want to list. </p> * <p> * You cannot specify this parameter if you specify the <code>NextToken</code> parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ListShardsRequest withStreamName(String streamName) { setStreamName(streamName); return this; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamName() == null) ? 0 : getStreamName().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getExclusiveStartShardId() == null) ? 0 : getExclusiveStartShardId().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); hashCode = prime * hashCode + ((getStreamCreationTimestamp() == null) ? 0 : getStreamCreationTimestamp().hashCode()); return hashCode; }
private ListShardsResult listShards(final String nextToken) { final ListShardsRequest request = new ListShardsRequest(); request.setRequestCredentials(credentialsProvider.getCredentials()); if (StringUtils.isEmpty(nextToken)) { request.setStreamName(streamName); } else { request.setNextToken(nextToken);
private void refreshShards() { try { String nextToken = ""; List<Shard> shards = new ArrayList<>(); do { final ListShardsRequest request = new ListShardsRequest(); if (StringUtils.isEmpty(nextToken)) { request.setStreamName(streamName); } else { request.setNextToken(nextToken); } ListShardsResult result = kinesisClient.listShards(request); shards.addAll(result.getShards()); nextToken = result.getNextToken(); } while (!StringUtils.isEmpty(nextToken)); this.shards = shards; } catch (LimitExceededException | ResourceInUseException e) { //if the request is throttled, just wait for the next invocation and use cached shard description in the meantime LOG.debug("skipping watermark due to limit exceeded/resource in use exception"); } }
public Object run(AmazonKinesis client) { ListShardsRequest req = new ListShardsRequest().withStreamName(streamName); boolean hasMoreResults = true; List<Shard> shards = new ArrayList<>(); while (hasMoreResults) { if (shardIdStart != null) { req.withExclusiveStartShardId(shardIdStart); } ListShardsResult result = client.listShards(req); shards.addAll(result.getShards()); if (result.getNextToken() == null) { hasMoreResults = false; } else { req = new ListShardsRequest().withNextToken(result.getNextToken()); } } return shards; } };
public Object run(AmazonKinesis client) { // reduce the shardIdStart by 1 as the API uses it as an exclusive start key not // a filter String shardIdToQuery = new BigDecimal(shardIdStart).subtract(new BigDecimal("1")).toString(); ListShardsRequest req = new ListShardsRequest().withStreamName(streamName) .withExclusiveStartShardId(shardIdToQuery); ListShardsResult result = client.listShards(req); return result.getShards().get(0); } };
/** * <p> * Specify this parameter to indicate that you want to list the shards starting with the shard whose ID immediately * follows <code>ExclusiveStartShardId</code>. * </p> * <p> * If you don't specify this parameter, the default behavior is for <code>ListShards</code> to list the shards * starting with the first one in the stream. * </p> * <p> * You cannot specify this parameter if you specify <code>NextToken</code>. * </p> * * @param exclusiveStartShardId * Specify this parameter to indicate that you want to list the shards starting with the shard whose ID * immediately follows <code>ExclusiveStartShardId</code>.</p> * <p> * If you don't specify this parameter, the default behavior is for <code>ListShards</code> to list the * shards starting with the first one in the stream. * </p> * <p> * You cannot specify this parameter if you specify <code>NextToken</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public ListShardsRequest withExclusiveStartShardId(String exclusiveStartShardId) { setExclusiveStartShardId(exclusiveStartShardId); return this; }
/** * <p> * Specify this parameter to indicate that you want to list the shards starting with the shard whose ID immediately * follows <code>ExclusiveStartShardId</code>. * </p> * <p> * If you don't specify this parameter, the default behavior is for <code>ListShards</code> to list the shards * starting with the first one in the stream. * </p> * <p> * You cannot specify this parameter if you specify <code>NextToken</code>. * </p> * * @param exclusiveStartShardId * Specify this parameter to indicate that you want to list the shards starting with the shard whose ID * immediately follows <code>ExclusiveStartShardId</code>.</p> * <p> * If you don't specify this parameter, the default behavior is for <code>ListShards</code> to list the * shards starting with the first one in the stream. * </p> * <p> * You cannot specify this parameter if you specify <code>NextToken</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public ListShardsRequest withExclusiveStartShardId(String exclusiveStartShardId) { setExclusiveStartShardId(exclusiveStartShardId); return this; }
return false; ListShardsRequest other = (ListShardsRequest) obj; if (other.getStreamName() == null ^ this.getStreamName() == null) return false; if (other.getStreamName() != null && other.getStreamName().equals(this.getStreamName()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getExclusiveStartShardId() == null ^ this.getExclusiveStartShardId() == null) return false; if (other.getExclusiveStartShardId() != null && other.getExclusiveStartShardId().equals(this.getExclusiveStartShardId()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; if (other.getStreamCreationTimestamp() == null ^ this.getStreamCreationTimestamp() == null) return false; if (other.getStreamCreationTimestamp() != null && other.getStreamCreationTimestamp().equals(this.getStreamCreationTimestamp()) == false) return false; return true;
/** * <p> * The name of the data stream whose shards you want to list. * </p> * <p> * You cannot specify this parameter if you specify the <code>NextToken</code> parameter. * </p> * * @param streamName * The name of the data stream whose shards you want to list. </p> * <p> * You cannot specify this parameter if you specify the <code>NextToken</code> parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public ListShardsRequest withStreamName(String streamName) { setStreamName(streamName); return this; }
setNextToken(nextToken); 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 (getStreamName() != null) sb.append("StreamName: ").append(getStreamName()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getExclusiveStartShardId() != null) sb.append("ExclusiveStartShardId: ").append(getExclusiveStartShardId()).append(","); if (getMaxResults() != null) sb.append("MaxResults: ").append(getMaxResults()).append(","); if (getStreamCreationTimestamp() != null) sb.append("StreamCreationTimestamp: ").append(getStreamCreationTimestamp()); sb.append("}"); return sb.toString(); }
/** * Marshall the given parameter object. */ public void marshall(ListShardsRequest listShardsRequest, ProtocolMarshaller protocolMarshaller) { if (listShardsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listShardsRequest.getStreamName(), STREAMNAME_BINDING); protocolMarshaller.marshall(listShardsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listShardsRequest.getExclusiveStartShardId(), EXCLUSIVESTARTSHARDID_BINDING); protocolMarshaller.marshall(listShardsRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listShardsRequest.getStreamCreationTimestamp(), STREAMCREATIONTIMESTAMP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamName() == null) ? 0 : getStreamName().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getExclusiveStartShardId() == null) ? 0 : getExclusiveStartShardId().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); hashCode = prime * hashCode + ((getStreamCreationTimestamp() == null) ? 0 : getStreamCreationTimestamp() .hashCode()); return hashCode; }
ListShardsRequest other = (ListShardsRequest) obj; if (other.getStreamName() == null ^ this.getStreamName() == null) return false; if (other.getStreamName() != null && other.getStreamName().equals(this.getStreamName()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getExclusiveStartShardId() == null ^ this.getExclusiveStartShardId() == null) return false; if (other.getExclusiveStartShardId() != null && other.getExclusiveStartShardId().equals(this.getExclusiveStartShardId()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; if (other.getStreamCreationTimestamp() == null ^ this.getStreamCreationTimestamp() == null) return false; if (other.getStreamCreationTimestamp() != null && other.getStreamCreationTimestamp().equals(this.getStreamCreationTimestamp()) == false) return false; return true;
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStreamName() != null) sb.append("StreamName: " + getStreamName() + ","); if (getNextToken() != null) sb.append("NextToken: " + getNextToken() + ","); if (getExclusiveStartShardId() != null) sb.append("ExclusiveStartShardId: " + getExclusiveStartShardId() + ","); if (getMaxResults() != null) sb.append("MaxResults: " + getMaxResults() + ","); if (getStreamCreationTimestamp() != null) sb.append("StreamCreationTimestamp: " + getStreamCreationTimestamp()); sb.append("}"); return sb.toString(); }
jsonWriter.beginObject(); if (listShardsRequest.getStreamName() != null) { String streamName = listShardsRequest.getStreamName(); jsonWriter.name("StreamName"); jsonWriter.value(streamName); if (listShardsRequest.getNextToken() != null) { String nextToken = listShardsRequest.getNextToken(); jsonWriter.name("NextToken"); jsonWriter.value(nextToken); if (listShardsRequest.getExclusiveStartShardId() != null) { String exclusiveStartShardId = listShardsRequest.getExclusiveStartShardId(); jsonWriter.name("ExclusiveStartShardId"); jsonWriter.value(exclusiveStartShardId); if (listShardsRequest.getMaxResults() != null) { Integer maxResults = listShardsRequest.getMaxResults(); jsonWriter.name("MaxResults"); jsonWriter.value(maxResults); if (listShardsRequest.getStreamCreationTimestamp() != null) { java.util.Date streamCreationTimestamp = listShardsRequest .getStreamCreationTimestamp(); jsonWriter.name("StreamCreationTimestamp"); jsonWriter.value(streamCreationTimestamp);
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamName() == null) ? 0 : getStreamName().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getExclusiveStartShardId() == null) ? 0 : getExclusiveStartShardId().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); hashCode = prime * hashCode + ((getStreamCreationTimestamp() == null) ? 0 : getStreamCreationTimestamp().hashCode()); return hashCode; }
return false; ListShardsRequest other = (ListShardsRequest) obj; if (other.getStreamName() == null ^ this.getStreamName() == null) return false; if (other.getStreamName() != null && other.getStreamName().equals(this.getStreamName()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getExclusiveStartShardId() == null ^ this.getExclusiveStartShardId() == null) return false; if (other.getExclusiveStartShardId() != null && other.getExclusiveStartShardId().equals(this.getExclusiveStartShardId()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; if (other.getStreamCreationTimestamp() == null ^ this.getStreamCreationTimestamp() == null) return false; if (other.getStreamCreationTimestamp() != null && other.getStreamCreationTimestamp().equals(this.getStreamCreationTimestamp()) == false) return false; return true;