root / docs / usage.rst @ a6370d73
History | View | Annotate | Download (13.9 kB)
1 |
Usage |
---|---|
2 |
===== |
3 |
|
4 |
Kamaki offers command line interfaces that implement specific command specifications. A detailed list of the command specifications can be found in `Commands <commands.html>`_ section. This guide covers the generic usage of both interfaces. |
5 |
|
6 |
What's more, kamaki offers a clients API that allows the developement of external applications for synnefo. The clients API is listed in the `Clients lib <clients.html>`_ section. The recomended method of utilizing this API is explained in the present. |
7 |
|
8 |
Setup |
9 |
----- |
10 |
|
11 |
Kamaki interfaces rely on a list of configuration options. In the initial state, kamaki is configured to communicate with the Okenos IaaS. A detailed guide for setting up kamaki can be found in the `Setup <setup.html>`_ section. |
12 |
|
13 |
Quick guide |
14 |
^^^^^^^^^^^ |
15 |
|
16 |
It is essential for users to get a configuration token (to get in Okeanos.grnet.gr log `here <https://accounts.okeanos.grnet.gr/im/>`_) and provide it to kamaki: |
17 |
|
18 |
.. code-block:: console |
19 |
|
20 |
$ kamaki set token myt0k3n== |
21 |
|
22 |
|
23 |
Example 1.1.1: Set user token to myt0k3n== |
24 |
|
25 |
To use the storage service, a user should also provide the corresponding username: |
26 |
|
27 |
.. code-block:: console |
28 |
|
29 |
$ kamaki set account user@domain.com |
30 |
|
31 |
|
32 |
Example 1.1.2: Set user name to user@domain.com |
33 |
|
34 |
Command line interfaces |
35 |
----------------------- |
36 |
Kamaki users can access synnefo services through either the interactive shell or the one-command behaviors. In practice, both systems relly on the same command set implementations and API clients, with identical responses and error messages. Still, there are some differenses. |
37 |
|
38 |
Shell vs one-command |
39 |
^^^^^^^^^^^^^^^^^^^^ |
40 |
In favor of interactive shell behavior: |
41 |
|
42 |
* tab completion for commands |
43 |
* session history with "up"/"down" keys |
44 |
* shorter commants with command namespace switching |
45 |
|
46 |
In favor of one-command behavior: |
47 |
|
48 |
* can be used along with advanced shell features (pipelines, redirection, etc.) |
49 |
* can be used in shell scripts |
50 |
* prints debug and verbose messages if needed |
51 |
|
52 |
Run as shell |
53 |
"""""""""""" |
54 |
To use kamaki as a shell, run: |
55 |
|
56 |
* without any parameters or arguments |
57 |
|
58 |
.. code-block:: console |
59 |
|
60 |
$ kamaki |
61 |
|
62 |
|
63 |
Example 2.2.1: Running kamaki shell |
64 |
|
65 |
|
66 |
* with any kind of '-' prefixed arguments, except '-h', '--help'. |
67 |
|
68 |
.. code-block:: console |
69 |
|
70 |
$ kamaki --config myconfig.file |
71 |
|
72 |
|
73 |
Example 2.2.2: Running kamaki shell with custom configuration file |
74 |
|
75 |
|
76 |
Run as one-command |
77 |
"""""""""""""""""" |
78 |
To use kamaki as an one-command tool, run: |
79 |
|
80 |
* with the '-h' or '--help' arguments (help for kamaki one-command) |
81 |
|
82 |
.. code-block:: console |
83 |
|
84 |
$kamaki -h |
85 |
|
86 |
|
87 |
Example 2.3.1: Kamaki help |
88 |
|
89 |
* with one or more command parameters: |
90 |
|
91 |
.. code-block:: console |
92 |
|
93 |
$ kamaki server list |
94 |
|
95 |
|
96 |
Example 2.3.2: List VMs managed by user |
97 |
|
98 |
Commands |
99 |
^^^^^^^^ |
100 |
|
101 |
Typically, commands consist of a group name (e.g. store for storage commands) one or more terms (e.g. list for listing) and the command specific parameters (e.g. the name of the container), if any. |
102 |
|
103 |
.. code-block:: console |
104 |
|
105 |
$ kamaki store list mycontainer |
106 |
|
107 |
|
108 |
Example 3.1.1: List stored files in container mycontainer |
109 |
|
110 |
Example 2.3.2 showcases a command without parameters (the group is "server", the command is "list"). |
111 |
|
112 |
The "server" command group is also refered in the following example. |
113 |
|
114 |
.. code-block:: console |
115 |
|
116 |
$ kamaki server info 42 |
117 |
|
118 |
|
119 |
Example 3.1.2: Show information about a user-managed VM with id 42 |
120 |
|
121 |
Client commands can feature an arbitarry number of terms: |
122 |
|
123 |
.. code-block:: text |
124 |
|
125 |
kamaki <group> <cmd term 1> <cmd term 2> ... <cmd term N> [arguments] |
126 |
|
127 |
Although there are no multi-termed client commands until version 0.6.1 , the feature is supported and might be used in feature extentions. |
128 |
|
129 |
The following pattern applies to all client commands up to version 0.6.1: |
130 |
|
131 |
.. code-block:: text |
132 |
|
133 |
kamaki <group> <command> [arguments] |
134 |
|
135 |
The commands supported in version 0.6.1 are described bellow, grouped by service: |
136 |
|
137 |
astakos (Identity Manager) |
138 |
"""""""""""""""""""""""""" |
139 |
|
140 |
.. code-block:: text |
141 |
|
142 |
authenticate: Authenticate a user |
143 |
|
144 |
flavor (Compute/Cyclades) |
145 |
""""""""""""""""""""""""" |
146 |
|
147 |
.. code-block:: text |
148 |
|
149 |
info: Get flavor details |
150 |
list: List flavors |
151 |
|
152 |
image (Compute/Cyclades + Glance) |
153 |
"""""""""""""""""""""""""""""""""" |
154 |
|
155 |
.. code-block:: text |
156 |
|
157 |
addmember : Add a member to an image |
158 |
addproperty: Add an image property |
159 |
delete : Delete image |
160 |
delmember : Remove a member from an image |
161 |
delproperty: Delete an image property |
162 |
info : Get image details |
163 |
list : List images |
164 |
members : Get image members |
165 |
meta : Get image metadata |
166 |
properties : Get image properties |
167 |
public : List public images |
168 |
register : (Re)Register an image |
169 |
setmembers : Set the members of an image |
170 |
setproperty: Update an image property |
171 |
shared : List shared images |
172 |
|
173 |
network (Compute/Cyclades) |
174 |
"""""""""""""""""""""""""" |
175 |
|
176 |
.. code-block:: text |
177 |
|
178 |
connect : Connect a server to a network |
179 |
create : Create a network |
180 |
delete : Delete a network |
181 |
disconnect: Disconnect a nic of a server to a network |
182 |
info : Get network details |
183 |
list : List networks |
184 |
rename : Update network name |
185 |
|
186 |
server (Compute/Cyclades) |
187 |
""""""""""""""""""""""""" |
188 |
|
189 |
.. code-block:: text |
190 |
|
191 |
addmeta : Add server metadata |
192 |
addr : List a server's nic address |
193 |
console : Get a VNC console |
194 |
create : Create a server |
195 |
delete : Delete a server |
196 |
delmeta : Delete server metadata |
197 |
firewall: Set the server's firewall profile |
198 |
info : Get server details |
199 |
list : List servers |
200 |
meta : Get a server's metadata |
201 |
reboot : Reboot a server |
202 |
rename : Update a server's name |
203 |
setmeta : Update server's metadata |
204 |
shutdown: Shutdown a server |
205 |
start : Start a server |
206 |
stats : Get server statistics |
207 |
wait : Wait for server to finish |
208 |
|
209 |
store (Storage/Pithos+) |
210 |
""""""""""""""""""""""" |
211 |
|
212 |
.. code-block:: text |
213 |
|
214 |
append : Append local file to remote |
215 |
cat : Print a file to console |
216 |
copy : Copy an object |
217 |
create : Create a container or a directory object |
218 |
delete : Delete a container [or an object] |
219 |
delgroup : Delete a user group on an account |
220 |
delmeta : Delete an existing metadatum of account [, container [or object]] |
221 |
delpermissions: Delete all sharing permissions |
222 |
download : Download a file |
223 |
group : Get user groups details for account |
224 |
hashmap : Get the hashmap of an object |
225 |
info : Get information for account [, container [or object]] |
226 |
list : List containers, object trees or objects in a directory |
227 |
manifest : Create a remote file with uploaded parts by manifestation |
228 |
meta : Get custom meta-content for account [, container [or object]] |
229 |
mkdir : Create a directory |
230 |
move : Copy an object |
231 |
overwrite : Overwrite part (from start to end) of a remote file |
232 |
permissions : Get object read/write permissions |
233 |
publish : Publish an object |
234 |
purge : Purge a container |
235 |
quota : Get quota for account [or container] |
236 |
setgroup : Create/update a new user group on account |
237 |
setmeta : Set a new metadatum for account [, container [or object]] |
238 |
setpermissions: Set sharing permissions |
239 |
setquota : Set new quota (in KB) for account [or container] |
240 |
setversioning : Set new versioning (auto, none) for account [or container] |
241 |
sharers : List the accounts that share objects with default account |
242 |
truncate : Truncate remote file up to a size |
243 |
unpublish : Unpublish an object |
244 |
upload : Upload a file |
245 |
versioning : Get versioning for account [or container ] |
246 |
versions : Get the version list of an object |
247 |
|
248 |
One-command interface |
249 |
^^^^^^^^^^^^^^^^^^^^^ |
250 |
|
251 |
Kamaki usage as a one-command tool is detailed in this section |
252 |
|
253 |
Using help |
254 |
"""""""""" |
255 |
|
256 |
Kamaki help is used to see available commands, with description, syntax and their corresponding optional arguments. |
257 |
|
258 |
To see the command groups, users should use -h or --help like in example 1.3.1. In the same way, help information for command groups and commands is printed. In the following examples, the help messages of kamaki, of a command group (server) and of a command in that group (list) are shown. |
259 |
|
260 |
.. code-block:: console |
261 |
|
262 |
$ kamaki -h |
263 |
usage: kamaki <cmd_group> [<cmd_subbroup> ...] <cmd> [-v] [-s] [-V] [-d] [-i] |
264 |
[--config CONFIG] |
265 |
[-o OPTIONS] [-h] |
266 |
|
267 |
optional arguments: |
268 |
-v, --verbose More info at response |
269 |
-s, --silent Do not output anything |
270 |
-V, --version Print current version |
271 |
-d, --debug Include debug output |
272 |
-i, --include Include protocol headers in the output |
273 |
--config CONFIG Path to configuration file |
274 |
-o OPTIONS, --options OPTIONS |
275 |
Override a config value |
276 |
-h, --help Show help message |
277 |
|
278 |
Options: |
279 |
- - - - |
280 |
astakos: Astakos API commands |
281 |
config : Configuration commands |
282 |
flavor : Compute/Cyclades API flavor commands |
283 |
history: Command history |
284 |
image : Compute/Cyclades or Glance API image commands |
285 |
network: Compute/Cyclades API network commands |
286 |
server : Compute/Cyclades API server commands |
287 |
store : Pithos+ storage commands |
288 |
|
289 |
|
290 |
Example 4.1.1: kamaki help shows available parameters and command groups |
291 |
|
292 |
.. code-block:: console |
293 |
|
294 |
$ kamaki cyclades -h |
295 |
usage: kamaki server <...> [-v] [-s] [-V] [-d] [-i] [--config CONFIG] |
296 |
[-o OPTIONS] [-h] |
297 |
|
298 |
optional arguments: |
299 |
-v, --verbose More info at response |
300 |
-s, --silent Do not output anything |
301 |
-V, --version Print current version |
302 |
-d, --debug Include debug output |
303 |
-i, --include Include protocol headers in the output |
304 |
--config CONFIG Path to configuration file |
305 |
-o OPTIONS, --options OPTIONS |
306 |
Override a config value |
307 |
-h, --help Show help message |
308 |
|
309 |
Options: |
310 |
- - - - |
311 |
addmeta : Add server metadata |
312 |
addr : List a server's nic address |
313 |
console : Get a VNC console |
314 |
create : Create a server |
315 |
delete : Delete a server |
316 |
delmeta : Delete server metadata |
317 |
firewall: Set the server's firewall profile |
318 |
info : Get server details |
319 |
list : List servers |
320 |
meta : Get a server's metadata |
321 |
reboot : Reboot a server |
322 |
rename : Update a server's name |
323 |
setmeta : Update server's metadata |
324 |
shutdown: Shutdown a server |
325 |
start : Start a server |
326 |
stats : Get server statistics |
327 |
wait : Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE] |
328 |
|
329 |
|
330 |
Example 4.1.2: Cyclades help contains all first-level commands of cyclades command group |
331 |
|
332 |
.. code-block:: console |
333 |
|
334 |
$ kamaki server list -h |
335 |
usage: kamaki server list [-v] [-s] [-V] [-d] [-i] [--config CONFIG] |
336 |
[-o OPTIONS] [-h] [-l] |
337 |
|
338 |
List servers |
339 |
|
340 |
optional arguments: |
341 |
-v, --verbose More info at response |
342 |
-s, --silent Do not output anything |
343 |
-V, --version Print current version |
344 |
-d, --debug Include debug output |
345 |
-i, --include Include protocol headers in the output |
346 |
--config CONFIG Path to configuration file |
347 |
-o OPTIONS, --options OPTIONS |
348 |
Override a config value |
349 |
-h, --help Show help message |
350 |
-l show detailed output |
351 |
|
352 |
|
353 |
Example 4.1.3: Help for command "server list" with syntax, description and avaiable user options |
354 |
|
355 |
Using history |
356 |
""""""""""""" |
357 |
|
358 |
Kamaki command history is stored in a file at user home (".kamaki.history" by default). To set a custom history file path users must set the history.file config option (see `available config options <setup.html#editing-options>`_). |
359 |
|
360 |
Every syntactically correct command is appended at the end of that file. In order to see how to use history, use the kamaki help system: |
361 |
|
362 |
.. code-block:: console |
363 |
|
364 |
$ kamaki history -h |
365 |
... |
366 |
clean: Clean up history |
367 |
show : Show history |
368 |
|
369 |
|
370 |
Example 4.2.1: Available history options |
371 |
|
372 |
The following example showcases how to use history in kamaki |
373 |
|
374 |
.. code-block:: console |
375 |
|
376 |
$ kamaki history clean --match clean |
377 |
$ kamaki server list |
378 |
... |
379 |
$ kamaki history show |
380 |
1. kamaki server list |
381 |
2. kamaki history show |
382 |
$ kamaki history show --match server |
383 |
1. kamaki server list |
384 |
3. kamaki history show --match server |
385 |
|
386 |
|
387 |
Example 4.2.2: Clean up everything, run a kamaki command, show full and filtered history |
388 |
|
389 |
Debug |
390 |
""""" |
391 |
|
392 |
In case of errors, kamaki in debug mode shows usefull debug information, like the stack trace, instead of a user-friendly error message. Kamaki also suppresses various warning messages that are also allowed in debug mode. |
393 |
|
394 |
To run kamaki in debug mode use the -d or --debug option |
395 |
|
396 |
Verbose |
397 |
""""""" |
398 |
|
399 |
Most kamaki commands are translated into http requests. Kamaki clients API translated the semantics to REST and handles the response. Users who need to have access to these commands can use the verbose mode that presentes the HTTP Request details as well as the full server response. |
400 |
|
401 |
To run kamaki in verbose mode use the -v or --verbose option |
402 |
|
403 |
Client commands |
404 |
""""""""""""""" |
405 |
|
406 |
Client commands are grouped by service (see example 3.1.1 for how to list availabel groups). Commands behavior is as uniform as possible, but there are still differences between groups due to the special nature of each service and server-side implementation. |
407 |
|
408 |
Kamaki commands can be used along with advanced shell features. |
409 |
|
410 |
.. code-block:: console |
411 |
|
412 |
$ kamaki server list -l > vmlist.txt |
413 |
|
414 |
|
415 |
Example 4.4.1: Store a vm list in file vmlist.txt in a unix shell |
416 |
|
417 |
In that case, kamaki modifies the output (e.g. removes colors - if enabled) |
418 |
|
419 |
Interactive shell |
420 |
^^^^^^^^^^^^^^^^^ |
421 |
|
422 |
Creating applications over the Clients API |
423 |
------------------------------------------ |