# Path: vitrageclient/common/utils.py
# def args_to_dict(args, attrs):
# def list2cols(cols, objs):
# def list2cols_with_rename(names_and_keys, objs):
# def get_client(obj):
# def wait_for_action_to_end(timeout, func, **kwargs):
# def find_template_with_uuid(uuid, templates):


from cliff import lister
from cliff import show
from vitrageclient.common import utils
                            dest='resource_type',
                            metavar='<resource type>',
                            help='Type of resource')
        parser.add_argument('--all-tenants',
                            default=False,
                            dest='all_tenants',
                            action='store_true',
                            help='Shows resources of all the tenants')
        parser.add_argument('--filter',
                            metavar='<query>',
                            help='resource query')

        return parser

    def take_action(self, parsed_args):
        resource_type = parsed_args.resource_type
        all_tenants = parsed_args.all_tenants
        query = parsed_args.filter
        resources = utils.get_client(self).resource.list(
            resource_type=resource_type,
            all_tenants=all_tenants,
            query=query)
        # cluster, zone and host don't have "project_id" property
        # neutron.port don't have "name" property
        # cluster don't have "update_timestamp"
        for resource in resources:
            resource['metadata'] = \
                {item: resource[item] for item in self.METADATA
                 if item in resource}


# Path: vitrageclient/common/utils.py
# def args_to_dict(args, attrs):
# def list2cols(cols, objs):
# def list2cols_with_rename(names_and_keys, objs):
# def get_client(obj):
# def wait_for_action_to_end(timeout, func, **kwargs):
# def find_template_with_uuid(uuid, templates):


# Path: vitrageclient/v1/cli/resource.py
from cliff import lister
from cliff import show
from vitrageclient.common import utils

                            dest='resource_type',
                            metavar='<resource type>',
                            help='Type of resource')
        parser.add_argument('--all-tenants',
                            default=False,
                            dest='all_tenants',
                            action='store_true',
                            help='Shows resources of all the tenants')
        parser.add_argument('--filter',
                            metavar='<query>',
                            help='resource query')

        return parser

    def take_action(self, parsed_args):
        resource_type = parsed_args.resource_type
        all_tenants = parsed_args.all_tenants
        query = parsed_args.filter
        resources = utils.get_client(self).resource.list(
            resource_type=resource_type,
            all_tenants=all_tenants,
            query=query)
        # cluster, zone and host don't have "project_id" property
        # neutron.port don't have "name" property
        # cluster don't have "update_timestamp"
        for resource in resources:
            resource['metadata'] = \
                {item: resource[item] for item in self.METADATA
                 if item in resource}


        return utils.list2cols_with_rename(