def test_one(self): url = options.build_url('/', [{ 'field': 'this', 'op': 'gt', 'value': 43 }]) self.assertEqual(url, '/?q.field=this&q.op=gt&q.type=&q.value=43')
def test_with_data_type(self): url = options.build_url('/', [{ 'field': 'f1', 'value': '10', 'type': 'integer' }]) self.assertEqual('/?q.field=f1&q.op=&q.type=integer&q.value=10', url)
def list(self, meter_name, q=None, period=None, groupby=[], aggregates=[]): p = ['period=%s' % period] if period else [] if isinstance(groupby, six.string_types): groupby = [groupby] p.extend(['groupby=%s' % g for g in groupby] if groupby else []) p.extend(self._build_aggregates(aggregates)) return self._list( options.build_url('/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, meter_name, q=None, period=None, groupby=None, aggregates=None): groupby = groupby or [] aggregates = aggregates or [] p = ["period=%s" % period] if period else [] if isinstance(groupby, six.string_types): groupby = [groupby] p.extend(["groupby=%s" % g for g in groupby] if groupby else []) p.extend(self._build_aggregates(aggregates)) return self._list(options.build_url("/v2/meters/" + meter_name + "/statistics", q, p))
def test_two(self): url = options.build_url( "/", [{"field": "this", "op": "gt", "value": 43}, {"field": "that", "op": "lt", "value": 88}] ) ops = "q.op=gt&q.op=lt" vals = "q.value=43&q.value=88" types = "q.type=&q.type=" fields = "q.field=this&q.field=that" self.assertEqual(url, "/?%s&%s&%s&%s" % (fields, ops, types, vals))
def list(self, meter_name, q=None, period=None, groupby=[], aggregates=[]): p = ['period=%s' % period] if period else [] if isinstance(groupby, six.string_types): groupby = [groupby] p.extend(['groupby=%s' % g for g in groupby] if groupby else []) p.extend(self._build_aggregates(aggregates)) return self._list(options.build_url( '/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, q=None, limit=None, unique=False): path = '/v2/meters' params = [] if limit: params.append('limit=%s' % limit) if unique: params.append('unique=%s' % str(unique)) return self._list(options.build_url(path, q, params))
def test_two(self): url = options.build_url('/', [{'field': 'this', 'op': 'gt', 'value': 43}, {'field': 'that', 'op': 'lt', 'value': 88}]) ops = 'q.op=gt&q.op=lt' vals = 'q.value=43&q.value=88' fields = 'q.field=this&q.field=that' self.assertEqual(url, '/?%s&%s&%s' % (ops, vals, fields))
def test_two(self): url = options.build_url('/', [{ 'field': 'this', 'op': 'gt', 'value': 43 }, { 'field': 'that', 'op': 'lt', 'value': 88 }]) ops = 'q.op=gt&q.op=lt' vals = 'q.value=43&q.value=88' fields = 'q.field=this&q.field=that' self.assertEqual(url, '/?%s&%s&%s' % (ops, vals, fields))
def list(self, q=None, limit=None, marker=None, sort_key=None, sort_dir=None, include_suppress=False): params = [] if include_suppress: params.append('include_suppress=True') if limit: params.append('limit=%s' % str(limit)) if marker: params.append('marker=%s' % str(marker)) if sort_key: params.append('sort_key=%s' % str(sort_key)) if sort_dir: params.append('sort_dir=%s' % str(sort_dir)) return self._list(options.build_url(self._path(), q, params), 'ialarms')
def list(self, q=None, limit=None, marker=None, alarms=False, logs=False, include_suppress=False): params = [] if limit: params.append('limit=%s' % str(limit)) if marker: params.append('marker=%s' % str(marker)) if include_suppress: params.append('include_suppress=True') if alarms==True and logs==False: params.append('alarms=True') elif alarms==False and logs==True: params.append('logs=True') restAPIURL = options.build_url(self._path(), q, params) l = self._list(restAPIURL, 'event_log') return l
def test_with_data_type(self): url = options.build_url("/", [{"field": "f1", "value": "10", "type": "integer"}]) self.assertEqual("/?q.field=f1&q.op=&q.type=integer&q.value=10", url)
def test_one_param(self): url = options.build_url("/", None, ["period=60"]) self.assertEqual(url, "/?period=60")
def test_default_op(self): url = options.build_url('/', [{'field': 'this', 'value': 43}]) self.assertEqual(url, '/?q.op=&q.value=43&q.field=this')
def test_one(self): url = options.build_url('/', [{'field': 'this', 'op': 'gt', 'value': 43}]) self.assertEqual(url, '/?q.op=gt&q.value=43&q.field=this')
def list(self, meter_name, q=None): return self._list(options.build_url( '/v2/meters/' + meter_name + '/statistics', q))
def list(self, meter_name, q=None, period=None, groupby=[]): p = ['period=%s' % period] if period else [] p.extend(['groupby=%s' % g for g in groupby] if groupby else []) return self._list(options.build_url( '/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, q=None, links=True): path = '/v2/resources' params = ['meter_links=%d' % (1 if links else 0)] return self._list(options.build_url(path, q, params))
def list(self, meter_name, q=None, period=None, groupby=[]): p = ['period=%s' % period] if period else [] p.extend(['groupby=%s' % g for g in groupby] if groupby else []) return self._list( options.build_url('/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, q=None): path = '/v2/meters' return self._list(options.build_url(path, q))
def list(self, meter_name, q=None, period=None): p = ['period=%s' % period] if period else None return self._list( options.build_url('/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, q=None, limit=None): path = '/v2/meters' params = ['limit=%s' % limit] if limit else None return self._list(options.build_url(path, q, params))
def get_history(self, alarm_id, q=None): path = '%s/history' % self._path(alarm_id) url = options.build_url(path, q) return self._list(url, obj_class=AlarmChange)
def list(self, meter_name=None, q=None): path = self._path(counter_name=meter_name) return self._list(options.build_url(path, q))
def list(self, meter_name, q=None, period=None): p = ['period=%s' % period] if period else None return self._list(options.build_url( '/v2/meters/' + meter_name + '/statistics', q, p))
def list(self, meter_name=None, q=None, limit=None): path = self._path(counter_name=meter_name) params = ['limit=%s' % str(limit)] if limit else None return self._list(options.build_url(path, q, params))
def list(self, q=None, limit=None): params = ['limit=%s' % str(limit)] if limit else None return self._list(options.build_url("/v2/samples", q, params))
def test_with_data_type(self): url = options.build_url('/', [{'field': 'f1', 'value': '10', 'type': 'integer'}]) self.assertEqual('/?q.field=f1&q.op=&q.type=integer&q.value=10', url)
def list(self, q=None, links=None, limit=None): path = '/v2/resources' params = ['meter_links=%d' % (1 if links else 0)] if limit: params.append('limit=%s' % limit) return self._list(options.build_url(path, q, params))
def list(self, q=None): return self._list(options.build_url(self._path(), q))
def list(self, q=None): params = [] restAPIURL = options.build_url(self._path(), q, params) return self._list(restAPIURL, 'event_suppression')
def test_default_op(self): url = options.build_url("/", [{"field": "this", "value": 43}]) self.assertEqual(url, "/?q.field=this&q.op=&q.type=&q.value=43")
def summary(self, include_suppress=False): params = [] if include_suppress: params.append('include_suppress=True') return self._list(options.build_url(self._path('summary'), None ,params))
def test_two_params(self): url = options.build_url("/", None, ["period=60", "others=value"]) self.assertEqual(url, "/?period=60&others=value")
def test_one_param(self): url = options.build_url('/', None, ['period=60']) self.assertEqual(url, '/?period=60')
def list(self, q=None, limit=None): path = "/v2/events" params = ["limit=%s" % limit] if limit else None return self._list(options.build_url(path, q, params))
def test_two_params(self): url = options.build_url('/', None, ['period=60', 'others=value']) self.assertEqual(url, '/?period=60&others=value')
def list(self, meter_name=None, q=None): path = "/v2/meters" if meter_name: path += "/" + meter_name return self._list(options.build_url(path, q))
def list(self, q=None): path = '/v2/resources' return self._list(options.build_url(path, q))
def list(self, q=None, limit=None): path = '/v2/wrs-metertypes' params = ['limit=%s' % limit] if limit else None return self._list(options.build_url(path, q, params))
def list(self, q=None): return self._list(options.build_url(self._path(), q), "parameters")