Take care of the documentation (except developers)
[kamaki] / docs / commands.rst
1 List of commands
2 ================
3
4 The commands described bellow are grouped by service. The examples showcase a
5 sample set of group commands. The kamaki interactive shell (check
6 `Usage section <usage.html#interactive-shell>`_ for details) is chosen as the
7 execution environment.
8
9
10 user (Identity Manager)
11 -----------------------
12
13 .. code-block:: text
14
15     authenticate:  Authenticate a user
16
17 Showcase: get user information
18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
20 In the following, the token has been set in a previous step (see
21 `setup section <setup.html>`_ or the
22 `quick setup guide <usage.html#quick-setup>`_)
23
24 .. code-block:: console
25     :emphasize-lines: 1,4
26
27     * Enter user context *
28     [kamaki]: user
29
30     * Authenticate user *
31     [user]: authenticate
32     ...
33     user:
34         name:  My Real Name
35         uuid:  ab1cde23-45fg-6h7i-8j9k-10l1m11no2pq
36
37 .. note:: actual call returns a full list of service endpoints accessible to
38     the user with a specific token
39
40 flavor (Compute/Cyclades)
41 -------------------------
42
43 .. code-block:: text
44
45     info:  Get flavor details
46     list:  List flavors
47
48 Showcase: show details for flavor with id 43
49 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
51 .. code-block:: console
52     :emphasize-lines: 1,4
53
54     * Enter flavor context *
55     [kamaki]: flavor
56
57     * Get details about flavor with id 43 *
58     [flavor]: info 43
59     SNF:disk_template:  drbd
60     cpu :  4
61     disk:  10
62     id  :  43
63     name:  C4R2048D10
64     ram :  2048
65
66 image (Plankton commands + Compute Image subcommands)
67 -----------------------------------------------------
68
69 .. code-block:: text
70
71     list      :  List images accessible by user
72     info      :  Get image metadata
73     meta      :  Manage image metadata
74         set     :   Add / update metadata and properties for an image
75         delete  :   Remove/empty image metadata and/or custom properties
76     register  :  (Re)Register an image
77     unregister:  Unregister an image (does not delete the image file)
78     shared    :  List shared images
79     compute   :  Compute Image API commands
80         list      :  List images
81         delete    :  Delete image
82         info      :  Get image details
83         properties:  Manage properties related to OS installation in an image
84             delete:  Delete a property from an image
85             get   :  Get an image property
86             list  :  List all image properties
87             set   :  Add / update a set of properties for an image
88     members   :  Manage members (users who can modify an image)
89         add   :  Add a member to an image
90         delete:  Remove a member from an image
91         list  :  List members of an image
92         set   :  Set the members of an image
93
94 Showcase: Pick an image and list the properties
95 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96
97 .. code-block:: console
98     :emphasize-lines: 1,4,18
99
100     * Enter image context *
101     [kamaki]: image
102
103     * list all available images *
104     [image]: list
105     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
106      container_format:  bare
107      disk_format     :  diskdump
108      id              :  926ab1c5-2d85-49d4-aebe-0fce712789b9
109      size            :  11917066240
110      status          :  available
111     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
112      container_format:  bare
113      disk_format     :  diskdump
114      id              :  78262ee7-949e-4d70-af3a-85360c3de57a
115      size            :  11697913856
116      status          :  available
117     5ed5a29b-292c-4fe0-b32c-2e2b65628635 ubuntu
118      container_format:  bare
119      disk_format     :  diskdump
120      id              :  5ed5a29b-292c-4fe0-b32c-2e2b65628635
121      size            :  2578100224
122      status          :  available
123     1f8454f0-8e3e-4b6c-ab8e-5236b728dffe Debian_Wheezy_Base
124      container_format:  bare
125      disk_format     :  diskdump
126      id              :  1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
127      size            :  795107328
128      status          :  available
129
130     * Get properties of image with id 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe *
131     [image]: compute properties 1f8454f0-8e3e-4b6c-ab8e-5236b728dffe
132     description   :  Debian 6.0.6 (Squeeze) Base System
133     gui           :  No GUI
134     kernel        :  2.6.32
135     os            :  debian
136     osfamily      :  linux
137     root_partition:  1
138     sortorder     :  1
139     users         :  root
140
141 server (Compute/Cyclades)
142 -------------------------
143
144 .. code-block:: text
145
146     addr    :  List a server's nic address
147     console :  Get a VNC console
148     create  :  Create a server
149     delete  :  Delete a server
150     firewall:  Manage server's firewall profile
151         set :  Set the server's firewall profile
152         get :  Get the server's firewall profile
153     ip      :  Manage floating IPs for the servers
154         attach:  Attach a floating ip to a server with server_id
155         info  :  A floating IPs' details
156         detach:  Detach floating ip from server
157         list  :  List all floating ips
158         create:  Create a new floating IP
159         delete:  Delete a floating ip
160         pools :  List all floating pools of floating ips
161     info    :  Get server details
162     list    :  List servers
163     metadata:  Manage Server Metadata
164         list  :  List server metadata
165         set   :  Add / update server metadata
166         delete:  Delete a piece of server metadata
167     reboot  :  Reboot a server
168     rename  :  Update a server's name
169     shutdown:  Shutdown a server
170     start   :  Start a server
171     stats   :  Get server statistics
172     resize  :  Set a different flavor for an existing server
173     wait    :  Wait for server to finish
174
175 Showcase: Create a server
176 ^^^^^^^^^^^^^^^^^^^^^^^^^
177
178 .. code-block:: console
179     :emphasize-lines: 1,4,21,35,44,62
180
181     * Enter server context *
182     [kamaki]: server
183
184     * See server-create help *
185     [server]: create -h
186     usage: create <name> <flavor id> <image id>
187             [--personality PERSONALITY] [-h] [--config CONFIG] [--cloud CLOUD]
188
189     Create a server
190
191     optional arguments:
192       -v, --verbose         More info at response
193       --personality PERSONALITY
194                             add a personality file
195       -d, --debug           Include debug output
196       -h, --help            Show help message
197       -i, --include         Include protocol headers in the output
198       --config CONFIG       Path to configuration file
199       -s, --silent          Do not output anything
200       --cloud CLOUD         Chose a cloud to connect to
201
202     * List all available images *
203     [server]: /image compute list
204     1395fdfb-51b4-419f-bb02-f7d632860611 Ubuntu Desktop LTS
205     1580deb4-edb3-4496-a27f-7a246c4c0528 Ubuntu Desktop
206     18a82962-43eb-4b32-8e28-8f8880af89d7 Kubuntu LTS
207     6aa6eafd-dccb-422d-a904-67fe2bdde87e Debian Desktop
208     6b5681e4-7502-46ae-b1e9-9fd837932095 maelstrom
209     78262ee7-949e-4d70-af3a-85360c3de57a Windows Server 2012
210     86bc2414-0fb3-4898-a637-240292243302 Fedora
211     926ab1c5-2d85-49d4-aebe-0fce712789b9 Windows Server 2008
212     b2dffe52-64a4-48c3-8a4c-8214cc3165cf Debian Base
213     baf2321c-57a0-4a69-825d-49f49cea163a CentOS
214     c1d27b46-d875-4f5c-b7f1-f39b5af62905 Kubuntu
215
216     * See details of flavor with id 1 *
217     [server]: /flavor info 1
218     SNF:disk_template:  drbd
219     cpu              :  1
220     disk             :  20
221     id               :  1
222     name             :  C1R1024D20
223     ram              :  1024
224
225     * Create a debian server named 'My Small Debian Server'
226     [server]: create 'My Small Debian Server' 1 b2dffe52-64a4-48c3-8a4c-8214cc3165cf
227     adminPass:  L8gu2wbZ94
228     created  :  2012-11-23T16:56:04.190813+00:00
229     flavorRef:  1
230     hostId   :  
231     id       :  11687
232     imageRef :  b2dffe52-64a4-48c3-8a4c-8214cc3165cf
233     metadata : 
234                os   :  debian
235                users:  root
236     name     :  My Small Debian Server
237     progress :  0
238     status   :  BUILD
239     suspended:  False
240     updated  :  2012-11-23T16:56:04.761962+00:00
241
242     * wait for server to build (optional) *
243     [server]: wait 11687
244     Server 11687 still in BUILD mode |||||||||||||||||    | 80%
245     Server 11687 is now in ACTIVE mode
246
247 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
248
249 network (Compute/Cyclades)
250 --------------------------
251
252 .. code-block:: text
253
254     connect   :  Connect a server to a network
255     create    :  Create a network
256     delete    :  Delete a network
257     disconnect:  Disconnect a nic of a server to a network
258     info      :  Get network details
259     list      :  List networks
260     rename    :  Update network name
261
262 Showcase: Connect a network to a VM
263 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
264
265 .. code-block:: console
266     :emphasize-lines: 1,4,9,24,27,44
267
268     * Enter network context *
269     [kamaki]: network
270
271     * List user-owned VMs *
272     [network]: /server list
273     11687 (My Small Debian Server)
274     11688 (An Ubuntu server)
275
276     * Try network-connect (to get help) *
277     [network]: connect 
278     Syntax error
279     usage: connect <server id> <network id> [-s] [-h] [-i] [--config CONFIG]
280
281     Connect a server to a network
282
283     Syntax: connect  <server id> <network id>
284       --config    :  Path to configuration file
285       -d,--debug  :  Include debug output
286       -h,--help   :  Show help message
287       -i,--include:  Include protocol headers in the output
288       -s,--silent :  Do not output anything
289       -v,--verbose:  More info at response
290
291     * Connect VM with id 11687 to network with id 1409
292     [network]: connect 11687 1409
293
294     * Get details on network with id 1409
295     [network]: info 1409
296       attachments: 
297                  nic-11687-1
298       cidr    :  192.168.1.0/24
299       cidr6   :  None
300       created :  2012-11-23T17:17:20.560098+00:00
301       dhcp    :  True
302       gateway :  None
303       gateway6:  None
304       id      :  1409
305       name    :  my network
306       public  :  False
307       status  :  ACTIVE
308       type    :  MAC_FILTERED
309       updated :  2012-11-23T17:18:25.095225+00:00
310
311     * Get connectivity details on VM with id 11687 *
312     [network]: /server addr 11687
313     id:  nic-11687-1
314         ipv4       :  192.168.1.1
315         ipv6       :  None
316         mac_address:  aa:0f:c2:0b:0e:85
317         network_id :  1409
318         firewallProfile:  DISABLED
319     id:  nic-11687-0
320         ipv4           :  83.212.106.111
321         ipv6           :  2001:648:2ffc:1116:a80c:f2ff:fe12:a9e
322         mac_address    :  aa:0c:f2:12:0a:9e
323         network_id     :  1369
324
325 .. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
326
327 file (Storage/Pithos+)
328 ----------------------
329
330 .. code-block:: text
331
332     append        :  Append local file to remote
333     cat           :  Print a file to console
334     copy          :  Copy an object
335     containerlimit:  Container size limit commands
336         set       :  Set container data limit
337         get       :  Get container data limit
338     create        :  Create a container
339     delete        :  Delete a container [or an object]
340     download      :  Download a file or directory
341     group         :  Manage access groups and group members
342         delete:  Delete a user group
343         list  :  List groups and group members
344         set   :  Set a user group
345     hashmap       :  Get the hashmap of an object
346     info          :  Get information for account [, container [or object]]
347     list          :  List containers, object trees or objects in a directory
348     manifest      :  Create a remote file with uploaded parts by manifestation
349     metadata      :  Metadata are attached on objects (key:value pairs)
350         delete:  Delete metadata with given key
351         get   :  Get metadatum
352         set   :  Set a piece of metadata
353     mkdir         :  Create a directory
354     move          :  Copy an object
355     overwrite     :  Overwrite part (from start to end) of a remote file
356     permissions   :  Manage user and group accessibility for objects
357         delete:  Delete all permissions set on object
358         get   :  Get read and write permissions of an object
359         set   :  Set permissions for an object
360     publish       :  Publish an object
361     purge         :  Purge a container
362     quota         :  Get  quota for account
363     sharers       :  List the accounts that share objects with default account
364     touch         :  Create an empty object (file)
365     truncate      :  Truncate remote file up to a size
366     unpublish     :  Unpublish an object
367     upload        :  Upload a file or directory
368     versioning    :  Manage the versioning scheme of current pithos user account
369         get:  Get  versioning for account or container
370         set:  Set versioning mode (auto, none) for account or container
371     versions      :  Get the version list of an object
372
373 Showcase: Upload and download a file
374 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
375
376 .. code-block:: console
377     :emphasize-lines: 1,7,11,16,21,29,33,37,41,44,51,55,60,64
378
379     * Create a random binarry file at current OS path *
380     [kamaki]: !dd bs=4M if=/dev/zero of=rndm_local.file count=5
381     5+0 records in
382     5+0 records out
383     20971520 bytes (21 MB) copied, 0.016162 s, 1.3 GB/s
384
385     * Enter file context *
386     [kamaki]: file
387
388
389     * Check local file *
390     [file]: !ls -lh rndm_local.file
391     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
392
393
394     * Create two containers *
395     [file]: create mycont1
396     [file]: create mycont2
397
398
399     * List accessible containers *    
400     [file]: list
401     1. mycont1 (0B, 0 objects)
402     2. mycont2 (0B, 0 objects)
403     3. pithos (0B, 0 objects)
404     4. trash (0B, 0 objects)
405
406
407     * Upload local file to 1st container *
408     [file]: upload rndm_local.file mycont1
409
410
411     * Check if file has been uploaded *
412     [file]: list mycont1
413     1.    20M rndm_local.file
414
415     * Create directory mydir on second container *
416     [file]: mkdir mycont2:mydir
417
418
419     * Move file from 1st to 2nd container (and in the directory) *
420     [file]: move mycont1:rndm_local.file mycont2:mydir/rndm_local.file
421
422     * Check contents of both containers *
423     [file]: list mycont1
424     [file]: list mycont2
425     1.      D mydir/
426     2.    20M mydir/rndm_local.file
427
428
429     * Copy file from 2nd to 1st container, with a new name *
430     [file]: copy mycont2:mydir/rndm_local.file mycont1:rndm_remote.file
431
432
433     * Check pasted file *
434     [file]: list mycont1
435     1.    20M rndm_remote.file
436
437
438     * Download pasted file to local file system *
439     [file]: download mycont1:rndm_remote.file rndm_remote.file
440
441
442     * Check if file is downloaded and if it is the same to original *
443     [file]: !ls -lh *.file
444     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:36 rndm_local.file
445     -rw-rw-r-- 1 ******** ******** 20M Nov 26 15:42 rndm_remote.file
446     [file]: !diff rndm_local.file rndm_remote.file
447
448 .. Note:: In kamaki shell, ! is used to execute OS shell commands (e.g. bash)
449
450 .. warning:: The container:object/path syntax does not function if the
451     container and / or the object path contain one or more : characters. To use
452     containers and objects with : use the --container and --dst-container
453     arguments, e.g. to copy test.py object from example:dev container to
454     example:deploy ::
455
456         $ kamaki file copy --container=example:dev test.py --dst-container=example:deploy