diff --git a/releasenotes/notes/add_alarm_show_api-0b001dd185e2e523.yaml b/releasenotes/notes/add_alarm_show_api-0b001dd185e2e523.yaml deleted file mode 100644 index 703195e7d..000000000 --- a/releasenotes/notes/add_alarm_show_api-0b001dd185e2e523.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -features: - - Created a new API to show all alarm properties, with a mandatory parameter - vitrage_id of the alarm. The path for the api is ``/v1/alarm/_id_``. diff --git a/releasenotes/notes/support_alarm_show_api-0b001dd185e2e523.yaml b/releasenotes/notes/support_alarm_show_api-0b001dd185e2e523.yaml new file mode 100644 index 000000000..9ef0cdac7 --- /dev/null +++ b/releasenotes/notes/support_alarm_show_api-0b001dd185e2e523.yaml @@ -0,0 +1,5 @@ +--- +features: + - Backend support for alarm show API. + Return the alarm properties for a specific alarm. Alarm is fetched + according to ``vitrage_id`` parameter. Path for the api is ``/v1/alarm/_id_``. diff --git a/vitrage/api_handler/apis/alarm.py b/vitrage/api_handler/apis/alarm.py index 5de7a9cf7..fac4837e6 100755 --- a/vitrage/api_handler/apis/alarm.py +++ b/vitrage/api_handler/apis/alarm.py @@ -65,14 +65,14 @@ class AlarmApis(EntityGraphApisBase): alarm = self.entity_graph.get_vertex(vitrage_id) if not alarm or alarm.get(VProps.VITRAGE_CATEGORY) != ECategory.ALARM: - LOG.warning('Alarm show - not found (%s)', vitrage_id) + LOG.warning('Alarm show - Not found (%s)', vitrage_id) return None is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False) curr_project = ctx.get(self.TENANT_PROPERTY, None) alarm_project = alarm.get(VProps.PROJECT_ID) if not is_admin and curr_project != alarm_project: - LOG.warning('Authorization failed for alarm (%s)', vitrage_id) + LOG.warning('Alarm show - Authorization failed (%s)', vitrage_id) return None return json.dumps(alarm.properties) diff --git a/vitrage/api_handler/apis/resource.py b/vitrage/api_handler/apis/resource.py index a11441f1d..5e95ebffc 100644 --- a/vitrage/api_handler/apis/resource.py +++ b/vitrage/api_handler/apis/resource.py @@ -63,14 +63,15 @@ class ResourceApis(EntityGraphApisBase): resource = self.entity_graph.get_vertex(vitrage_id) if not resource or resource.get(VProps.VITRAGE_CATEGORY) != \ EntityCategory.RESOURCE: - LOG.warning('Resource show - not found (%s)', vitrage_id) + LOG.warning('Resource show - Not found (%s)', vitrage_id) return None is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False) curr_project = ctx.get(self.TENANT_PROPERTY, None) resource_project = resource.get(VProps.PROJECT_ID) if not is_admin and curr_project != resource_project: - LOG.warning('Authorization failed for resource (%s)', vitrage_id) + LOG.warning('Resource show - Authorization failed (%s)', + vitrage_id) return None return json.dumps(resource.properties)