Revision 1c366ac9 docs/examplesdir/listing.rst

b/docs/examplesdir/listing.rst
1 1
Listing
2 2
=======
3 3

  
4
In this section we present the ways of kamaki for listing, an operation that is
5
common to most command groups.
6

  
7
The examples of this section run in a kamaki interactive shell.
8

  
9
.. code-block:: console
10

  
11
    $ kamaki
12
    kamaki v0.10 - Interactive Shell
13

  
14
    /exit       terminate kamaki
15
    exit or ^D  exit context
16
    ? or help   available commands
17
    ?command    help on command
18
    !<command>  execute OS shell command
19

  
20
    Session user is Tyler Durden <uuid: th3y-4r3-7h3-54m3-p3r50n>
21
    [kamaki]:
4
The listing of various synnefo objects (e.g, server, file, network) is
5
showcased in this section.
22 6

  
23 7
Simple listing
24 8
--------------
......
27 11

  
28 12
.. code-block:: console
29 13

  
30
    [kamaki]: config list
31
    cloud.default.url = https://astakos.example.com/identity/v2.0/
32
    cloud.default.token = my70k3n==
33
    global.default_cloud = default
34
    global.colors = on
14
    $ kamaki config list
15
    global.default_cloud = mycloud
16
    global.colors = off
35 17
    global.config_cli = config
18
    global.container_cli = pithos
36 19
    global.file_cli = pithos
37 20
    global.flavor_cli = cyclades
21
    global.group_cli = pithos
38 22
    global.history_cli = history
39
    global.history_file = /home/saxtouri/.kamaki.history
23
    global.history_file = /home/someuser/.kamaki.history
40 24
    global.image_cli = image
41
    global.log_file = /home/saxtouri/.kamaki.log
42
    global.log_token = one
43
    global.max_threads = 5
44
    global.network_cli = cyclades
25
    global.imagecompute_cli = image
26
    global.ip_cli = network
27
    global.log_data = off
28
    global.log_file = /home/someuser/.kamaki.log
29
    global.log_pid = off
30
    global.log_token = off
31
    global.network_cli = network
32
    global.port_cli = network
33
    global.project_cli = astakos
34
    global.quota_cli = astakos
35
    global.resource_cli = astakos
45 36
    global.server_cli = cyclades
37
    global.sharer_cli = pithos
38
    global.subnet_cli = network
46 39
    global.user_cli = astakos
47
    [kamaki]:
48 40

  
49
List stored containers and then objects in container "pithos"
41
List stored containers and file or directory objects in container "pithos"
50 42

  
51 43
.. code-block:: console
52 44

  
53
    [kamaki]: file list
45
    $ kamaki container list
54 46
    pithos (36MB, 4 objects)
55 47
    trash (0B, 0 objects)
56
    [kamaki]: file list pithos
57
    . 2KB  info.txt
58
    . D    video/
59
    . 11MB video/tk1.mpg
60
    . 12MB video/tk2.mpg
61
    . 13MB video/tk3.mpg
62
    [kamaki]:
48
    $ kamaki file list /pithos
49
    2KB  info.txt
50
    D    video/
51
    11MB video/tk1.mpg
52
    12MB video/tk2.mpg
53
    13MB video/tk3.mpg
54
    $ kamaki file list /pithos/video
55
    11MB video/tk1.mpg
56
    12MB video/tk2.mpg
57
    13MB video/tk3.mpg
58

  
59
.. note:: In file list, the default container is "pithos"
60

  
61
    .. code-block:: console
62

  
63
        $ kamaki file list
64
        2KB  info.txt
65
        D    video/
66
        11MB video/tk1.mpg
67
        12MB video/tk2.mpg
68
        13MB video/tk3.mpg
69
        $ kamaki file list video
70
        11MB video/tk1.mpg
71
        12MB video/tk2.mpg
63 72

  
64 73
List virtual machines (servers)
65 74

  
66 75
.. code-block:: console
67 76

  
68
    [kamaki]: server list
77
    $ kamaki server list
69 78
    4201 example server 1
70 79
    4202 example server 2
71 80
    4203 example server 3
......
77 86

  
78 87
.. code-block:: console
79 88

  
80
    [kamaki]: network list
89
    $ kamaki network list
81 90
    1 public_network
82 91
    42 my_private_network
83
    [kamaki]:
84 92

  
85 93
List flavors
86 94

  
87 95
.. code-block:: console
88 96

  
89
    [kamaki]: flavor list
97
    $ kamaki flavor list
90 98
    1 C1R1024D20drbd
91 99
    2 C1R1024D30drbd
92
    [kamaki]:
93 100

  
94 101
List images from Image API and from Compute APIs
95 102

  
96 103
.. code-block:: console
97 104

  
98
    [kamaki]: image list
105
    $ kamaki image list
99 106
    f1r57-1m4g3-1d Debian Base Alpha
100 107
     container_format: bare
101 108
     disk_format:      diskdump
......
106 113
     disk_format:      diskdump
107 114
     size:             474066944
108 115
     status:           available
109
    [kamaki]: image compute list
116
    $ kamaki imagecompute list
110 117
    f1r57-1m4g3-1d Debian Base Alpha
111 118
    53c0nd-1m4g3-1d Beta Debian Base
112
    [kamaki]:
113 119

  
114 120
Detailed pithos listing
115 121
-----------------------
116 122

  
117
Enter contect
118

  
119
.. code-block:: console
120

  
121
    [kamaki]: file
122
    [file]:
123

  
124 123
List pithos containers with details
125 124

  
126 125
.. code-block:: console
127 126

  
128
    [file]: list -l
127
    $ kamaki container list -l
129 128
    pithos
130 129
    bytes:    0 (0B)
131 130
    count:    3
......
140 139
    policy:
141 140
            quota:      0
142 141
            versioning: auto
143
    [file]:
144 142

  
145
Create some more pithos container to experiment with
143
Create some more containers to experiment with
146 144

  
147 145
.. code-block:: console
148 146

  
149
    [file]: create cont1
150
    [file]: create cont2
151
    [file]: create cont3
152
    [file]: create cont4
153
    [file]: list
147
    $ kamaki container create cont1
148
    $ kamaki container create cont2
149
    $ kamaki container create cont3
150
    $ kamaki container create cont4
151
    $ kamaki container list
154 152
    cont1 (0B, 0 objects)
155 153
    cont2 (0B, 0 objects)
156 154
    cont3 (0B, 0 objects)
157 155
    cont4 (0B, 0 objects)
158 156
    pithos (36B, 5 objects)
159 157
    trash (0B, 0 objects)
160
    [file]:
161

  
162
List only 3, then list three by three
163

  
164
.. code-block:: console
165

  
166
    [file]: list -n 3
167
    cont1 (0B, 0 objects)
168
    cont2 (0B, 0 objects)
169
    cont3 (0B, 0 objects)
170
    [file]: list -n 3 --more
171
    cont1 (0B, 0 objects)
172
    cont2 (0B, 0 objects)
173
    cont3 (0B, 0 objects)
174
    (3 listed - 3 more - "enter" to continue)
175
    <enter is pressed>
176
    cont4 (0B, 0 objects)
177
    pithos (36B, 4 objects)
178
    trash (0B, 0 objects)
179
    [file]:
180 158

  
181 159
List contents of container `pithos`
182 160

  
183 161
.. code-block:: console
184 162

  
185
    [file]: list -l pithos
163
    $ kamaki file list -l /pithos
186 164
    info.txt
187 165
    by:        s0m3-u53r-1d
188 166
    bytes:     2000 (2ΚB)
......
232 210
    type:      video/mpeg
233 211
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
234 212
    version:   1083
235
    [kamaki]:
213
    $ kamaki
236 214

  
237
List only objects starting with "video" and exit "file" context
215
List only objects starting with "video" and exit "file" context. Remember that
216
"pithos" is the default container, so there is no need to refer to it.
238 217

  
239 218
.. code-block:: console
240 219

  
241
    [file]: list -l pithos:video/
220
    $ kamaki file list -l video/
242 221
    video/tk1.mpg
243 222
    by:        s0m3-u53r-1d
244 223
    bytes:     11000000 (11ΜΒB)
......
269 248
    uuid:      4195e8c3-9b9a-4e97-8c20-fdfef34892fe
270 249
    version:   1083
271 250

  
272

  
273
Exit context
274

  
275
.. code-block:: console
276

  
277
    [file]: exit
278
    [kamaki]:
279

  
280 251
Detailed Server Listing
281 252
-----------------------
282 253

  
283
Enter context
284

  
285
.. code-block:: console
286

  
287
    [kamaki]: server
288
    [server]:
289

  
290 254
List only 3, then list three by three, all with enumeration
291 255

  
292 256
.. code-block:: console
293 257

  
294
    [server]: list -n 3 --enumerate
258
    $ kamaki server list --enumerate
295 259
    1. 4201 example server 1
296 260
    2. 4202 example server 2
297 261
    3. 4203 example server 3
298 262
    4. 4204 example server 4
299 263
    5. 4205 example server 5
300 264
    6. 4206 example server 6
301
    [server]: list -n 3 --more --enumerate
265
    $ kamaki server list -n 3 --more
302 266
    1. 4201 example server 1
303 267
    2. 4202 example server 2
304 268
    3. 4203 example server 3
......
307 271
    4. 4204 example server 4
308 272
    5. 4205 example server 5
309 273
    6. 4206 example server 6
310
    [server]:
311 274

  
312
Get json output returned by the compute API server (only first two VMs)
275
List in json output
313 276

  
314 277
.. code-block:: console
315 278

  
316
    [server]: list -j -n 2
279
    $ kamaki server list -output-format=json
317 280
    [
318 281
        {
319 282
            "name": "example server 1",
......
343 306
            ],
344 307
            "id": 4202
345 308
          }
309
        ...
346 310
    ]
347
    [server]:
348 311

  
349
Server details (first two only)
312
Server details
350 313

  
351 314
.. code-block:: console
352 315

  
353
    [server]: list -l -n 2
316
    $ kamaki server list -l
354 317
    4201 my example server 1
355 318
        accessIPv4:
356 319
        accessIPv6:
......
483 446
        tenant_id:       s0m3-u53r-1d
484 447
        updated:         2013-06-17T07:57:50.054550+00:00
485 448
        user_id:         s0m3-u53r-1d
486
    [server]:
487

  
488
Exit context
489

  
490
.. code-block:: console
491

  
492
    [server]: exit
493
    [kamaki]:
494

  
495
.. note:: `network` and `flavor list` behave in the same way as `server list`
449
    ...
496 450

  
497 451
Detailed image listing
498 452
----------------------
499 453

  
500
Enter context
501

  
502
.. code-block:: console
503

  
504
    [kamaki]: image
505
    [image]:
506

  
507 454
Detailed listing
508 455

  
509 456
.. code-block:: console
510 457

  
511
    [image]: list -l
458
    $ kamaki image list -l
512 459
    f1r57-1m4g3-1d Debian Base Alpha
513 460
        checksum:         9344d77620cde1dd77da...7b70badda34b26d782
514 461
        container_format: bare
......
551 498
        size:             474066944
552 499
        status:           available
553 500
        updated_at:       2013-06-03 16:44:16
554
    [image]: compute list
501
    $ kamaki imagecompute list
555 502
    f1r57-1m4g3-1d Debian Base Alpha
556 503
        created:   2013-06-03T16:21:53+00:00
557 504
        links:
......
602 549
        tenant_id: s0m3-5up3r-u53r-1d
603 550
        updated:   2013-06-03T16:21:53+00:00
604 551
        user_id:   s0m3-5up3r-u53r-1d
605
    [image]:
606 552

  
607 553
Filter listing by prefix, suffix or words in image names
608 554

  
609 555
.. code-block:: console
610 556

  
611
    [image]: list --name-prefix=Debian
557
    $ kamaki image list --name-prefix=Debian
612 558
    f1r57-1m4g3-1d Debian Base Alpha
613
    [image]: list --name-suffix=Base
559
    $ kamaki image list --name-suffix=Base
614 560
    53c0nd-1m4g3-1d Beta Debian Base
615
    [image]: list --name-like=Alpha
561
    $ kamaki image list --name-like=Alpha
616 562
    f1r57-1m4g3-1d Debian Base Alpha
617
    [image]: list --name-like=Beta
563
    $ kamaki image list --name-like=Beta
618 564
    53c0nd-1m4g3-1d Beta Debian Base
619
    [image]: list --name-like="Debian Base"
565
    $ kamaki image list --name-like="Debian Base"
620 566
    f1r57-1m4g3-1d Debian Base Alpha
621 567
    53c0nd-1m4g3-1d Beta Debian Base
622
    [image]:
623 568

  
624 569
Filter by owner and container format
625 570

  
626 571
.. code-block:: console
627 572

  
628
    [image]: list --owner=s0m3-u53r-1d
573
    $ kamaki image list --owner=s0m3-u53r-1d
629 574
    f1r57-1m4g3-1d Debian Base Alpha
630 575
    53c0nd-1m4g3-1d Beta Debian Base
631
    [image]: list --container-format=bare
576
    $ kamaki image list --container-format=bare
632 577
    f1r57-1m4g3-1d Debian Base Alpha
633 578
    53c0nd-1m4g3-1d Beta Debian Base
634
    [image]:
635

  
636
Exit context:
637

  
638
.. code-block:: console
639

  
640
    [image]: exit
641
    [kamaki]:

Also available in: Unified diff