qapi/qom: Add ObjectOptions for authz-*
[qemu.git] / qapi / qom.json
blob30ed179bc1413cafc3b026b4805c6a1451ab31e4
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 # This work is licensed under the terms of the GNU GPL, version 2 or later.
5 # See the COPYING file in the top-level directory.
7 { 'include': 'authz.json' }
9 ##
10 # = QEMU Object Model (QOM)
14 # @ObjectPropertyInfo:
16 # @name: the name of the property
18 # @type: the type of the property.  This will typically come in one of four
19 #        forms:
21 #        1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
22 #           These types are mapped to the appropriate JSON type.
24 #        2) A child type in the form 'child<subtype>' where subtype is a qdev
25 #           device type name.  Child properties create the composition tree.
27 #        3) A link type in the form 'link<subtype>' where subtype is a qdev
28 #           device type name.  Link properties form the device model graph.
30 # @description: if specified, the description of the property.
32 # @default-value: the default value, if any (since 5.0)
34 # Since: 1.2
36 { 'struct': 'ObjectPropertyInfo',
37   'data': { 'name': 'str',
38             'type': 'str',
39             '*description': 'str',
40             '*default-value': 'any' } }
43 # @qom-list:
45 # This command will list any properties of a object given a path in the object
46 # model.
48 # @path: the path within the object model.  See @qom-get for a description of
49 #        this parameter.
51 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
52 #          object.
54 # Since: 1.2
56 # Example:
58 # -> { "execute": "qom-list",
59 #      "arguments": { "path": "/chardevs" } }
60 # <- { "return": [ { "name": "type", "type": "string" },
61 #                  { "name": "parallel0", "type": "child<chardev-vc>" },
62 #                  { "name": "serial0", "type": "child<chardev-vc>" },
63 #                  { "name": "mon0", "type": "child<chardev-stdio>" } ] }
66 { 'command': 'qom-list',
67   'data': { 'path': 'str' },
68   'returns': [ 'ObjectPropertyInfo' ],
69   'allow-preconfig': true }
72 # @qom-get:
74 # This command will get a property from a object model path and return the
75 # value.
77 # @path: The path within the object model.  There are two forms of supported
78 #        paths--absolute and partial paths.
80 #        Absolute paths are derived from the root object and can follow child<>
81 #        or link<> properties.  Since they can follow link<> properties, they
82 #        can be arbitrarily long.  Absolute paths look like absolute filenames
83 #        and are prefixed  with a leading slash.
85 #        Partial paths look like relative filenames.  They do not begin
86 #        with a prefix.  The matching rules for partial paths are subtle but
87 #        designed to make specifying objects easy.  At each level of the
88 #        composition tree, the partial path is matched as an absolute path.
89 #        The first match is not returned.  At least two matches are searched
90 #        for.  A successful result is only returned if only one match is
91 #        found.  If more than one match is found, a flag is return to
92 #        indicate that the match was ambiguous.
94 # @property: The property name to read
96 # Returns: The property value.  The type depends on the property
97 #          type. child<> and link<> properties are returned as #str
98 #          pathnames.  All integer property types (u8, u16, etc) are
99 #          returned as #int.
101 # Since: 1.2
103 # Example:
105 # 1. Use absolute path
107 # -> { "execute": "qom-get",
108 #      "arguments": { "path": "/machine/unattached/device[0]",
109 #                     "property": "hotplugged" } }
110 # <- { "return": false }
112 # 2. Use partial path
114 # -> { "execute": "qom-get",
115 #      "arguments": { "path": "unattached/sysbus",
116 #                     "property": "type" } }
117 # <- { "return": "System" }
120 { 'command': 'qom-get',
121   'data': { 'path': 'str', 'property': 'str' },
122   'returns': 'any',
123   'allow-preconfig': true }
126 # @qom-set:
128 # This command will set a property from a object model path.
130 # @path: see @qom-get for a description of this parameter
132 # @property: the property name to set
134 # @value: a value who's type is appropriate for the property type.  See @qom-get
135 #         for a description of type mapping.
137 # Since: 1.2
139 # Example:
141 # -> { "execute": "qom-set",
142 #      "arguments": { "path": "/machine",
143 #                     "property": "graphics",
144 #                     "value": false } }
145 # <- { "return": {} }
148 { 'command': 'qom-set',
149   'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
150   'allow-preconfig': true }
153 # @ObjectTypeInfo:
155 # This structure describes a search result from @qom-list-types
157 # @name: the type name found in the search
159 # @abstract: the type is abstract and can't be directly instantiated.
160 #            Omitted if false. (since 2.10)
162 # @parent: Name of parent type, if any (since 2.10)
164 # Since: 1.1
166 { 'struct': 'ObjectTypeInfo',
167   'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
170 # @qom-list-types:
172 # This command will return a list of types given search parameters
174 # @implements: if specified, only return types that implement this type name
176 # @abstract: if true, include abstract types in the results
178 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
180 # Since: 1.1
182 { 'command': 'qom-list-types',
183   'data': { '*implements': 'str', '*abstract': 'bool' },
184   'returns': [ 'ObjectTypeInfo' ],
185   'allow-preconfig': true }
188 # @qom-list-properties:
190 # List properties associated with a QOM object.
192 # @typename: the type name of an object
194 # Note: objects can create properties at runtime, for example to describe
195 #       links between different devices and/or objects. These properties
196 #       are not included in the output of this command.
198 # Returns: a list of ObjectPropertyInfo describing object properties
200 # Since: 2.12
202 { 'command': 'qom-list-properties',
203   'data': { 'typename': 'str'},
204   'returns': [ 'ObjectPropertyInfo' ],
205   'allow-preconfig': true }
208 # @IothreadProperties:
210 # Properties for iothread objects.
212 # @poll-max-ns: the maximum number of nanoseconds to busy wait for events.
213 #               0 means polling is disabled (default: 32768 on POSIX hosts,
214 #               0 otherwise)
216 # @poll-grow: the multiplier used to increase the polling time when the
217 #             algorithm detects it is missing events due to not polling long
218 #             enough. 0 selects a default behaviour (default: 0)
220 # @poll-shrink: the divisor used to decrease the polling time when the
221 #               algorithm detects it is spending too long polling without
222 #               encountering events. 0 selects a default behaviour (default: 0)
224 # Since: 2.0
226 { 'struct': 'IothreadProperties',
227   'data': { '*poll-max-ns': 'int',
228             '*poll-grow': 'int',
229             '*poll-shrink': 'int' } }
232 # @ObjectType:
234 # Since: 6.0
236 { 'enum': 'ObjectType',
237   'data': [
238     'authz-list',
239     'authz-listfile',
240     'authz-pam',
241     'authz-simple',
242     'iothread'
243   ] }
246 # @ObjectOptions:
248 # Describes the options of a user creatable QOM object.
250 # @qom-type: the class name for the object to be created
252 # @id: the name of the new object
254 # Since: 6.0
256 { 'union': 'ObjectOptions',
257   'base': { 'qom-type': 'ObjectType',
258             'id': 'str' },
259   'discriminator': 'qom-type',
260   'data': {
261       'authz-list':                 'AuthZListProperties',
262       'authz-listfile':             'AuthZListFileProperties',
263       'authz-pam':                  'AuthZPAMProperties',
264       'authz-simple':               'AuthZSimpleProperties',
265       'iothread':                   'IothreadProperties'
266   } }
269 # @object-add:
271 # Create a QOM object.
273 # @qom-type: the class name for the object to be created
275 # @id: the name of the new object
277 # Additional arguments depend on qom-type and are passed to the backend
278 # unchanged.
280 # Returns: Nothing on success
281 #          Error if @qom-type is not a valid class name
283 # Since: 2.0
285 # Example:
287 # -> { "execute": "object-add",
288 #      "arguments": { "qom-type": "rng-random", "id": "rng1",
289 #                     "filename": "/dev/hwrng" } }
290 # <- { "return": {} }
293 { 'command': 'object-add',
294   'data': {'qom-type': 'str', 'id': 'str'},
295   'gen': false } # so we can get the additional arguments
298 # @object-del:
300 # Remove a QOM object.
302 # @id: the name of the QOM object to remove
304 # Returns: Nothing on success
305 #          Error if @id is not a valid id for a QOM object
307 # Since: 2.0
309 # Example:
311 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
312 # <- { "return": {} }
315 { 'command': 'object-del', 'data': {'id': 'str'} }