public DecreaseNodeGroupsInGlobalReplicationGroupRequest withGlobalNodeGroupsToRetain(String... globalNodeGroupsToRetain) {
        if (this.globalNodeGroupsToRetain == null) {
            setGlobalNodeGroupsToRetain(new com.amazonaws.internal.SdkInternalList<String>(globalNodeGroupsToRetain.length));
        }
        for (String ele : globalNodeGroupsToRetain) {
            this.globalNodeGroupsToRetain.add(ele);
        }
        return this;
    }
<p>
If the value of NodeGroupCount is less than the current number of node groups (shards), then either
NodeGroupsToRemove or NodeGroupsToRetain is required. GlobalNodeGroupsToRetain is a list of NodeGroupIds to
retain from the cluster. ElastiCache (Redis OSS) will attempt to retain all node groups listed by
GlobalNodeGroupsToRetain from the cluster.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setGlobalNodeGroupsToRetain(java.util.Collection)} or
{@link #withGlobalNodeGroupsToRetain(java.util.Collection)} if you want to override the existing values.
</p>

@param globalNodeGroupsToRetain
       If the value of NodeGroupCount is less than the current number of node groups (shards), then either
       NodeGroupsToRemove or NodeGroupsToRetain is required. GlobalNodeGroupsToRetain is a list of NodeGroupIds
       to retain from the cluster. ElastiCache (Redis OSS) will attempt to retain all node groups listed by
       GlobalNodeGroupsToRetain from the cluster.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-elasticache/src/main/java/com/amazonaws/services/elasticache/model/DecreaseNodeGroupsInGlobalReplicationGroupRequest.java