Enhance get list APIs for alarms and events
Include the optional “expand” option to the get list for alarms and events so the entire set of data can be returned and not just a subset. “expand” is and optional parameter and defaults to False. Story: 2004818 Task: 29096 Change-Id: Ife3b900d90c56564e9aeaa820e57f69d15194eb3 Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
parent
767cdc211c
commit
80a9ad661f
@ -160,6 +160,7 @@ itemNotFound (404)
|
||||
:widths: 20, 20, 20, 60
|
||||
|
||||
"include_suppress (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (include_suppress=true) specifies to include suppressed alarms in output."
|
||||
"expand (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (expand=true) specifies that the response should contains the same response parameters as when querying for a specific alarm."
|
||||
|
||||
**Response parameters**
|
||||
|
||||
@ -386,6 +387,7 @@ itemNotFound (404)
|
||||
"alarms (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (alarms=true) specifies that only alarm event log records should be returned."
|
||||
"logs (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (logs=true) specifies that only customer log records should be returned."
|
||||
"include_suppress (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (include_suppress=true) specifies to include suppressed alarms in output."
|
||||
"expand (Optional)", "query", "xsd:boolean", "This optional parameter when set to true (expand=true) specifies that the response should contains the same response parameters as when querying for a specific event log."
|
||||
|
||||
**Response parameters**
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SRC_DIR="fm"
|
||||
TIS_PATCH_VER=1
|
||||
TIS_PATCH_VER=2
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -276,9 +276,9 @@ class AlarmController(rest.RestController):
|
||||
sort_dir=sort_dir)
|
||||
|
||||
@wsme_pecan.wsexpose(AlarmCollection, [Query],
|
||||
types.uuid, int, wtypes.text, wtypes.text, bool)
|
||||
types.uuid, int, wtypes.text, wtypes.text, bool, bool)
|
||||
def get_all(self, q=[], marker=None, limit=None, sort_key='id',
|
||||
sort_dir='asc', include_suppress=False):
|
||||
sort_dir='asc', include_suppress=False, expand=False):
|
||||
"""Retrieve a list of alarm.
|
||||
|
||||
:param marker: pagination marker for large data sets.
|
||||
@ -286,9 +286,11 @@ class AlarmController(rest.RestController):
|
||||
:param sort_key: column to sort results by. Default: id.
|
||||
:param sort_dir: direction to sort. "asc" or "desc". Default: asc.
|
||||
:param include_suppress: filter on suppressed alarms. Default: False
|
||||
:param expand: filter for getting all the data of the alarm.
|
||||
Default: False
|
||||
"""
|
||||
return self._get_alarm_collection(marker, limit, sort_key,
|
||||
sort_dir, q=q,
|
||||
sort_dir, expand=expand, q=q,
|
||||
include_suppress=include_suppress)
|
||||
|
||||
@wsme_pecan.wsexpose(AlarmCollection, types.uuid, int,
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -237,10 +237,10 @@ class EventLogController(rest.RestController):
|
||||
|
||||
@wsme_pecan.wsexpose(EventLogCollection, [Query],
|
||||
types.uuid, int, wtypes.text, wtypes.text,
|
||||
bool, bool, bool)
|
||||
bool, bool, bool, bool)
|
||||
def get_all(self, q=[], marker=None, limit=None, sort_key='timestamp',
|
||||
sort_dir='desc', alarms=False, logs=False,
|
||||
include_suppress=False):
|
||||
include_suppress=False, expand=False):
|
||||
"""Retrieve a list of event_log.
|
||||
|
||||
:param marker: pagination marker for large data sets.
|
||||
@ -250,10 +250,12 @@ class EventLogController(rest.RestController):
|
||||
:param alarms: filter on alarms. Default: False
|
||||
:param logs: filter on logs. Default: False
|
||||
:param include_suppress: filter on suppressed alarms. Default: False
|
||||
:param expand: filter for getting all the data of the event.
|
||||
Default: False
|
||||
"""
|
||||
return self._get_eventlog_collection(marker, limit, sort_key,
|
||||
sort_dir, q=q, alarms=alarms,
|
||||
logs=logs,
|
||||
sort_dir, expand=expand, q=q,
|
||||
alarms=alarms, logs=logs,
|
||||
include_suppress=include_suppress)
|
||||
|
||||
@wsme_pecan.wsexpose(EventLogCollection, types.uuid, int,
|
||||
|
@ -1,2 +1,2 @@
|
||||
SRC_DIR="fmclient"
|
||||
TIS_PATCH_VER=1
|
||||
TIS_PATCH_VER=2
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -21,11 +21,13 @@ class AlarmManager(base.Manager):
|
||||
return '/v1/alarms/%s' % id if id else '/v1/alarms'
|
||||
|
||||
def list(self, q=None, limit=None, marker=None, sort_key=None,
|
||||
sort_dir=None, include_suppress=False):
|
||||
sort_dir=None, include_suppress=False, expand=False):
|
||||
params = []
|
||||
|
||||
if include_suppress:
|
||||
params.append('include_suppress=True')
|
||||
if expand:
|
||||
params.append('expand=True')
|
||||
if limit:
|
||||
params.append('limit=%s' % str(limit))
|
||||
if marker:
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2018-2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -21,7 +21,8 @@ class EventLogManager(base.Manager):
|
||||
def _path(id=None):
|
||||
return '/v1/event_log/%s' % id if id else '/v1/event_log'
|
||||
|
||||
def list(self, q=None, limit=None, marker=None, alarms=False, logs=False, include_suppress=False):
|
||||
def list(self, q=None, limit=None, marker=None, alarms=False, logs=False,
|
||||
include_suppress=False, expand=False):
|
||||
params = []
|
||||
if limit:
|
||||
params.append('limit=%s' % str(limit))
|
||||
@ -29,6 +30,8 @@ class EventLogManager(base.Manager):
|
||||
params.append('marker=%s' % str(marker))
|
||||
if include_suppress:
|
||||
params.append('include_suppress=True')
|
||||
if expand:
|
||||
params.append('expand=True')
|
||||
if alarms is True and logs is False:
|
||||
params.append('alarms=True')
|
||||
elif alarms is False and logs is True:
|
||||
|
Loading…
Reference in New Issue
Block a user