+class _QueryResponseBase(ConfigObject):
+ __slots__ = [
+ "fields",
+ ]
+
+ def ToDict(self):
+ """Custom function for serializing.
+
+ """
+ mydict = super(_QueryResponseBase, self).ToDict()
+ mydict["fields"] = self._ContainerToDicts(mydict["fields"])
+ return mydict
+
+ @classmethod
+ def FromDict(cls, val):
+ """Custom function for de-serializing.
+
+ """
+ obj = super(_QueryResponseBase, cls).FromDict(val)
+ obj.fields = cls._ContainerFromDicts(obj.fields, list, QueryFieldDefinition)
+ return obj
+
+
+class QueryRequest(ConfigObject):
+ """Object holding a query request.
+
+ """
+ __slots__ = [
+ "what",
+ "fields",
+ "filter",
+ ]
+
+
+class QueryResponse(_QueryResponseBase):
+ """Object holding the response to a query.
+
+ @ivar fields: List of L{QueryFieldDefinition} objects
+ @ivar data: Requested data
+
+ """
+ __slots__ = [
+ "data",
+ ]
+
+
+class QueryFieldsRequest(ConfigObject):
+ """Object holding a request for querying available fields.
+
+ """
+ __slots__ = [
+ "what",
+ "fields",
+ ]
+
+
+class QueryFieldsResponse(_QueryResponseBase):
+ """Object holding the response to a query for fields.
+
+ @ivar fields: List of L{QueryFieldDefinition} objects
+
+ """
+ __slots__ = [
+ ]
+
+
+class InstanceConsole(ConfigObject):
+ """Object describing how to access the console of an instance.
+
+ """
+ __slots__ = [
+ "instance",
+ "kind",
+ "message",
+ "host",
+ "port",
+ "user",
+ "command",
+ "display",
+ ]
+
+ def Validate(self):
+ """Validates contents of this object.
+
+ """
+ assert self.kind in constants.CONS_ALL, "Unknown console type"
+ assert self.instance, "Missing instance name"
+ assert self.message or self.kind in [constants.CONS_SSH, constants.CONS_VNC]
+ assert self.host or self.kind == constants.CONS_MESSAGE
+ assert self.port or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_SSH]
+ assert self.user or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_VNC]
+ assert self.command or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_VNC]
+ assert self.display or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_SSH]
+ return True
+
+