Revision 9d84caa4

b/docs/commands.rst
65 65
    modify        Modify a project
66 66
    terminate     Terminate a project (special privileges needed)
67 67
    application   Application management commands
68
    membership    Project membership management commands
69 68
    reinstate     Reinstate a terminated project (special privileges needed)
70 69

  
70
membership (Astakos)
71
--------------------
72

  
73
.. code-block:: text
74

  
75
    info    Details on a membership
76
    enroll  Enroll somebody to a project you manage
77
    join    Join a project
78
    list    List all memberships
79
    accept  Accept a membership for a project you manage
80
    leave   Leave a project you have membership to
81
    remove  Remove a membership for a project you manage
82
    reject  Reject a membership for a project you manage
83
    cancel  Cancel your (probably pending) membership to a project
84

  
71 85
quota (Account/Astakos)
72 86
-----------------------
73 87

  
b/docs/examplesdir/astakos.rst
11 11
User
12 12
----
13 13

  
14
The *authenticate* command will send a token to the server, for authentication.
15
Be default, the token provided in the cloud configuration (config file) will be
16
used:
17

  
14 18
.. code-block:: console
15 19

  
16 20
    $ kamaki user authenticate
......
25 29
        name: cyclades_admin
26 30
    user:
27 31
        roles_links:
28
        id: some-u53r-1d
32
        id: s0m3-u53r-1d
29 33
        roles:
30 34
            id: 1
31 35
            name: default
32 36
        name: Example User
33 37

  
38
To authenticate other users, provide their token, as shown bellow:
39

  
40
.. code-block:: console
41

  
34 42
    $ kamaki user add z01db3rgs-u53r-t0k3n
35 43
    ...
36 44
    endpoints:
......
48 56
            id: 1
49 57
            name: default
50 58
        name: Dr. Harold Zoidberg
59
    $ kamaki user list
60
    s0m5-u53r-1d       Example User
61
    z01db3rgs-u53r-1d  Dr. Harold Zoidberg
62

  
63
At any time, get the current user's information, or provide a user id for
64
information on any existing user. In the following example, "Example User" is
65
the current user, meaning that all kamaki commands will run for him/her.
66

  
67
.. code-block:: console
51 68

  
52 69
    $ kamaki user info
53 70
    roles_links:
......
65 82
        name: default
66 83
    name: EDr. Harold Zoidberg
67 84

  
85
You can switch between authenticated users
86

  
87
.. code-block:: console
88

  
68 89
    $ kamaki user select z01db3rgs-u53r-1d
69 90
    Are you sure? [y/N]: y
70 91

  
92
Use the *uuid2name* and *name2uuid* commands to map uuids to usernames and vice
93
versa.
94

  
95
.. code-block:: console
96

  
71 97
    $ kamaki user uuid2name z01db3rgs-u53r-1d s0m3-u53r-1d
72 98
    z01db3rgs-u53r-1d: zoidberg@planetexpress.com
73 99
    s0m3-u53r-1d: someuser@example.com
......
75 101
Quotas and resources
76 102
--------------------
77 103

  
104
Each user is assigned a set of limits on various resources:
105

  
78 106
.. code-block:: console
79 107

  
80 108
    $ kamaki quota list
......
104 132
            limit: 5
105 133
            pending: 0
106 134

  
135
If the information above is not clear, use *resource list* for descriptions
136
fetched fresh from the server:
137

  
138
.. code-block:: console
139

  
107 140
    $ kamaki resource list
108 141
    cyclades.disk:
109 142
        service: cyclades_compute
......
139 172
Projects
140 173
--------
141 174

  
175
If the standard policy of a synnefo deployment does not meet the needs of an
176
organization, they should make a request for a *synnefo project*.
177

  
178
First, create a file with the project specification. The specification should
179
be in json format, as described at the
180
`project API <http://www.synnefo.org/docs/synnefo/latest/project-api-guide.html#create-a-project>`_
181
(see "Example request").
182

  
183
Let's request a project of 48 CPUs, with an 8 CPU limit per member. Also 200GB
184
storage space per user, without a project limit.
185

  
186
.. code-block:: console
187

  
188
    $ cat > my_project.txt
189
    {
190
        "name": "My example project",
191
        "homepage": "http://www.exampleorganization.org",
192
        "description": "An example testing project",
193
        "comments": "We need more CPUs and more disk space",
194
        "end_date": "2031-02-13",
195
        "resources": {
196
            "cyclades.vm": {
197
                "project_capacity": 48,
198
                "member_capacity": 8
199
            },
200
            "pithos.diskspace": {
201
                "project_capacity": None,
202
                "member_capacity": 53687091200
203
            }
204
        }
205
    }
206
    $ cat my_project.txt | kamaki project create
207

  
208
List all the projects to see if our project is listed
209

  
142 210
.. code-block:: console
143 211

  
144 212
    $ kamaki project list
......
189 257
                member_capacity: 1000
190 258
                project_capacity: None
191 259

  
260
No, our project is not in the list yet, probably because we wait for (manual)
261
authorization.
262

  
263
To get information on a project:
264

  
265
.. code-block:: console
266

  
267
    $ kamaki project info 29
268
    name: many.quotas
269
    id: 29
270
    end_date: 2013-12-12T00:00:00+00:00
271
    description: I need more quotas
272
    join_policy: moderated
273
    max_members: 10
274
    applicant: s0m3-u53r-1d
275
    leave_policy: auto
276
    creation_date: 2013-02-14T09:26:23.034177+00:00
277
    application: 108
278
    state: active
279
    start_date: 2013-02-14T00:00:00+00:00
280
    owner: s0m3-u53r-1d
281
    homepage: http://example.com
282
    resources:
283
        cyclades.disk:
284
            member_capacity: 109951162777600
285
            project_capacity: None
286
        cyclades.vm:
287
            member_capacity: 1000
288
            project_capacity: None
289
        cyclades.cpu:
290
            member_capacity: 2000
291
            project_capacity: None
292
        cyclades.ram:
293
            member_capacity: 4398046511104
294
            project_capacity: None
295
        pithos.diskspace:
296
            member_capacity: 107374182400
297
            project_capacity: None
298
        cyclades.floating_ip:
299
            member_capacity: 1000
300
            project_capacity: None
301

  
302
Project membership
303
------------------
304

  
305
Assuming that our project has been approved and assigned the id 42, we can now
306
see its details and assign users to benefit from it.
307

  
308
.. code-block:: console
309

  
310
    $ kamaki project info 42
311
        name: My example project
312
        id: 42
313
        end_date: 2031-02-13T00:00:00+00:00
314
        description: An example testing project
315
        commends: We need more CPUs and more disk space
316
        join_policy: moderated
317
        applicant: s0m3-u53r-1d
318
        leave_policy: auto
319
        creation_date: <NOW>
320
        application: 109
321
        state: active
322
        start_date: <NOW>
323
        owner: s0m3-u53r-1d
324
        homepage: http://example.com
325
        resources:
326
            cyclades.disk:
327
                member_capacity: 107374182400
328
                project_capacity: None
329
            cyclades.vm:
330
                member_capacity: 2
331
                project_capacity: None
332
            cyclades.cpu:
333
                member_capacity: 8
334
                project_capacity: 48
335
            cyclades.ram:
336
                member_capacity: 6442450944
337
                project_capacity: None
338
            pithos.diskspace:
339
                member_capacity: 53687091200
340
                project_capacity: None
341
            cyclades.floating_ip:
342
                member_capacity: 2
343
                project_capacity: None
344

  
345
Great! Now, we should allow some users to benefit from this project:
346

  
347
.. code-block:: console
348

  
349
    $ kamaki membership enroll 42 my_favorite@user.example.com
350
    Membership id: 128345
351
    $ kamaki membership enroll 42 that_guy@user.example.com
352
    Membership id: 128346
353
    $ kamaki membership list --with-project-id=42
354
    128345
355
        42 my_favorite@user.example.com OK
356
    238346
357
        42 that_guy@user.example.com OK
358

  
359
We changed our minds: we don't want the last user to be part of the project:
360

  
361
    .. code-block:: console
362

  
363
        $ kamaki membership remove 238346 "Our cooperation was not productive"
364

  
365
Later, the removed user attempts to apply for our project:
366

  
367
.. code-block:: console    
368

  
369
    that_guy$ kamaki membership join 42
370

  
371
We may reject his application:
372

  
373
.. code-block:: console
374

  
375
    $ kamaki memebrship list
376
    128345
377
        42 my_favorite@user.example.com OK
378
    238347
379
        42 that_guy@user.example.com PENDING
380
    $ kamaki membership reject 238347 "Not in need of a new partner"
381

  
382
or accept:
383

  
384
.. code-block:: console    
385

  
386
    $ kamaki membership accept 238347
387

  
388
In the later case, the user decided to leave the project:
389

  
390
.. code-block:: console    
391

  
392
    that_guy$ kamaki membership leave 42
b/docs/man/kamaki.rst
38 38
project
39 39
    Astakos project API commands
40 40

  
41
membership
42
    Astakos project membership API commands
43

  
41 44
quota
42 45
    Astakos/Account API commands for quotas
43 46

  
......
146 149
* membership    Project membership management commands
147 150
* reinstate     Reinstate a terminated project (special privileges needed)
148 151

  
152
membership
153
**********
154

  
155
* info      Details on a membership
156
* enroll    Enroll somebody to a project you manage
157
* join      Join a project
158
* list      List all memberships
159
* accept    Accept a membership for a project you manage
160
* leave     Leave a project you have membership to
161
* remove    Remove a membership for a project you manage
162
* reject    Reject a membership for a project you manage
163
* cancel    Cancel your (probably pending) membership to a project
164

  
149 165
quota
150 166
*****
151 167

  
b/kamaki/cli/commands/astakos.py
52 52
resource_commands = CommandTree(
53 53
    'resource', 'Astakos/Account API commands for resources')
54 54
project_commands = CommandTree('project', 'Astakos project API commands')
55
membership_commands = CommandTree(
56
    'membership', 'Astakos project membership API commands')
55 57

  
56 58

  
57 59
#  Optional
......
64 66

  
65 67
_commands = [
66 68
    user_commands, quota_commands, resource_commands, project_commands,
67
    service_commands, commission_commands, endpoint_commands]
69
    service_commands, commission_commands, endpoint_commands,
70
    membership_commands]
68 71

  
69 72

  
70 73
def with_temp_token(func):
......
821 824
    action = 'cancel'
822 825

  
823 826

  
824
@command(project_commands)
825
class project_membership(_init_synnefo_astakosclient):
827
@command(membership_commands)
828
class membership(_init_synnefo_astakosclient):
826 829
    """Project membership management commands"""
827 830

  
828 831

  
829
@command(project_commands)
830
class project_membership_list(_init_synnefo_astakosclient, _optional_json):
832
@command(membership_commands)
833
class membership_list(_init_synnefo_astakosclient, _optional_json):
831 834
    """List all memberships"""
832 835

  
833 836
    arguments = dict(
......
844 847
        self._run()
845 848

  
846 849

  
847
@command(project_commands)
848
class project_membership_info(_init_synnefo_astakosclient, _optional_json):
850
@command(membership_commands)
851
class membership_info(_init_synnefo_astakosclient, _optional_json):
849 852
    """Details on a membership"""
850 853

  
851 854
    @errors.generic.all
......
874 877
        self._run(membership_id, quote_a_reason)
875 878

  
876 879

  
877
@command(project_commands)
878
class project_membership_leave(_membership_action):
880
@command(membership_commands)
881
class membership_leave(_membership_action):
879 882
    """Leave a project you have membership to"""
880 883
    action = 'leave'
881 884

  
882 885

  
883
@command(project_commands)
884
class project_membership_cancel(_membership_action):
886
@command(membership_commands)
887
class membership_cancel(_membership_action):
885 888
    """Cancel your (probably pending) membership to a project"""
886 889
    action = 'cancel'
887 890

  
888 891

  
889
@command(project_commands)
890
class project_membership_accept(_membership_action):
892
@command(membership_commands)
893
class membership_accept(_membership_action):
891 894
    """Accept a membership for a project you manage"""
892 895
    action = 'accept'
893 896

  
894 897

  
895
@command(project_commands)
896
class project_membership_reject(_membership_action):
898
@command(membership_commands)
899
class membership_reject(_membership_action):
897 900
    """Reject a membership for a project you manage"""
898 901
    action = 'reject'
899 902

  
900 903

  
901
@command(project_commands)
902
class project_membership_remove(_membership_action):
904
@command(membership_commands)
905
class membership_remove(_membership_action):
903 906
    """Remove a membership for a project you manage"""
904 907
    action = 'remove'
905 908

  
906 909

  
907
@command(project_commands)
908
class project_membership_join(_init_synnefo_astakosclient):
910
@command(membership_commands)
911
class membership_join(_init_synnefo_astakosclient):
909 912
    """Join a project"""
910 913

  
911 914
    @errors.generic.all
......
914 917
        self.writeln(self.client.join_project(project_id))
915 918

  
916 919
    def main(self, project_id):
917
        super(project_membership_join, self)._run()
920
        super(membership_join, self)._run()
918 921
        self._run(project_id)
919 922

  
920 923

  
921
@command(project_commands)
922
class project_membership_enroll(_init_synnefo_astakosclient):
924
@command(membership_commands)
925
class membership_enroll(_init_synnefo_astakosclient):
923 926
    """Enroll somebody to a project you manage"""
924 927

  
925 928
    @errors.generic.all
......
928 931
        self.writeln(self.client.enroll_member(project_id, email))
929 932

  
930 933
    def main(self, project_id, email):
931
        super(project_membership_join, self)._run()
934
        super(membership_join, self)._run()
932 935
        self._run(project_id, email)
b/kamaki/cli/config/__init__.py
82 82
        'quota_cli': 'astakos',
83 83
        'resource_cli': 'astakos',
84 84
        'project_cli': 'astakos',
85
        'membership_cli': 'astakos',
85 86
        'file_cli': 'pithos',
86 87
        'container_cli': 'pithos',
87 88
        'sharer_cli': 'pithos',

Also available in: Unified diff