alarm show release notes and logging
Change-Id: Iaefe15a34f2851e511c231df1f7e77682afeb2da
This commit is contained in:
parent
b5fbd9862b
commit
65af455afd
@ -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_``.
|
|
@ -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_``.
|
@ -65,14 +65,14 @@ class AlarmApis(EntityGraphApisBase):
|
|||||||
|
|
||||||
alarm = self.entity_graph.get_vertex(vitrage_id)
|
alarm = self.entity_graph.get_vertex(vitrage_id)
|
||||||
if not alarm or alarm.get(VProps.VITRAGE_CATEGORY) != ECategory.ALARM:
|
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
|
return None
|
||||||
|
|
||||||
is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False)
|
is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False)
|
||||||
curr_project = ctx.get(self.TENANT_PROPERTY, None)
|
curr_project = ctx.get(self.TENANT_PROPERTY, None)
|
||||||
alarm_project = alarm.get(VProps.PROJECT_ID)
|
alarm_project = alarm.get(VProps.PROJECT_ID)
|
||||||
if not is_admin and curr_project != alarm_project:
|
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 None
|
||||||
|
|
||||||
return json.dumps(alarm.properties)
|
return json.dumps(alarm.properties)
|
||||||
|
@ -63,14 +63,15 @@ class ResourceApis(EntityGraphApisBase):
|
|||||||
resource = self.entity_graph.get_vertex(vitrage_id)
|
resource = self.entity_graph.get_vertex(vitrage_id)
|
||||||
if not resource or resource.get(VProps.VITRAGE_CATEGORY) != \
|
if not resource or resource.get(VProps.VITRAGE_CATEGORY) != \
|
||||||
EntityCategory.RESOURCE:
|
EntityCategory.RESOURCE:
|
||||||
LOG.warning('Resource show - not found (%s)', vitrage_id)
|
LOG.warning('Resource show - Not found (%s)', vitrage_id)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False)
|
is_admin = ctx.get(self.IS_ADMIN_PROJECT_PROPERTY, False)
|
||||||
curr_project = ctx.get(self.TENANT_PROPERTY, None)
|
curr_project = ctx.get(self.TENANT_PROPERTY, None)
|
||||||
resource_project = resource.get(VProps.PROJECT_ID)
|
resource_project = resource.get(VProps.PROJECT_ID)
|
||||||
if not is_admin and curr_project != resource_project:
|
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 None
|
||||||
|
|
||||||
return json.dumps(resource.properties)
|
return json.dumps(resource.properties)
|
||||||
|
Loading…
Reference in New Issue
Block a user