Revision 6893e31c kamaki/cli/commands/astakos.py

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