What are you hoping to get out of asking this question? It sounds like you already know the answer.
If the answer is that it's illegal I'd know I can't ask this directly/explicitly (but maybe there's a "secret handshake" way of asking for it). If it is I'd know I can. I wish no harm to OP.
IANAD but have paid close attention to this for the same reasons. When my time comes I plan to let them know I'm in serious pain and prefer pain relief to life extension (though maybe in a more subtle way). I expect most will understand that.