public static DescribeQuorumResponseData singletonDescribeQuorumResponse(
        short apiVersion,
        TopicPartition topicPartition,
        int leaderId,
        int leaderEpoch,
        long highWatermark,
        Collection<LeaderState.ReplicaState> voters,
        Collection<LeaderState.ReplicaState> observers,
        long currentTimeMs
    ) {
        DescribeQuorumResponseData response = new DescribeQuorumResponseData()
            .setTopics(
                Collections.singletonList(
                    new DescribeQuorumResponseData.TopicData()
                        .setTopicName(topicPartition.topic())
                        .setPartitions(
                            Collections.singletonList(
                                new DescribeQuorumResponseData.PartitionData()
                                    .setPartitionIndex(topicPartition.partition())
                                    .setErrorCode(Errors.NONE.code())
                                    .setLeaderId(leaderId)
                                    .setLeaderEpoch(leaderEpoch)
                                    .setHighWatermark(highWatermark)
                                    .setCurrentVoters(toReplicaStates(apiVersion, leaderId, voters, currentTimeMs))
                                    .setObservers(toReplicaStates(apiVersion, leaderId, observers, currentTimeMs))))));
        if (apiVersion >= 2) {
            DescribeQuorumResponseData.NodeCollection nodes = new DescribeQuorumResponseData.NodeCollection(voters.size());
            for (LeaderState.ReplicaState voter : voters) {
                nodes.add(
                    new DescribeQuorumResponseData.Node()
                        .setNodeId(voter.replicaKey().id())
                        .setListeners(voter.listeners().toDescribeQuorumResponseListeners())
                );
            }
            response.setNodes(nodes);
        }
        return response;
    }
Creates a FetchSnapshotResponseData with a single PartitionSnapshot for the topic partition.

The partition index will already be populated when calling operator.

@param listenerName the listener used to accept the request
@param apiVersion the api version of the request
@param topicPartition the topic partition to include
@param leaderId the id of the leader
@param endpoints the endpoints of the leader
@param operator unary operator responsible for populating all of the appropriate fields
@return the created fetch snapshot response data
raft/src/main/java/org/apache/kafka/raft/RaftUtil.java