Revision 7536c9bf docs/usage.rst

b/docs/usage.rst
3 3

  
4 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 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.
6
What's more, kamaki offers a clients API that allows the development of external applications for synnefo. The clients API is listed in the `Clients lib <clients.html>`_ section. The recommended method of utilizing this API is explained in the present.
7 7

  
8 8
Setup
9 9
-----
10 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.
11
Kamaki interfaces rely on a list of configuration options. In the initial state, kamaki is configured to communicate with the Okeanos IaaS. A detailed guide for setting up kamaki can be found in the `Setup <setup.html>`_ section.
12 12

  
13 13
Quick guide
14 14
^^^^^^^^^^^
......
22 22

  
23 23
    $ kamaki set token myt0k3n==
24 24

  
25
To use the storage service, a user should also provide the corresponding username:
25
To use the storage service, a user should also provide the corresponding user-name:
26 26

  
27 27
.. code-block:: console
28 28
    :emphasize-lines: 1
......
31 31

  
32 32
    $ kamaki set account user@domain.com
33 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 34
Shell vs one-command
39
^^^^^^^^^^^^^^^^^^^^
35
--------------------
36
Kamaki users can access synnefo services through either the interactive shell or the one-command behaviors. In practice, both systems rely on the same command set implementations and API clients, with identical responses and error messages. Still, there are some differences.
37

  
40 38
In favor of interactive shell behavior:
41 39

  
42 40
* tab completion for commands
43
* session history with "up"/"down" keys
44
* shorter commants with command namespace switching
41
* session history with "up" / "down" keys
42
* shorter commands with command context switching
45 43

  
46 44
In favor of one-command behavior:
47 45

  
......
50 48
* prints debug and verbose messages if needed
51 49

  
52 50
Run as shell
53
""""""""""""
51
^^^^^^^^^^^^
54 52
To use kamaki as a shell, run:
55 53

  
56 54
* without any parameters or arguments
......
73 71

  
74 72

  
75 73
Run as one-command
76
""""""""""""""""""
74
^^^^^^^^^^^^^^^^^^
77 75
To use kamaki as an one-command tool, run:
78 76

  
79 77
* with the '-h' or '--help' arguments (help for kamaki one-command)
......
95 93
    $ kamaki server list
96 94

  
97 95
Commands
98
^^^^^^^^
96
--------
99 97

  
100 98
Client commands are grouped by service (see example 3.1.1 on how to list available 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.
101 99

  
......
110 108

  
111 109
Example 2.3.2 showcases a command without parameters (the group is "server", the command is "list").
112 110

  
113
The "server" command group is also refered in the following example.
111
The "server" command group is also referred in the following example.
114 112

  
115 113
.. code-block:: console
116 114
    :emphasize-lines: 1
......
119 117

  
120 118
    $ kamaki server info 42
121 119

  
122
Client commands can feature an arbitarry number of terms:
120
Client commands can feature an arbitrary number of terms:
123 121

  
124 122
.. code-block:: text
125 123

  
126 124
    kamaki <group> <cmd term 1> <cmd term 2> ... <cmd term N> [arguments]
127 125

  
128
Although there are no multi-termed client commands until version 0.6.1 , the feature is supported and might be used in feature extentions.
126
Although there are no multi-termed client commands until version 0.6.1 , the feature is supported and might be used in feature extensions.
129 127

  
130 128
The following pattern applies to all client commands up to version 0.6.1:
131 129

  
......
133 131

  
134 132
    kamaki <group> <command> [arguments]
135 133

  
136
The commands supported in version 0.6.1 are described bellow, grouped by service. The examples showcase a sample set of group commands. The kamaki interactive shell has been chosen as the execution enviroment:
134
The commands supported in version 0.6.1 are described bellow, grouped by service. The examples showcase a sample set of group commands. The kamaki interactive shell has been chosen as the execution environment:
137 135

  
138 136
astakos (Identity Manager)
139
""""""""""""""""""""""""""
137
^^^^^^^^^^^^^^^^^^^^^^^^^^
140 138

  
141 139
.. code-block:: text
142 140

  
......
163 161
    username          :  4215th3b357num9323v32
164 162

  
165 163
flavor (Compute/Cyclades)
166
"""""""""""""""""""""""""
164
^^^^^^^^^^^^^^^^^^^^^^^^^
167 165

  
168 166
.. code-block:: text
169 167

  
......
188 186
    ram              :  2048
189 187

  
190 188
image (Compute/Cyclades + Glance)
191
""""""""""""""""""""""""""""""""""
189
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192 190

  
193 191
.. code-block:: text
194 192

  
......
242 240
    users         :  root
243 241

  
244 242
server (Compute/Cyclades)
245
"""""""""""""""""""""""""
243
^^^^^^^^^^^^^^^^^^^^^^^^^
246 244

  
247 245
.. code-block:: text
248 246

  
......
338 336
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
339 337

  
340 338
network (Compute/Cyclades)
341
""""""""""""""""""""""""""
339
^^^^^^^^^^^^^^^^^^^^^^^^^^
342 340

  
343 341
.. code-block:: text
344 342

  
......
415 413
.. Note:: In kamaki shell, / is used to access top-level command groups while working in command group contexts
416 414

  
417 415
store (Storage/Pithos+)
418
"""""""""""""""""""""""
416
^^^^^^^^^^^^^^^^^^^^^^^
419 417

  
420 418
.. code-block:: text
421 419

  
......
517 515
    1.    20M rndm_remote.file
518 516

  
519 517

  
520
    * Download pasted file to local filesystem *
518
    * Download pasted file to local file system *
521 519
    [store]:download mycont1:rndm_remote.file rndm_remote.file
522 520

  
523 521

  
......
530 528
.. Note:: In kamaki shell, ! is used to execute OS shell commands (bash in the above)
531 529

  
532 530
One-command interface
533
^^^^^^^^^^^^^^^^^^^^^
531
---------------------
534 532

  
535 533
Kamaki usage as a one-command tool is detailed in this section
536 534

  
537 535
Using help
538
""""""""""
536
^^^^^^^^^^
539 537

  
540 538
Kamaki help is used to see available commands, with description, syntax and their corresponding optional arguments.
541 539

  
......
576 574
.. code-block:: console
577 575
    :emphasize-lines: 1
578 576

  
579
    Example 4.1.2: Cyclades help contains all first-level commands of cyclades command group
577
    Example 4.1.2: Cyclades help contains all first-level commands of Cyclades command group
580 578

  
581 579

  
582 580
    $ kamaki cyclades -h
......
617 615
.. code-block:: console
618 616
    :emphasize-lines: 1
619 617

  
620
    Example 4.1.3: Help for command "server list" with syntax, description and avaiable user options
618
    Example 4.1.3: Help for command "server list" with syntax, description and available user options
621 619

  
622 620

  
623 621
    $ kamaki server list -h
......
640 638
.. _using-history-ref:
641 639

  
642 640
Using history
643
"""""""""""""
641
^^^^^^^^^^^^^
644 642

  
645 643
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>`_).
646 644

  
......
676 674
    3. kamaki history show --match server
677 675

  
678 676
Debug
679
"""""
677
^^^^^
680 678

  
681
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.
679
In case of errors, kamaki in debug mode shows useful 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.
682 680

  
683 681
To run kamaki in debug mode use the -d or --debug option
684 682

  
685 683
Verbose
686 684
"""""""
687 685

  
688
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.
686
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 presents the HTTP Request details as well as the full server response.
689 687

  
690 688
To run kamaki in verbose mode use the -v or --verbose option
691 689

  
692 690
One-command features
693
""""""""""""""""""""
691
^^^^^^^^^^^^^^^^^^^^
694 692

  
695 693
Kamaki commands can be used along with advanced shell features.
696 694

  
......
703 701
    $ kamaki astakos authenticate -o token=us3rt0k3n== | grep uniq
704 702
    uniq        : user@synnefo.org
705 703

  
706
The -o argument can be used to overide temporarily various (set or unset) options. In one command, all -o options are forgoten just after the command had been completed, and the previous settings are restored (the configuration file is not modified).
704
The -o argument can be used to override temporarily various (set or unset) options. In one command, all -o options are forgotten just after the command had been completed, and the previous settings are restored (the configuration file is not modified).
707 705

  
708
The astakos-authenticate command in example 4.4.1 run against an explicitly provided token, which temporarily overode the token provided in the configuration file.
706
The astakos-authenticate command in example 4.4.1 run against an explicitly provided token, which temporarily overrode the token provided in the configuration file.
709 707

  
710 708
Interactive shell
711
^^^^^^^^^^^^^^^^^
709
-----------------
712 710

  
713 711
Kamaki interactive shell is details in this section
714 712

  
715 713
Command Contexts
716
""""""""""""""""
714
^^^^^^^^^^^^^^^^
717 715

  
718
The kamaki interactive shell implements the notion of command contexts. Each command group is also a context where the users can **enter** by typing the group name. If the context switch is succesful, the kamaki shell prompt changes to present the new context ("store" in example 5.1.1).
716
The kamaki interactive shell implements the notion of command contexts. Each command group is also a context where the users can **enter** by typing the group name. If the context switch is successful, the kamaki shell prompt changes to present the new context ("store" in example 5.1.1).
719 717

  
720 718
.. code-block:: console
721 719
    :emphasize-lines: 1
722 720

  
723
    Example 5.1.1: Enter store commands context/group
721
    Example 5.1.1: Enter store commands context / group
724 722

  
725 723

  
726 724
    $ kamaki
727 725
    [kamaki]:store
728 726
    [store]:
729 727

  
730
Type **exit** or **ctrl-D** to exit a context and return to the context of origin. If already at the top context (kamaki), an exit is equivalent to exiting the programm.
728
Type **exit** or **ctrl-D** to exit a context and return to the context of origin. If already at the top context (kamaki), an exit is equivalent to exiting the program.
731 729

  
732 730
.. code-block:: console
733 731
    :emphasize-lines: 1
......
776 774
    ... (VMs listing) ...
777 775
    [kamaki]:
778 776

  
779
Help
780
""""
777
Using Help
778
^^^^^^^^^^
781 779

  
782 780
There are two help mechanisms: a context-level and a command-level.
783 781

  
......
829 827
    [config]:help set
830 828
    Set a configuration option (set -h for more options)
831 829

  
832
In context-level, there is a distinction between kamaki-commands and interactive shell commands. The former are available in one-command mode and are releated to the cloud client setup and use, while the later are context-shell functions.
830
In context-level, there is a distinction between kamaki-commands and interactive shell commands. The former are available in one-command mode and are related to the cloud client setup and use, while the later are context-shell functions.
833 831

  
834 832
**Command-level help** prints the syntax, arguments and description of a specific (terminal) command
835 833

  
......
841 839

  
842 840
    <description>
843 841

  
844
    <arguments and possible extentions>
842
    <arguments and possible extensions>
845 843

  
846 844
Command-level help mechanism is exactly the same as the one used in one-command mode. For example, it is invoked by using the -h or --help parameter at any point.
847 845

  
......
891 889
.. _accessing-top-level-commands-ref:
892 890

  
893 891
Accessing top-level commands
894
""""""""""""""""""""""""""""
892
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
895 893

  
896
When working in a context, it is often usefull to access other contexts or top-level commands. Kamaki offers access to top-level commands by using the / prefix, as shown bellow::
894
When working in a context, it is often useful to access other contexts or top-level commands. Kamaki offers access to top-level commands by using the / prefix, as shown bellow::
897 895

  
898 896
    * access a command "anothercontext cmd1 cmd2 ... cmdN"
899 897
    [context]:/anothercontext cmd1 cmd2 ... cmdN
......
904 902
* the flavor id
905 903
* the image id
906 904

  
907
It is often the case that a user who works in the context command, needs to create a new VM, but doesn't know the flavor or image id of preference. Therefore, it is nessecary to list all available flavors (flavor-list) or images (image-list. Both commands belong to different contexts.
905
It is often the case that a user who works in the context command, needs to create a new VM, but doesn't know the flavor or image id of preference. Therefore, it is necessary to list all available flavors (flavor-list) or images (image-list. Both commands belong to different contexts.
908 906

  
909 907
.. code-block:: console
910 908
    :emphasize-lines: 1
......
933 931
    [server]:create 'my debian' 43 6aa6eafd-dccb-67fe2bdde87e
934 932
    ...
935 933

  
936
An other example (5.3.2) showcases how to aquire and modify configuration settings from a different context. In this scenario, the user token expires at server side while the user is working. When that happens, the system responds with an *(401) UNAUTHORIZED* message. The user can aquires a new token (with a browser) which has to be set to kamaki.
934
An other example (5.3.2) showcases how to acquire and modify configuration settings from a different context. In this scenario, the user token expires at server side while the user is working. When that happens, the system responds with an *(401) UNAUTHORIZED* message. The user can acquires a new token (with a browser) which has to be set to kamaki.
937 935

  
938 936
.. code-block:: console
939 937
    :emphasize-lines: 1
......
998 996

  
999 997
.. hint:: To exit kamaki shell while in a context, try */exit*
1000 998

  
1001
Config
1002
""""""
999
Using config
1000
^^^^^^^^^^^^
1003 1001

  
1004
The configuration mechanism of kamaki is detailed at the `setup section <setup.html>`_ and it is common for both interaction modes. In specific, the configuration mechanism is implemented as a command group, namely *config*. Using the config commands is as straighforward as any other kamaki commands.
1002
The configuration mechanism of kamaki is detailed at the `setup section <setup.html>`_ and it is common for both interaction modes. In specific, the configuration mechanism is implemented as a command group, namely *config*. Using the config commands is as straightforward as any other kamaki commands.
1005 1003

  
1006
It is often usefull to set, delete or update a value. This can be managed either inside the config context or from any commant context by using the / detour.
1004
It is often useful to set, delete or update a value. This can be managed either inside the config context or from any command context by using the / detour.
1007 1005

  
1008 1006
.. Note:: config updates in kamaki shell persist even after the session is over. All setting changes affects the physical kamaki config file (automatically created, if not set manually)
1009 1007

  
1010
In example 5.4.1 the user is going to work with only one storage container. The store commands use the container:path syntax, but if the user could set a container as a defaul, the container name could be ommited in most cases. This is possible by setting a store.container setting.
1008
In example 5.4.1 the user is going to work with only one storage container. The store commands use the container:path syntax, but if the user could set a container as a default, the container name could be omitted in most cases. This is possible by setting a store.container setting.
1011 1009

  
1012 1010
.. code-block:: console
1013 1011
    :emphasize-lines: 1
......
1045 1043
    2.  pithos (0B, 0 objects)
1046 1044
    3.  trash (2MB, 1 objects)
1047 1045

  
1048
.. warning:: In some cases, the config setting updates are not immidiately effective. If that is the case, they will be after the next command run, whatever that command is.
1046
.. warning:: In some cases, the config setting updates are not immediately effective. If that is the case, they will be after the next command run, whatever that command is.
1049 1047

  
1050
History
1051
"""""""
1048
Using history
1049
^^^^^^^^^^^^^
1052 1050

  
1053 1051
There are two history modes: session and permanent. Session history keeps record of all actions in a kamaki shell session, while permanent history appends all commands to an accessible history file.
1054 1052

  
1055
Session history is only available in interactive shell mode. Users can iterrate through past commands in the same session by with the *up*and *down* keys. Session history is not stored, although syntactically correct commands are recorded through the permanent history mechanism
1053
Session history is only available in interactive shell mode. Users can iterate through past commands in the same session by with the *up* and *down* keys. Session history is not stored, although syntactically correct commands are recorded through the permanent history mechanism
1056 1054

  
1057 1055
Permanent history is implemented as a command group and is common to both the one-command and shell interfaces. In specific, every syntactically correct command is appended in a history file (configured as *history.file* in settings, see `setup section <setup.html>`_ for details). Commands executed in one-command mode are mixed with the ones run in kamaki shell (also see :ref:`using-history-ref` section on this guide).
1058 1056

  
1059 1057
Tab completion
1060
""""""""""""""
1058
^^^^^^^^^^^^^^
1061 1059

  
1062 1060
Kamaki shell features tab completion for the first level of command terms of the current context. Tab completion pool changes dynamically when the context is switched. Currently, tab completion is not supported when the / detour is used (see :ref:accessing-top-level-commands-ref ).
1063 1061

  
1064 1062
OS Shell integration
1065
""""""""""""""""""""
1063
^^^^^^^^^^^^^^^^^^^^
1066 1064

  
1067 1065
Kamaki shell features the ability to execute OS-shell commands from any context. This can be achieved by typing *!* or *shell*::
1068 1066

  
......
1109 1107

  
1110 1108
    [kamaki]:shell pwd
1111 1109
    /home/username
1112

  
1113
Creating applications with the Clients API
1114
------------------------------------------

Also available in: Unified diff