コード例 #1
0
 def take_action(self, parsed_args):
     metrics = parsed_args.metric
     query = None
     if parsed_args.query:
         query = utils.search_query_builder(parsed_args.query)
         if len(parsed_args.metric) != 1:
             raise ValueError("One metric is required if query is provied")
         metrics = parsed_args.metric[0]
     measures = self.app.client.metric.aggregation(
         metrics=metrics,
         query=query,
         aggregation=parsed_args.aggregation,
         start=parsed_args.start,
         stop=parsed_args.stop,
         needed_overlap=parsed_args.needed_overlap,
         resource_type=parsed_args.resource_type,
     )
     return self.COLS, measures
コード例 #2
0
 def take_action(self, parsed_args):
     metrics = parsed_args.metric
     query = None
     if parsed_args.query:
         query = utils.search_query_builder(parsed_args.query)
         if len(parsed_args.metric) != 1:
             raise ValueError("One metric is required if query is provied")
         metrics = parsed_args.metric[0]
     measures = self.app.client.metric.aggregation(
         metrics=metrics,
         query=query,
         aggregation=parsed_args.aggregation,
         start=parsed_args.start,
         stop=parsed_args.stop,
         needed_overlap=parsed_args.needed_overlap,
         resource_type=parsed_args.resource_type,
     )
     return self.COLS, measures
コード例 #3
0
 def _do_test(self, expr, expected):
     req = utils.search_query_builder(expr)
     self.assertEqual(expected, req)
コード例 #4
0
 def _do_test(self, expr, expected):
     req = utils.search_query_builder(expr)
     self.assertEqual(expected, req)
コード例 #5
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)
コード例 #6
0
 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)