@Override
  protected void prepareBuffer() {
    super.prepareBuffer();
    bufferToSend.writeShort((short) type.ordinal());
    bufferToSend.writeByte(partitionId == null ? (byte) 0 : 1);
    if (partitionId != null) {
      bufferToSend.writeBytes(partitionId.getBytes());
    }
  }
Constructs an admin request with the given parameters.
@param type the type of the request.
@param partitionId the {@link PartitionId} that the operation should work on. {@link null} if not applicable.
@param correlationId an ID to help match responses to requests.
@param clientId the ID of the client.
ambry-protocol/src/main/java/com/github/ambry/protocol/AdminRequest.java