code: public void setNodeGroupsToRetain(java.util.Collection<String> nodeGroupsToRetain) {
          if (nodeGroupsToRetain == null) {
              this.nodeGroupsToRetain = null;
              return;
          }
  
          this.nodeGroupsToRetain = new com.amazonaws.internal.SdkInternalList<String>(nodeGroupsToRetain);
      }
docs: <p>
  If the value of <code>NodeGroupCount</code> is less than the current number of node groups (shards), the
  <code>NodeGroupsToRemove</code> or <code>NodeGroupsToRetain</code> is a required list of node group ids to remove
  from or retain in the cluster.
  </p>
  <p>
  ElastiCache for Redis will attempt to remove all node groups except those listed by
  <code>NodeGroupsToRetain</code> from the cluster.
  </p>
  
  @param nodeGroupsToRetain
  If the value of <code>NodeGroupCount</code> is less than the current number of node groups (shards), the
  <code>NodeGroupsToRemove</code> or <code>NodeGroupsToRetain</code> is a required list of node group ids to
  remove from or retain in the cluster.</p>
  <p>
  ElastiCache for Redis will attempt to remove all node groups except those listed by
  <code>NodeGroupsToRetain</code> from the cluster.