Show More
@@ -1,210 +1,234 b'' | |||||
1 | .. _server-methods-ref: |
|
1 | .. _server-methods-ref: | |
2 |
|
2 | |||
3 | server methods |
|
3 | server methods | |
4 | ============== |
|
4 | ============== | |
5 |
|
5 | |||
6 | cleanup_sessions |
|
6 | cleanup_sessions | |
7 | ---------------- |
|
7 | ---------------- | |
8 |
|
8 | |||
9 | .. py:function:: cleanup_sessions(apiuser, older_then=<Optional:60>) |
|
9 | .. py:function:: cleanup_sessions(apiuser, older_then=<Optional:60>) | |
10 |
|
10 | |||
11 | Triggers a session cleanup action. |
|
11 | Triggers a session cleanup action. | |
12 |
|
12 | |||
13 | If the ``older_then`` option is set, only sessions that hasn't been |
|
13 | If the ``older_then`` option is set, only sessions that hasn't been | |
14 | accessed in the given number of days will be removed. |
|
14 | accessed in the given number of days will be removed. | |
15 |
|
15 | |||
16 | This command can only be run using an |authtoken| with admin rights to |
|
16 | This command can only be run using an |authtoken| with admin rights to | |
17 | the specified repository. |
|
17 | the specified repository. | |
18 |
|
18 | |||
19 | This command takes the following options: |
|
19 | This command takes the following options: | |
20 |
|
20 | |||
21 | :param apiuser: This is filled automatically from the |authtoken|. |
|
21 | :param apiuser: This is filled automatically from the |authtoken|. | |
22 | :type apiuser: AuthUser |
|
22 | :type apiuser: AuthUser | |
23 | :param older_then: Deletes session that hasn't been accessed |
|
23 | :param older_then: Deletes session that hasn't been accessed | |
24 | in given number of days. |
|
24 | in given number of days. | |
25 | :type older_then: Optional(int) |
|
25 | :type older_then: Optional(int) | |
26 |
|
26 | |||
27 | Example output: |
|
27 | Example output: | |
28 |
|
28 | |||
29 | .. code-block:: bash |
|
29 | .. code-block:: bash | |
30 |
|
30 | |||
31 | id : <id_given_in_input> |
|
31 | id : <id_given_in_input> | |
32 | result: { |
|
32 | result: { | |
33 | "backend": "<type of backend>", |
|
33 | "backend": "<type of backend>", | |
34 | "sessions_removed": <number_of_removed_sessions> |
|
34 | "sessions_removed": <number_of_removed_sessions> | |
35 | } |
|
35 | } | |
36 | error : null |
|
36 | error : null | |
37 |
|
37 | |||
38 | Example error output: |
|
38 | Example error output: | |
39 |
|
39 | |||
40 | .. code-block:: bash |
|
40 | .. code-block:: bash | |
41 |
|
41 | |||
42 | id : <id_given_in_input> |
|
42 | id : <id_given_in_input> | |
43 | result : null |
|
43 | result : null | |
44 | error : { |
|
44 | error : { | |
45 | 'Error occurred during session cleanup' |
|
45 | 'Error occurred during session cleanup' | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | get_ip |
|
49 | get_ip | |
50 | ------ |
|
50 | ------ | |
51 |
|
51 | |||
52 | .. py:function:: get_ip(apiuser, userid=<Optional:<OptionalAttr:apiuser>>) |
|
52 | .. py:function:: get_ip(apiuser, userid=<Optional:<OptionalAttr:apiuser>>) | |
53 |
|
53 | |||
54 | Displays the IP Address as seen from the |RCE| server. |
|
54 | Displays the IP Address as seen from the |RCE| server. | |
55 |
|
55 | |||
56 | * This command displays the IP Address, as well as all the defined IP |
|
56 | * This command displays the IP Address, as well as all the defined IP | |
57 | addresses for the specified user. If the ``userid`` is not set, the |
|
57 | addresses for the specified user. If the ``userid`` is not set, the | |
58 | data returned is for the user calling the method. |
|
58 | data returned is for the user calling the method. | |
59 |
|
59 | |||
60 | This command can only be run using an |authtoken| with admin rights to |
|
60 | This command can only be run using an |authtoken| with admin rights to | |
61 | the specified repository. |
|
61 | the specified repository. | |
62 |
|
62 | |||
63 | This command takes the following options: |
|
63 | This command takes the following options: | |
64 |
|
64 | |||
65 | :param apiuser: This is filled automatically from |authtoken|. |
|
65 | :param apiuser: This is filled automatically from |authtoken|. | |
66 | :type apiuser: AuthUser |
|
66 | :type apiuser: AuthUser | |
67 | :param userid: Sets the userid for which associated IP Address data |
|
67 | :param userid: Sets the userid for which associated IP Address data | |
68 | is returned. |
|
68 | is returned. | |
69 | :type userid: Optional(str or int) |
|
69 | :type userid: Optional(str or int) | |
70 |
|
70 | |||
71 | Example output: |
|
71 | Example output: | |
72 |
|
72 | |||
73 | .. code-block:: bash |
|
73 | .. code-block:: bash | |
74 |
|
74 | |||
75 | id : <id_given_in_input> |
|
75 | id : <id_given_in_input> | |
76 | result : { |
|
76 | result : { | |
77 | "server_ip_addr": "<ip_from_clien>", |
|
77 | "server_ip_addr": "<ip_from_clien>", | |
78 | "user_ips": [ |
|
78 | "user_ips": [ | |
79 | { |
|
79 | { | |
80 | "ip_addr": "<ip_with_mask>", |
|
80 | "ip_addr": "<ip_with_mask>", | |
81 | "ip_range": ["<start_ip>", "<end_ip>"], |
|
81 | "ip_range": ["<start_ip>", "<end_ip>"], | |
82 | }, |
|
82 | }, | |
83 | ... |
|
83 | ... | |
84 | ] |
|
84 | ] | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 |
|
87 | |||
88 | get_method |
|
88 | get_method | |
89 | ---------- |
|
89 | ---------- | |
90 |
|
90 | |||
91 | .. py:function:: get_method(apiuser, pattern=<Optional:'*'>) |
|
91 | .. py:function:: get_method(apiuser, pattern=<Optional:'*'>) | |
92 |
|
92 | |||
93 | Returns list of all available API methods. By default match pattern |
|
93 | Returns list of all available API methods. By default match pattern | |
94 | os "*" but any other pattern can be specified. eg *comment* will return |
|
94 | os "*" but any other pattern can be specified. eg *comment* will return | |
95 | all methods with comment inside them. If just single method is matched |
|
95 | all methods with comment inside them. If just single method is matched | |
96 | returned data will also include method specification |
|
96 | returned data will also include method specification | |
97 |
|
97 | |||
98 | This command can only be run using an |authtoken| with admin rights to |
|
98 | This command can only be run using an |authtoken| with admin rights to | |
99 | the specified repository. |
|
99 | the specified repository. | |
100 |
|
100 | |||
101 | This command takes the following options: |
|
101 | This command takes the following options: | |
102 |
|
102 | |||
103 | :param apiuser: This is filled automatically from the |authtoken|. |
|
103 | :param apiuser: This is filled automatically from the |authtoken|. | |
104 | :type apiuser: AuthUser |
|
104 | :type apiuser: AuthUser | |
105 | :param pattern: pattern to match method names against |
|
105 | :param pattern: pattern to match method names against | |
106 | :type older_then: Optional("*") |
|
106 | :type older_then: Optional("*") | |
107 |
|
107 | |||
108 | Example output: |
|
108 | Example output: | |
109 |
|
109 | |||
110 | .. code-block:: bash |
|
110 | .. code-block:: bash | |
111 |
|
111 | |||
112 | id : <id_given_in_input> |
|
112 | id : <id_given_in_input> | |
113 | "result": [ |
|
113 | "result": [ | |
114 | "changeset_comment", |
|
114 | "changeset_comment", | |
115 | "comment_pull_request", |
|
115 | "comment_pull_request", | |
116 | "comment_commit" |
|
116 | "comment_commit" | |
117 | ] |
|
117 | ] | |
118 | error : null |
|
118 | error : null | |
119 |
|
119 | |||
120 | .. code-block:: bash |
|
120 | .. code-block:: bash | |
121 |
|
121 | |||
122 | id : <id_given_in_input> |
|
122 | id : <id_given_in_input> | |
123 | "result": [ |
|
123 | "result": [ | |
124 | "comment_commit", |
|
124 | "comment_commit", | |
125 | { |
|
125 | { | |
126 | "apiuser": "<RequiredType>", |
|
126 | "apiuser": "<RequiredType>", | |
127 | "comment_type": "<Optional:u'note'>", |
|
127 | "comment_type": "<Optional:u'note'>", | |
128 | "commit_id": "<RequiredType>", |
|
128 | "commit_id": "<RequiredType>", | |
129 | "message": "<RequiredType>", |
|
129 | "message": "<RequiredType>", | |
130 | "repoid": "<RequiredType>", |
|
130 | "repoid": "<RequiredType>", | |
131 | "request": "<RequiredType>", |
|
131 | "request": "<RequiredType>", | |
132 | "resolves_comment_id": "<Optional:None>", |
|
132 | "resolves_comment_id": "<Optional:None>", | |
133 | "status": "<Optional:None>", |
|
133 | "status": "<Optional:None>", | |
134 | "userid": "<Optional:<OptionalAttr:apiuser>>" |
|
134 | "userid": "<Optional:<OptionalAttr:apiuser>>" | |
135 | } |
|
135 | } | |
136 | ] |
|
136 | ] | |
137 | error : null |
|
137 | error : null | |
138 |
|
138 | |||
139 |
|
139 | |||
|
140 | get_repo_store | |||
|
141 | -------------- | |||
|
142 | ||||
|
143 | .. py:function:: get_repo_store(apiuser) | |||
|
144 | ||||
|
145 | Returns the |RCE| repository storage information. | |||
|
146 | ||||
|
147 | :param apiuser: This is filled automatically from the |authtoken|. | |||
|
148 | :type apiuser: AuthUser | |||
|
149 | ||||
|
150 | Example output: | |||
|
151 | ||||
|
152 | .. code-block:: bash | |||
|
153 | ||||
|
154 | id : <id_given_in_input> | |||
|
155 | result : { | |||
|
156 | 'modules': [<module name>,...] | |||
|
157 | 'py_version': <python version>, | |||
|
158 | 'platform': <platform type>, | |||
|
159 | 'rhodecode_version': <rhodecode version> | |||
|
160 | } | |||
|
161 | error : null | |||
|
162 | ||||
|
163 | ||||
140 | get_server_info |
|
164 | get_server_info | |
141 | --------------- |
|
165 | --------------- | |
142 |
|
166 | |||
143 | .. py:function:: get_server_info(apiuser) |
|
167 | .. py:function:: get_server_info(apiuser) | |
144 |
|
168 | |||
145 | Returns the |RCE| server information. |
|
169 | Returns the |RCE| server information. | |
146 |
|
170 | |||
147 | This includes the running version of |RCE| and all installed |
|
171 | This includes the running version of |RCE| and all installed | |
148 | packages. This command takes the following options: |
|
172 | packages. This command takes the following options: | |
149 |
|
173 | |||
150 | :param apiuser: This is filled automatically from the |authtoken|. |
|
174 | :param apiuser: This is filled automatically from the |authtoken|. | |
151 | :type apiuser: AuthUser |
|
175 | :type apiuser: AuthUser | |
152 |
|
176 | |||
153 | Example output: |
|
177 | Example output: | |
154 |
|
178 | |||
155 | .. code-block:: bash |
|
179 | .. code-block:: bash | |
156 |
|
180 | |||
157 | id : <id_given_in_input> |
|
181 | id : <id_given_in_input> | |
158 | result : { |
|
182 | result : { | |
159 | 'modules': [<module name>,...] |
|
183 | 'modules': [<module name>,...] | |
160 | 'py_version': <python version>, |
|
184 | 'py_version': <python version>, | |
161 | 'platform': <platform type>, |
|
185 | 'platform': <platform type>, | |
162 | 'rhodecode_version': <rhodecode version> |
|
186 | 'rhodecode_version': <rhodecode version> | |
163 | } |
|
187 | } | |
164 | error : null |
|
188 | error : null | |
165 |
|
189 | |||
166 |
|
190 | |||
167 | rescan_repos |
|
191 | rescan_repos | |
168 | ------------ |
|
192 | ------------ | |
169 |
|
193 | |||
170 | .. py:function:: rescan_repos(apiuser, remove_obsolete=<Optional:False>) |
|
194 | .. py:function:: rescan_repos(apiuser, remove_obsolete=<Optional:False>) | |
171 |
|
195 | |||
172 | Triggers a rescan of the specified repositories. |
|
196 | Triggers a rescan of the specified repositories. | |
173 |
|
197 | |||
174 | * If the ``remove_obsolete`` option is set, it also deletes repositories |
|
198 | * If the ``remove_obsolete`` option is set, it also deletes repositories | |
175 | that are found in the database but not on the file system, so called |
|
199 | that are found in the database but not on the file system, so called | |
176 | "clean zombies". |
|
200 | "clean zombies". | |
177 |
|
201 | |||
178 | This command can only be run using an |authtoken| with admin rights to |
|
202 | This command can only be run using an |authtoken| with admin rights to | |
179 | the specified repository. |
|
203 | the specified repository. | |
180 |
|
204 | |||
181 | This command takes the following options: |
|
205 | This command takes the following options: | |
182 |
|
206 | |||
183 | :param apiuser: This is filled automatically from the |authtoken|. |
|
207 | :param apiuser: This is filled automatically from the |authtoken|. | |
184 | :type apiuser: AuthUser |
|
208 | :type apiuser: AuthUser | |
185 | :param remove_obsolete: Deletes repositories from the database that |
|
209 | :param remove_obsolete: Deletes repositories from the database that | |
186 | are not found on the filesystem. |
|
210 | are not found on the filesystem. | |
187 | :type remove_obsolete: Optional(``True`` | ``False``) |
|
211 | :type remove_obsolete: Optional(``True`` | ``False``) | |
188 |
|
212 | |||
189 | Example output: |
|
213 | Example output: | |
190 |
|
214 | |||
191 | .. code-block:: bash |
|
215 | .. code-block:: bash | |
192 |
|
216 | |||
193 | id : <id_given_in_input> |
|
217 | id : <id_given_in_input> | |
194 | result : { |
|
218 | result : { | |
195 | 'added': [<added repository name>,...] |
|
219 | 'added': [<added repository name>,...] | |
196 | 'removed': [<removed repository name>,...] |
|
220 | 'removed': [<removed repository name>,...] | |
197 | } |
|
221 | } | |
198 | error : null |
|
222 | error : null | |
199 |
|
223 | |||
200 | Example error output: |
|
224 | Example error output: | |
201 |
|
225 | |||
202 | .. code-block:: bash |
|
226 | .. code-block:: bash | |
203 |
|
227 | |||
204 | id : <id_given_in_input> |
|
228 | id : <id_given_in_input> | |
205 | result : null |
|
229 | result : null | |
206 | error : { |
|
230 | error : { | |
207 | 'Error occurred during rescan repositories action' |
|
231 | 'Error occurred during rescan repositories action' | |
208 | } |
|
232 | } | |
209 |
|
233 | |||
210 |
|
234 |
General Comments 0
You need to be logged in to leave comments.
Login now