def _update_state(self, operation_pb):
        """Update the state of the current object based on operation.

        :type operation_pb:
            :class:`~google.longrunning.operations_pb2.Operation`
        :param operation_pb: Protobuf to be parsed.
        """
        if operation_pb.done:
            self._complete = True

        if operation_pb.HasField("metadata"):
            self.metadata = _from_any(operation_pb.metadata)

        result_type = operation_pb.WhichOneof("result")
        if result_type == "error":
            self.error = operation_pb.error
        elif result_type == "response":
            self.response = _from_any(operation_pb.response)