public function setInternalKey($key)
    {
        if ($this->_key !== null && $this->_key !== $key) {
            throw new ClientException('Should not update the key of an existing document');
        }

        if (!preg_match('/^[a-zA-Z0-9_:.@\-()+,=;$!*\'%]{1,254}$/', $key)) {
            throw new ClientException('Invalid format for document key');
        }

        $this->_key = (string) $key;
    }