summaryrefslogtreecommitdiff
path: root/docs/ext/manager_tmpl.j2
blob: fee8a568b81810ae18fe7393ae56abd9404d8d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Manager for {{ cls | classref() }} objects.

{% if cls.canUpdate %}
{{ cls | classref() }} objects can be updated.
{% else %}
{{ cls | classref() }} objects **cannot** be updated.
{% endif %}

{% if cls.canList %}
.. method:: list(**kwargs)

   Returns a list of objects of type {{ cls | classref() }}.

   Available keys for ``kwargs`` are:

   {% for k in cls.requiredListAttrs %}
   * ``{{ k }}`` (required)
   {% endfor %}
   {% for k in cls.optionalListAttrs %}
   * ``{{ k }}`` (optional)
   {% endfor %}
   * ``per_page`` (int): number of item per page. May be limited  by the server.
   * ``page`` (int): page to retrieve
   * ``all`` (bool): iterate over all the pages and return all the entries
   * ``sudo`` (string or int): run the request as another user (requires admin
     permissions)
{% endif %}

{% if cls.canGet %}
{% if cls.getRequiresId %}
.. method:: get(id, **kwargs)

   Get a single object of type {{ cls | classref() }} using its ``id``.
{% else %}
.. method:: get(**kwargs)

   Get a single object of type {{ cls | classref() }}.
{% endif %}

   Available keys for ``kwargs`` are:

   {% for k in cls.requiredGetAttrs %}
   * ``{{ k }}`` (required)
   {% endfor %}
   {% for k in cls.optionalGetAttrs %}
   * ``{{ k }}`` (optional)
   {% endfor %}
   * ``sudo`` (string or int): run the request as another user (requires admin
     permissions)
{% endif %}

{% if cls.canCreate %}
.. method:: create(data, **kwargs)

   Create an object of type {{ cls | classref() }}.

   ``data`` is a dict defining the object attributes. Available attributes are:

   {% for a in cls.requiredUrlAttrs %}
   * ``{{ a }}`` (required if not discovered on the parent objects)
   {% endfor %}
   {% for a in cls.requiredCreateAttrs %}
   * ``{{ a }}`` (required)
   {% endfor %}
   {% for a in cls.optionalCreateAttrs %}
   * ``{{ a }}`` (optional)
   {% endfor %}

   Available keys for ``kwargs`` are:

   * ``sudo`` (string or int): run the request as another user (requires admin
     permissions)
{% endif %}

{% if cls.canDelete %}
.. method:: delete(id, **kwargs)

   Delete the object with ID ``id``.

   Available keys for ``kwargs`` are:

   * ``sudo`` (string or int): run the request as another user (requires admin
     permissions)
{% endif %}