Revision 6893e31c

b/docs/conf.py
130 130
# built documents.
131 131
#
132 132
# The short X.Y version.
133
version = '0.10'
133
version = '0.12'
134 134
# The full version, including alpha/beta/rc tags.
135 135
try:
136 136
    import kamaki
b/docs/man/kamaki.rst
6 6
Synopsis
7 7
--------
8 8

  
9
**kamaki** [*group*] [*command*] [...] [*options*]
9
**kamaki** [*group*] [*command*] [...] [*options*] [*arguments*]
10
**kamaki-shell** [*group*] [*command*] [...] [*arguments*]
10 11

  
11 12

  
12 13
Description
13 14
-----------
14 15

  
15 16
:program:`kamaki` is a simple, yet intuitive, command-line tool for managing 
16
clouds. It can be used in three forms: as an interactive shell, as a command line tool or as a clients API for other applications.
17
clouds. It can be used in three forms: as an interactive shell
18
(`kamaki-shell`), as a command line tool (`kamaki`) or as a clients API for
19
other applications (`kamaki.clients`).
17 20

  
18
To run kamaki as an interactive shell, type
21
To run `kamaki` as an interactive shell, type
19 22

  
20
    kamaki
23
    kamaki-shell
21 24

  
22
To run kamaki as tool type
25
To run `kamaki` as tool type
23 26

  
24 27
    kamaki <group> <command> [...] [options]
25 28

  
26
The kamaki clients API can be imported in python applications as kamaki.clients
29
The kamaki clients API can be imported in python applications as
30
`kamaki.clients`
27 31

  
28 32

  
29 33
List of available command groups:
30 34

  
31
config
35
user
36
    Astakos/Identity API commands
32 37

  
33
    Edit configuration options. Config options are stored in ~/.kamakirc file.
38
project
39
    Astakos project API commands
34 40

  
35
history
41
quota
42
    Astakos/Account API commands for quotas
36 43

  
37
    Access kamaki user history, which is stored in ~/.kamaki.history file.
44
resource
45
    Astakos/Account API commands for resources
38 46

  
39
user
47
file
48
    Pithos+/Storage object level API commands
40 49

  
41
    Get information from Astakos API
50
container
51
    Pithos+/Storage container level API commands
42 52

  
43
server
53
group
54
    Pithos+/Storage user groups
55

  
56
sharer
57
    Pithos+/Storage sharer accounts
44 58

  
45
    Manage compute API virtual machines.
59
server
60
    Cyclades/Compute API server commands
46 61

  
47 62
flavor
63
    Cyclades/Compute API flavor commands
48 64

  
49
    Manage compute API flavors.
65
image
66
    Cyclades/Plankton API image commands
67

  
68
imagecompute
69
    Cyclades/Compute API image commands
50 70

  
51 71
network
72
    Networking API network commands
52 73

  
53
    Manage compute API networks.
74
subnet
75
    Networking API network commands
54 76

  
55 77
ip
78
    Networking API floatingip commands
56 79

  
57
     Manage compute API floating IP commands
58

  
59
image 
80
port
81
    Networking API network Commands
60 82

  
61
    Manage images on Plankton (and Compute).
62

  
63
file
83
config
84
    Kamaki option and cloud configuration
64 85

  
65
    Manage Pithos+ API.
86
history
87
    Kamaki command history
66 88

  
67 89

  
68 90
Hidden command groups
69 91
---------------------
70 92

  
71 93
livetest
72

  
73
    LIve tests that check kamaki against running services. To enable:
94
    Live tests that check kamaki against running services. To enable:
74 95
    kamaki config set livetest.cli livetest
75 96

  
97
service
98
    Astakos API service commands
99

  
100
endpoint
101
    Astakos API endpoints commands
102

  
103
commission
104
    Astakos API commission commands
105

  
76 106

  
77 107
Options
78 108
-------
......
82 112
    --help, -h              Show help message and exit.
83 113
    -v                      Use verbose output.
84 114
    -d                      Use debug output.
85
    -o KEY=VAL              Override a config value (can be used multiple times)
115
    -o KEY=VAL              Override a config value (can be repeated)
116
    --cloud CLOUD           Choose a cloud to connect to
86 117

  
87 118

  
88 119
Commands
89 120
--------
90 121

  
91
config commands
92
***************
93

  
94
* list       list configuration options
95
* get        get a configuration option
96
* set        set a configuration option
97
* del        delete a configuration option
98

  
99

  
100
history commands
101
****************
102

  
103
Command user history, as stored in ~/.kamaki.history
104

  
105
* show      show intersession history
106
* clean     clean up history
107
* run       run/show previously executed command(s)
108

  
109

  
110
user commands
111
*************
112

  
113
* authenticate      Authenticate a user, show user information
122
user
123
****
124

  
125
* authenticate  Authenticate a user, show user information
126
* info          Get info for (current) session user
127
* uuid2name     Get user name(s) from uuid(s)
128
* authenticate  Authenticate a user and get all authentication information
129
* list          List (cached) session users
130
* add           Authenticate a user by token and add to kamaki session (cache)
131
* name2uuid     Get user uuid(s) from name(s)
132
* select        Select a user from the (cached) list as the current session user
133
* delete        Delete a user (token) from the (cached) list of session users
134

  
135
project
136
*******
137

  
138
* info          Get details for a project
139
* unsuspend     Resume a suspended project (special privileges needed)
140
* suspend       Suspend a project (special privileges needed)
141
* list          List all projects
142
* create        Apply for a new project
143
* modify        Modify a project
144
* terminate     Terminate a project (special privileges needed)
145
* application   Application management commands
146
* membership    Project membership management commands
147
* reinstate     Reinstate a terminated project (special privileges needed)
148

  
149
quota
150
*****
151

  
152
* list          Get user quotas
153
* info          Get quota for a service (cyclades, pithos, astakos)
154

  
155
resource
156
********
157

  
158
* list          List user resources
114 159

  
160
file
161
****
162

  
163
* info      Get information/details about a file
164
* truncate  Truncate remote file up to size
165
* mkdir     Create a directory ( create --content-type='applcation/directory' )
166
* create    Create an empty file
167
* move      Move objects, even between different accounts or containers
168
* list      List all objects in a container or a directory object
169
* upload    Upload a file
170
* cat       Fetch remote file contents
171
* modify    Modify the attributes of a file or directory object
172
* append    Append local file to (existing) remote object
173
* download  Download a remove file or directory object to local file system
174
* copy      Copy objects, even between different accounts or containers
175
* overwrite Overwrite part of a remote file
176
* delete    Delete a file or directory object
177

  
178
container
179
*********
180

  
181
* info      Get information about a container
182
* modify    Modify the properties of a container
183
* create    Create a new container
184
* list      List all containers, or their contents
185
* empty     Empty a container
186
* delete    Delete a container
187

  
188
group
189
*****
190

  
191
* create    Create a group of users
192
* list      List all groups and group members
193
* delete    Delete a user group
194

  
195
sharer
196
******
197

  
198
* info      Details on a Pithos+ sharer account (default: current account)
199
* list      List accounts who share file objects with current user
115 200

  
116
server commands
117
***************
201
server
202
******
118 203

  
119
* addr      List the addresses of all network interfaces on a server (VM)
120
* console   Get a VNC console to access an existing server (VM)
121
* create    Create a server (aka Virtual Machine)
122
* delete    Delete a server (VM)
123
* firewall  Set the server (VM) firewall profile for public networks
124
    * set   Set the firewall profile
125
    * get   Get the firewall profile
126 204
* info      Detailed information on a Virtual Machine
127
* list      List Virtual Machines accessible by user
128
* metadata  Manage a server metadata
129
    * list      List server metadata
130
    * set       Add or update server metadata
131
    * delete    Delete a piece of server metadata
132
* reboot    Reboot a server (VM)
133
* rename    Set/update a server (VM) name
134
* shutdown  Shutdown an active server (VM)
135
* start     Start an existing server (VM)
136
* stats     Get server (VM) statistics
137
* resize    Set a different flavor for an existing server
205
* modify    Modify attributes of a virtual server
206
* create    Create a server (aka Virtual Machine)
207
* list      List virtual servers accessible by user
208
* reboot    Reboot a virtual server
209
* start     Start an existing virtual server
210
* shutdown  Shutdown an active virtual server
211
* delete    Delete a virtual server
138 212
* wait      Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]
139 213

  
140

  
141
flavor commands
142
***************
214
flavor
215
******
143 216

  
144 217
* list       list flavors
145 218
* info       get flavor details
146 219

  
220
image
221
*****
147 222

  
148
image commands
149
**************
150

  
151
* list           List images accessible by user
152
* info           Get image metadata
153
* meta           Manage image metadata
154
    * set       Add / update metadata and properties for an image
155
    * delete    Remove/empty image metadata and/or custom properties
156
* register       (Re)Register an image
157
* unregister     Unregister an image (does not delete the image file)
158
* shared         List shared images
159
    * compute        Compute Image API commands
160
    * list       List images
161
    * delete     Delete image
162
    * info       Get image details
163
    * properties Manage properties related to OS installation in an image
164
        * delete Delete a property from an image
165
        * get    Get an image property
166
        * list   List all image properties
167
        * set    Add / update a set of properties for an image
168
* members        Manage members (users who can modify an image)
169
    * add        Add a member to an image
170
    * delete     Remove a member from an image
171
    * list       List members of an image
172
    * set        Set the members of an image
173

  
174

  
175
network commands
176
****************
223
* info          Get image metadata
224
* list          List images accessible by user
225
* register      (Re)Register an image file to an Image service
226
* modify        Add / update metadata and properties for an image
227
* unregister    Unregister an image (does not delete the image file)
228

  
229
imagecompute
230
************
231

  
232
* info      Get detailed information on an image
233
* list      List images
234
* modify    Modify image properties (metadata)
235
* delete    Delete an image (WARNING: image file is also removed)
236

  
237
network
238
*******
177 239

  
178
* connect       Connect a server to a network
179
* create        Create an (unconnected) network
180
* delete        Delete a network
181
* disconnect    Disconnect a nic that connects a server to a network
182
* info          Detailed information on a network
183
* list          List networks
184
* rename        Set the name of a network
240
* info: Get details about a network
241
* disconnect: Disconnect a network from a device
242
* modify: Modify network attributes
243
* create: Create a new network
244
* list: List networks
245
* connect: Connect a network with a device (server or router)
246
* delete: Delete a network
185 247

  
248
subnet
249
******
186 250

  
187
ip commands
188
***********
251
* info      Get details about a subnet
252
* list      List subnets
253
* create    Create a new subnet
254
* modify    Modify the attributes of a subnet
255

  
256
ip
257
**
189 258

  
190 259
* info      Details for an IP
191 260
* list      List reserved floating IPs
......
195 264
* detach    Detach a floating IP from a server
196 265
* reserve   Reserve a floating IP
197 266

  
198
file commands
199
**************
200

  
201
* append         Append local file to remote file
202
* cat            Print a file to console
203
* copy           Copy an object
204
* containerlimit Container size limit commands
205
    * set        Set container data limit
206
    * get        Get container data limit
207
* create         Create a container
208
* delete         Delete a container [or an object]
209
* download       Download a file or directory
210
* group          Manage access groups and group members
211
    * delete     Delete a user group
212
    * list       List groups and group members
213
    * set        Set a user group
214
* hashmap        Get the hashmap of an object
215
* info           Get information for account [, container [or object]]
216
* list           List containers, object trees or objects in a directory
217
* manifest       Create a remote file with uploaded parts by manifestation
218
* metadata       Metadata are attached on objects (key:value pairs)
219
    * delete     Delete metadata with given key
220
    * get        Get metadatum
221
    * set        Set a piece of metadata
222
* mkdir          Create a directory
223
* move           Copy an object
224
* overwrite      Overwrite part (from start to end) of a remote file
225
* permissions    Manage user and group accessibility for objects
226
    * delete     Delete all permissions set on object
227
    * get        Get read and write permissions of an object
228
    * set        Set permissions for an object
229
* publish        Publish an object
230
* purge          Purge a container
231
* quota          Get  quota for account
232
* sharers        List the accounts that share objects with default account
233
* touch          Create an empty object (file)
234
* truncate       Truncate remote file up to a size
235
* unpublish      Unpublish an object
236
* upload         Upload a file or directory
237
* versioning     Manage the versioning scheme of current pithos user account
238
    * get        Get  versioning for account or container
239
    * set        Set versioning mode (auto, none) for account or container
240
    * versions   Get the version list of an object
241

  
242

  
243
test commands (hidden)
244
**********************
267
port
268
****
269

  
270
* info      Get details about a port
271
* list      List all ports
272
* create    Create a new port (== connect server to network)
273
* modify    Modify the attributes of a port
274
* delete    Delete a port (== disconnect server from network)
275
* wait      Wait for port to finish [ACTIVE, DOWN, BUILD, ERROR]
276

  
277
config
278
******
279

  
280
* list       list configuration options
281
* get        get a configuration option
282
* set        set a configuration option
283
* del        delete a configuration option
284

  
285
history
286
*******
287

  
288
Command user history, as stored in ~/.kamaki.history
289

  
290
* show      show intersession history
291
* clean     clean up history
292
* run       run/show previously executed command(s)
293

  
294

  
295
livetest (hidden)
296
*****************
245 297

  
246 298
* all         test all clients
247 299
* args        test how arguments are treated by kamaki
......
252 304
* pithos      test Pithos client
253 305
* prints      user-test print methods for lists and dicts
254 306

  
307
service (hidden)
308
****************
309

  
310
* list          List available services
311
* uuid2username Get service username(s) from uuid(s)
312
* quotas        Get service quotas
313
* username2uuid Get service uuid(s) from username(s)
314

  
315
endpoint (hidden)
316
*****************
317

  
318
* list      Get endpoints service endpoints
319

  
320
commission (hidden)
321
*******************
322

  
323
* info      Get commission info (special privileges required)
324
* resolve   Resolve multiple commissions (special privileges required)
325
* accept    Accept a pending commission  (special privileges required)
326
* reject    Reject a pending commission (special privileges required)
327
* issue     Issue commissions as a json string (special privileges required)
328
* pending   List pending commissions (special privileges required)
329

  
255 330

  
256 331
Author
257 332
------
b/kamaki/cli/commands/astakos.py
163 163
        self._run(usernames=((username, ) + more_usernames))
164 164

  
165 165

  
166
@command(quota_commands)
167
class quota_list(_init_synnefo_astakosclient, _optional_json):
168
    """Get user quotas"""
166
class _quota(_init_synnefo_astakosclient, _optional_json):
169 167

  
170 168
    _to_format = set(['cyclades.disk', 'pithos.diskspace', 'cyclades.ram'])
171 169

  
......
181 179
                        category[service][attr] = format_size(v)
182 180
        self.print_dict(quotas, *args, **kwargs)
183 181

  
182

  
183
@command(quota_commands)
184
class quota_info(_quota):
185
    """Get quota for a service (cyclades, pithos, astakos)"""
186

  
187
    @errors.generic.all
188
    @errors.user.astakosclient
189
    def _run(self, service):
190
        r = dict()
191
        for k, v in self.client.get_quotas()['system'].items():
192
            if (k.startswith(service)):
193
                r[k] = v
194
        self._print({'%s*' % service: r}, self._print_quotas)
195

  
196
    def main(self, service):
197
        super(self.__class__, self)._run()
198
        self._run(service)
199

  
200

  
201
@command(quota_commands)
202
class quota_list(_quota):
203
    """Get user quotas"""
204

  
184 205
    @errors.generic.all
185 206
    @errors.user.astakosclient
186 207
    def _run(self):
......
565 586
#  command project
566 587

  
567 588

  
568
_project_specs = """
569
    {
570
        "name": name,
571
        "owner": uuid,
572
        "homepage": homepage,         # optional
573
        "description": description,   # optional
574
        "comments": comments,         # optional
575
        "start_date": date,           # optional
576
        "end_date": date,
577
        "join_policy": "auto" | "moderated" | "closed",  # default: "moderated"
578
        "leave_policy": "auto" | "moderated" | "closed", # default: "auto"
579
        "resources": {
580
            "cyclades.vm": {
581
                "project_capacity": int or null,
582
                 "member_capacity": int
589
_project_specs = """{
590
    "name": name,
591
    "owner": uuid,
592
    "homepage": homepage,         # optional
593
    "description": description,   # optional
594
    "comments": comments,         # optional
595
    "start_date": date,           # optional
596
    "end_date": date,
597
    "join_policy": "auto" | "moderated" | "closed",  # default: "moderated"
598
    "leave_policy": "auto" | "moderated" | "closed", # default: "auto"
599
    "resources": {
600
        "cyclades.vm": {
601
            "project_capacity": int or null,
602
            "member_capacity": int
583 603
            }
584 604
        }
585
  }
586
  """
605
    }
606
"""
587 607

  
588 608

  
589 609
def apply_notification(foo):
......
632 652

  
633 653
@command(project_commands)
634 654
class project_create(_init_synnefo_astakosclient, _optional_json):
635
    """Apply for a new project (input a json-dict)
636
    Project details must be provided as a json-formated dict from the standard
637
    input, or through a file
655
    """Apply for a new project (enter data though standard input or file path)
656
    Project details must be provided as a json-formated dict from the
657
    standard input, or through a file
638 658
    """
639 659

  
640 660
    __doc__ += _project_specs

Also available in: Unified diff