Revision ad696342
b/kamaki/cli/commands/astakos.py | ||
---|---|---|
37 | 37 |
from kamaki.cli import command |
38 | 38 |
from kamaki.clients.astakos import LoggedAstakosClient |
39 | 39 |
from kamaki.cli.commands import ( |
40 |
_command_init, errors, _optional_json, addLogSettings) |
|
40 |
_command_init, errors, _optional_json, addLogSettings, _name_filter)
|
|
41 | 41 |
from kamaki.cli.command_tree import CommandTree |
42 | 42 |
from kamaki.cli.errors import CLIBaseUrlError, CLISyntaxError, CLIError |
43 | 43 |
from kamaki.cli.argument import ( |
44 | 44 |
FlagArgument, ValueArgument, IntArgument, CommaSeparatedListArgument) |
45 |
from kamaki.cli.utils import format_size |
|
45 |
from kamaki.cli.utils import format_size, filter_dicts_by_dict
|
|
46 | 46 |
|
47 | 47 |
# Mandatory |
48 | 48 |
|
... | ... | |
572 | 572 |
|
573 | 573 |
|
574 | 574 |
@command(endpoint_commands) |
575 |
class endpoint_list(_init_synnefo_astakosclient, _optional_json): |
|
575 |
class endpoint_list( |
|
576 |
_init_synnefo_astakosclient, _optional_json, _name_filter): |
|
576 | 577 |
"""Get endpoints service endpoints""" |
577 | 578 |
|
579 |
arguments = dict(endpoint_type=ValueArgument('Filter by type', '--type')) |
|
580 |
|
|
578 | 581 |
@errors.generic.all |
579 | 582 |
@errors.user.astakosclient |
580 | 583 |
def _run(self): |
581 |
self._print(self.client.get_endpoints(), self.print_dict) |
|
584 |
r = self.client.get_endpoints()['access']['serviceCatalog'] |
|
585 |
r = self._filter_by_name(r) |
|
586 |
if self['endpoint_type']: |
|
587 |
r = filter_dicts_by_dict(r, dict(type=self['endpoint_type'])) |
|
588 |
self._print(r) |
|
582 | 589 |
|
583 | 590 |
def main(self): |
584 | 591 |
super(self.__class__, self)._run() |
Also available in: Unified diff