def take_action(self, parsed_args):
     resources = utils.get_client(self).resource.history(
         resource_type=parsed_args.resource_type,
         resource_id=parsed_args.resource_id,
         **utils.get_pagination_options(parsed_args))
     cols = resources[0].keys() if resources else self.COLS
     if parsed_args.formatter == 'table':
         return utils.list2cols(cols, map(normalize_metrics, resources))
     return utils.list2cols(cols, resources)
Example #2
0
 def take_action(self, parsed_args):
     metrics = utils.get_client(self).metric.list(
         **utils.get_pagination_options(parsed_args))
     for metric in metrics:
         utils.format_archive_policy(metric["archive_policy"])
         utils.format_move_dict_to_root(metric, "archive_policy")
     return utils.list2cols(self.COLS, metrics)
Example #3
0
 def take_action(self, parsed_args):
     metrics = utils.get_client(self).metric.list(
         **utils.get_pagination_options(parsed_args))
     for metric in metrics:
         utils.format_archive_policy(metric["archive_policy"])
         utils.format_move_dict_to_root(metric, "archive_policy")
     return utils.list2cols(self.COLS, metrics)
Example #4
0
 def _list2cols(self, resources):
     """Return a formatted list of resources."""
     if not resources:
         return self.COLS, []
     cols = list(self.COLS)
     for k in resources[0]:
         if k not in cols:
             cols.append(k)
     if 'creator' in cols:
         cols.remove('created_by_user_id')
         cols.remove('created_by_project_id')
     return utils.list2cols(cols, resources)
 def _list2cols(self, resources):
     """Return a formatted list of resources."""
     if not resources:
         return self.COLS, []
     cols = list(self.COLS)
     for k in resources[0]:
         if k not in cols:
             cols.append(k)
     if 'creator' in cols:
         cols.remove('created_by_user_id')
         cols.remove('created_by_project_id')
     return utils.list2cols(cols, resources)
 def take_action(self, parsed_args):
     resource_types = utils.get_client(self).resource_type.list()
     for resource_type in resource_types:
         resource_type['attributes'] = utils.format_dict_dict(
             resource_type['attributes'])
     return utils.list2cols(self.COLS, resource_types)
Example #7
0
 def take_action(self, parsed_args):
     metrics = self.app.client.metric.list()
     for metric in metrics:
         utils.format_archive_policy(metric["archive_policy"])
         utils.format_move_dict_to_root(metric, "archive_policy")
     return utils.list2cols(self.COLS, metrics)
Example #8
0
 def take_action(self, parsed_args):
     policies = utils.get_client(self).archive_policy.list()
     if parsed_args.formatter == 'table':
         for ap in policies:
             utils.format_archive_policy(ap)
     return utils.list2cols(self.COLS, policies)
 def take_action(self, parsed_args):
     ap_rules = utils.get_client(self).archive_policy_rule.list()
     return utils.list2cols(self.COLS, ap_rules)
 def take_action(self, parsed_args):
     resource_types = utils.get_client(self).resource_type.list()
     for resource_type in resource_types:
         resource_type['attributes'] = utils.format_dict_dict(
             resource_type['attributes'])
     return utils.list2cols(self.COLS, resource_types)
 def take_action(self, parsed_args):
     policies = utils.get_client(self).archive_policy.list()
     if parsed_args.formatter == 'table':
         for ap in policies:
             utils.format_archive_policy(ap)
     return utils.list2cols(self.COLS, policies)
 def take_action(self, parsed_args):
     policies = self.app.client.archive_policy.list()
     for ap in policies:
         utils.format_archive_policy(ap)
     return utils.list2cols(self.COLS, policies)
Example #13
0
 def take_action(self, parsed_args):
     resources = self.app.client.resource.search(
         resource_type=parsed_args.resource_type,
         query=utils.search_query_builder(parsed_args.query),
         **self._get_pagination_options(parsed_args))
     return utils.list2cols(self.COLS, resources)
Example #14
0
 def take_action(self, parsed_args):
     resources = self.app.client.resource.history(
         resource_type=parsed_args.resource_type,
         resource_id=parsed_args.resource_id,
         **self._get_pagination_options(parsed_args))
     return utils.list2cols(self.COLS, resources)
 def take_action(self, parsed_args):
     resources = utils.get_client(self).resource.search(
         resource_type=parsed_args.resource_type,
         query=parsed_args.query,
         **utils.get_pagination_options(parsed_args))
     return utils.list2cols(self.COLS, resources)
 def take_action(self, parsed_args):
     resources = self.app.client.resource.search(
         resource_type=parsed_args.resource_type,
         request=utils.search_query_builder(parsed_args.query),
         **self._get_pagination_options(parsed_args))
     return utils.list2cols(self.COLS, resources)
 def take_action(self, parsed_args):
     resources = self.app.client.resource.history(
         resource_type=parsed_args.resource_type,
         resource_id=parsed_args.resource_id,
         **self._get_pagination_options(parsed_args))
     return utils.list2cols(self.COLS, resources)
 def take_action(self, parsed_args):
     metrics = self.app.client.metric.list()
     for metric in metrics:
         utils.format_archive_policy(metric["archive_policy"])
         utils.format_move_dict_to_root(metric, "archive_policy")
     return utils.list2cols(self.COLS, metrics)
 def take_action(self, parsed_args):
     policies = self.app.client.archive_policy.list()
     for ap in policies:
         utils.format_archive_policy(ap)
     return utils.list2cols(self.COLS, policies)