Bug 1039107

Summary: RFE: Support GET /alert/definitions by resourceId
Product: [Other] RHQ Project Reporter: Libor Zoubek <lzoubek>
Component: RESTAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.9CC: theute
Target Milestone: ---   
Target Release: RHQ 4.10   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-23 12:31:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Libor Zoubek 2013-12-06 16:32:18 UTC
Description of problem:

curently rest api can return all alert definitions defined, but not for particular resource. Client has to iterate over all definitions in order to get definitions for 1 resource

Version-Release number of selected component (if applicable):
RHQ 4.10 - master

How reproducible: always

We could add either /resource/<id>/alertDefinitions resource or add optional queryParam resourceId to /alert/definitions

Comment 1 Heiko W. Rupp 2013-12-07 22:23:45 UTC
master  bcd4952


server/jar hrupp$ curl -i -u rhqadmin:rhqadmin http://localhost:7080/rest/resource/10001.json
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
Cache-Control: max-age=120, private
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 07 Dec 2013 22:20:15 GMT

{"resourceName":"snert","resourceId":10001,"typeName":"Mac OS X","typeId":10013,"pluginName":"Platforms","parentId":0,"status":"COMMITTED","availability":"DOWN","links":[{"operationDefinitions":{"href":"http://localhost:7080/rest/operation/definitions?resourceId=10001"}},{"self":{"href":"http://localhost:7080/rest/resource/10001"}},{"schedules":{"href":"http://localhost:7080/rest/resource/10001/schedules"}},{"availability":{"href":"http://localhost:7080/rest/resource/10001/availability"}},{"children":{"href":"http://localhost:7080/rest/resource/10001/children"}},{"alerts":{"href":"http://localhost:7080/rest/resource/10001/alerts"}},{"alertDefinitions":{"href":"http://localhost:7080/rest/alert/definitions?resourceId=10001"}},{"coregui":{"href":"http://localhost:7080/coregui/#Resource/10001"}}],"ancestry":null,"location":null,"description":"Mac OS X Operating System"}snert:/im/rhq/modules/enterprise/server/jar hrupp$ curl -i -u rhqadmin:rhqadmin http://localhost:7080/rest/alert/definitions?resourceId=10001
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 01:00:00 CET
Link: <http://localhost:7080/rest/alert/definitions?resourceId=10001&page=-1>; rel="last"
Link: <http://localhost:7080/rest/alert/definitions?resourceId=10001>; rel="current"
X-collection-size: 1
Content-Type: */*
Content-Length: 469
Date: Sat, 07 Dec 2013 22:20:37 GMT

- !!org.rhq.enterprise.server.rest.domain.AlertDefinitionRest
  conditionMode: ANY
  conditions: []
  dampeningCategory: ONCE
  dampeningCount: 0
  dampeningPeriod: 0
  dampeningUnit: null
  enabled: false
  id: 10091
  links:
  - {href: 'http://localhost:7080/coregui/#Resource/10001/Alerts/Definitions/10091',
    rel: coregui}
  - {href: 'http://localhost:7080/rest/resource/10001', rel: resource}
  name: test
  notifications: []
  priority: MEDIUM
  recoveryId: 0

Comment 2 Heiko W. Rupp 2014-04-23 12:31:44 UTC
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.