/* * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.kinesis.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *
* Updates the shard count of the specified stream to the specified number of * shards. *
*
* Updating the shard count is an asynchronous operation. Upon receiving the
* request, Kinesis Data Streams returns immediately and sets the status of the
* stream to UPDATING
. After the update is complete, Kinesis Data
* Streams sets the status of the stream back to ACTIVE
. Depending
* on the size of the stream, the scaling action could take a few minutes to
* complete. You can continue to read and write data to your stream while its
* status is UPDATING
.
*
* To update the shard count, Kinesis Data Streams performs splits or merges on * individual shards. This can cause short-lived shards to be created, in * addition to the final shards. We recommend that you double or halve the shard * count, as this results in the fewest number of splits or merges. *
** This operation has the following limits. You cannot do the following: *
** Scale more than twice per rolling 24-hour period per stream *
** Scale up to more than double your current shard count for a stream *
** Scale down below half your current shard count for a stream *
** Scale up to more than 500 shards in a stream *
** Scale a stream with more than 500 shards down unless the result is less than * 500 shards *
** Scale up to more than the shard limit for your account *
** For the default limits for an AWS account, see Streams Limits in the Amazon Kinesis Data Streams Developer * Guide. To request an increase in the call rate limit, the shard limit for * this API, or your overall shard limit, use the limits form. *
*/ public class UpdateShardCountRequest extends AmazonWebServiceRequest implements Serializable { /** ** The name of the stream. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.-]+
*/
private String streamName;
/**
*
* The new number of shards. *
*
* Constraints:
* Range: 1 - 100000
*/
private Integer targetShardCount;
/**
*
* The scaling type. Uniform scaling creates shards of equal size. *
*
* Constraints:
* Allowed Values: UNIFORM_SCALING
*/
private String scalingType;
/**
*
* The name of the stream. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.-]+
*
* @return
* The name of the stream. *
*/ public String getStreamName() { return streamName; } /** ** The name of the stream. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.-]+
*
* @param streamName
* The name of the stream. *
*/ public void setStreamName(String streamName) { this.streamName = streamName; } /** ** The name of the stream. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.-]+
*
* @param streamName
* The name of the stream. *
* @return A reference to this updated object so that method calls can be * chained together. */ public UpdateShardCountRequest withStreamName(String streamName) { this.streamName = streamName; return this; } /** ** The new number of shards. *
*
* Constraints:
* Range: 1 - 100000
*
* @return
* The new number of shards. *
*/ public Integer getTargetShardCount() { return targetShardCount; } /** ** The new number of shards. *
*
* Constraints:
* Range: 1 - 100000
*
* @param targetShardCount
* The new number of shards. *
*/ public void setTargetShardCount(Integer targetShardCount) { this.targetShardCount = targetShardCount; } /** ** The new number of shards. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Range: 1 - 100000
*
* @param targetShardCount
* The new number of shards. *
* @return A reference to this updated object so that method calls can be * chained together. */ public UpdateShardCountRequest withTargetShardCount(Integer targetShardCount) { this.targetShardCount = targetShardCount; return this; } /** ** The scaling type. Uniform scaling creates shards of equal size. *
*
* Constraints:
* Allowed Values: UNIFORM_SCALING
*
* @return
* The scaling type. Uniform scaling creates shards of equal size. *
* @see ScalingType */ public String getScalingType() { return scalingType; } /** ** The scaling type. Uniform scaling creates shards of equal size. *
*
* Constraints:
* Allowed Values: UNIFORM_SCALING
*
* @param scalingType
* The scaling type. Uniform scaling creates shards of equal * size. *
* @see ScalingType */ public void setScalingType(String scalingType) { this.scalingType = scalingType; } /** ** The scaling type. Uniform scaling creates shards of equal size. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: UNIFORM_SCALING
*
* @param scalingType
* The scaling type. Uniform scaling creates shards of equal * size. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ScalingType */ public UpdateShardCountRequest withScalingType(String scalingType) { this.scalingType = scalingType; return this; } /** ** The scaling type. Uniform scaling creates shards of equal size. *
*
* Constraints:
* Allowed Values: UNIFORM_SCALING
*
* @param scalingType
* The scaling type. Uniform scaling creates shards of equal * size. *
* @see ScalingType */ public void setScalingType(ScalingType scalingType) { this.scalingType = scalingType.toString(); } /** ** The scaling type. Uniform scaling creates shards of equal size. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: UNIFORM_SCALING
*
* @param scalingType
* The scaling type. Uniform scaling creates shards of equal * size. *
* @return A reference to this updated object so that method calls can be * chained together. * @see ScalingType */ public UpdateShardCountRequest withScalingType(ScalingType scalingType) { this.scalingType = scalingType.toString(); return this; } /** * 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 (getTargetShardCount() != null) sb.append("TargetShardCount: " + getTargetShardCount() + ","); if (getScalingType() != null) sb.append("ScalingType: " + getScalingType()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamName() == null) ? 0 : getStreamName().hashCode()); hashCode = prime * hashCode + ((getTargetShardCount() == null) ? 0 : getTargetShardCount().hashCode()); hashCode = prime * hashCode + ((getScalingType() == null) ? 0 : getScalingType().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof UpdateShardCountRequest == false) return false; UpdateShardCountRequest other = (UpdateShardCountRequest) obj; if (other.getStreamName() == null ^ this.getStreamName() == null) return false; if (other.getStreamName() != null && other.getStreamName().equals(this.getStreamName()) == false) return false; if (other.getTargetShardCount() == null ^ this.getTargetShardCount() == null) return false; if (other.getTargetShardCount() != null && other.getTargetShardCount().equals(this.getTargetShardCount()) == false) return false; if (other.getScalingType() == null ^ this.getScalingType() == null) return false; if (other.getScalingType() != null && other.getScalingType().equals(this.getScalingType()) == false) return false; return true; } }