@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeStreamResult == false) return false; DescribeStreamResult other = (DescribeStreamResult) obj; if (other.getStreamDescription() == null ^ this.getStreamDescription() == null) return false; if (other.getStreamDescription() != null && other.getStreamDescription().equals(this.getStreamDescription()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamDescription() == null) ? 0 : getStreamDescription().hashCode()); return hashCode; }
/** * 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 (getStreamDescription() != null) sb.append("StreamDescription: ").append(getStreamDescription()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeStreamResult == false) return false; DescribeStreamResult other = (DescribeStreamResult) obj; if (other.getStreamDescription() == null ^ this.getStreamDescription() == null) return false; if (other.getStreamDescription() != null && other.getStreamDescription().equals(this.getStreamDescription()) == false) return false; return true; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamDescription() == null) ? 0 : getStreamDescription().hashCode()); return hashCode; }
/** * 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 (getStreamDescription() != null) sb.append("StreamDescription: ").append(getStreamDescription()); sb.append("}"); return sb.toString(); }
/** * Constructs a new result using a DynamoDBStreams object. * * @param result Instance of DynamoDBStreams DescribeStreamResult */ public DescribeStreamResultAdapter(com.amazonaws.services.dynamodbv2.model.DescribeStreamResult result) { streamDescription = new StreamDescriptionAdapter(result.getStreamDescription()); }
/** * Constructs a new result using a DynamoDBStreams object. * * @param result Instance of DynamoDBStreams DescribeStreamResult */ public DescribeStreamResultAdapter(com.amazonaws.services.dynamodbv2.model.DescribeStreamResult result) { streamDescription = new StreamDescriptionAdapter(result.getStreamDescription()); }
private List<Shard> getAllShardsForDisabledStream(com.amazonaws.services.dynamodbv2.model.DescribeStreamResult initialResult) { List<Shard> shards = new ArrayList<Shard>(); shards.addAll(initialResult.getStreamDescription().getShards()); com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest request; com.amazonaws.services.dynamodbv2.model.DescribeStreamResult result = initialResult; // Allowing KCL to paginate calls will not allow us to correctly determine the // leaf nodes. In order to avoid pagination issues when feigning shard activity, we collect all // shards in the adapter and return them at once. while (result.getStreamDescription().getLastEvaluatedShardId() != null) { request = new com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest().withStreamArn(result.getStreamDescription().getStreamArn()) .withExclusiveStartShardId(result.getStreamDescription().getLastEvaluatedShardId()); try { result = internalClient.describeStream(request); } catch (AmazonServiceException e) { throw AmazonServiceExceptionTransformer.transformDynamoDBStreamsToKinesisDescribeStream(e); } shards.addAll(result.getStreamDescription().getShards()); } return shards; }
private List<Shard> getAllShardsForDisabledStream(com.amazonaws.services.dynamodbv2.model.DescribeStreamResult initialResult) { List<Shard> shards = new ArrayList<Shard>(); shards.addAll(initialResult.getStreamDescription().getShards()); com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest request; com.amazonaws.services.dynamodbv2.model.DescribeStreamResult result = initialResult; // Allowing KCL to paginate calls will not allow us to correctly determine the // leaf nodes. In order to avoid pagination issues when feigning shard activity, we collect all // shards in the adapter and return them at once. while (result.getStreamDescription().getLastEvaluatedShardId() != null) { request = new com.amazonaws.services.dynamodbv2.model.DescribeStreamRequest().withStreamArn(result.getStreamDescription().getStreamArn()) .withExclusiveStartShardId(result.getStreamDescription().getLastEvaluatedShardId()); try { result = internalClient.describeStream(request); } catch (AmazonServiceException e) { throw AmazonServiceExceptionTransformer.transformDynamoDBStreamsToKinesisDescribeStream(e); } shards.addAll(result.getStreamDescription().getShards()); } return shards; }
/** * Check whether Streams is enabled on the given argument with the given stream view type * * @param streamsClient * streams client used to access the given stream * @param streamArn * the stream ARN to check against * @param viewType * the stream view type to check against * @return a boolean indicating whether the given stream is enabled and matches the given stream view type */ public static boolean isStreamsEnabled(AmazonDynamoDBStreams streamsClient, String streamArn, StreamViewType viewType) { // Get and check stream description StreamDescription result = streamsClient.describeStream(new DescribeStreamRequest().withStreamArn(streamArn)) .getStreamDescription(); if (result.getStreamStatus().equalsIgnoreCase(DynamoDBConnectorConstants.ENABLED_STRING) && result.getStreamViewType().equalsIgnoreCase(viewType.toString())) { return true; } log.error(DynamoDBConnectorConstants.STREAM_NOT_READY + " StreamARN: " + streamArn); return false; } }
throw AmazonServiceExceptionTransformer.transformDynamoDBStreamsToKinesisDescribeStream(e); if (result.getStreamDescription().getStreamStatus().equals("DISABLED")) { markLeafShardsAsActive(allShards); StreamDescription newStreamDescription = new StreamDescription().withShards(allShards).withLastEvaluatedShardId(null).withCreationRequestDateTime(result.getStreamDescription().getCreationRequestDateTime()) .withKeySchema(result.getStreamDescription().getKeySchema()).withStreamArn(result.getStreamDescription().getStreamArn()) .withStreamLabel(result.getStreamDescription().getStreamLabel()).withStreamStatus(result.getStreamDescription().getStreamStatus()) .withTableName(result.getStreamDescription().getTableName()).withStreamViewType(result.getStreamDescription().getStreamViewType()); result = new com.amazonaws.services.dynamodbv2.model.DescribeStreamResult().withStreamDescription(newStreamDescription);
throw AmazonServiceExceptionTransformer.transformDynamoDBStreamsToKinesisDescribeStream(e); if (result.getStreamDescription().getStreamStatus().equals("DISABLED")) { markLeafShardsAsActive(allShards); StreamDescription newStreamDescription = new StreamDescription().withShards(allShards).withLastEvaluatedShardId(null).withCreationRequestDateTime(result.getStreamDescription().getCreationRequestDateTime()) .withKeySchema(result.getStreamDescription().getKeySchema()).withStreamArn(result.getStreamDescription().getStreamArn()) .withStreamLabel(result.getStreamDescription().getStreamLabel()).withStreamStatus(result.getStreamDescription().getStreamStatus()) .withTableName(result.getStreamDescription().getTableName()).withStreamViewType(result.getStreamDescription().getStreamViewType()); result = new com.amazonaws.services.dynamodbv2.model.DescribeStreamResult().withStreamDescription(newStreamDescription);
.withStreamArn(myStreamArn)); String streamArn = describeStreamResult.getStreamDescription().getStreamArn(); List<Shard> shards = describeStreamResult.getStreamDescription().getShards();