private function applyHeaders(RequestInterface $request)
    {
        $headers = [
            'User-Agent' => 'gcloud-php/' . $this->componentVersion,
            'x-goog-api-client' => 'gl-php/' . PHP_VERSION . ' gccl/' . $this->componentVersion,
        ];

        if ($this->shouldSignRequest) {
            $headers['Authorization'] = 'Bearer ' . $this->getToken();
        }

        return Psr7\modify_request($request, ['set_headers' => $headers]);
    }