JBoss Community Archive (Read Only)

RHQ 4.9

Design-REST

This page is a placeholder for the design of a REST API.

See also the JSON page which should be integrated here and then perhaps be removed.

Requirements

  • Provide data as XML / JSON

  • export metrics of a resource or group as data points

  • get resource tree

    • full

    • level by level

  • get groups

  • authorization follows the existing role model

  • adding / editing of alert templates

  • acknowledge / view / delete of alerts

  • testability

    • initial prototypes accompanied by integration tests

    • involvement from qa

  • get availability for a resource/group

  • get metric chart for a resource/group

    • You really mean, the complete .png for that?

  • how to locate a resource/group?

    • id?

    • ../../parentResourceKey/resourcekey?

  • Search / List resource from discovery queue, add resource or remove from inventory

  • Reading, Updating configurations

  • Read monitored statistics data

  • Execute, Schedule operations

  • Resource / application deployment (i.e., EARs, WARs)

    • Provider higher-level APIs than what we expose in the CLI today.

  • methods will return appropriate HTTP codes to indicate success, failure and so on. See e.g. http://restpatterns.org/HTTP_Status_Codes

Code

I've implemented a very first very basic rest provider, which is now in the master branch on git. This is meant as a start to bootstrap the REST api effort.

Notes

  • Security integration is now done: The web layer authenticates all requests against the RHQ_Principal table and forwards authenticated JEE Principals to the EJB layer. Here an interceptor takes the principal, constructs an RHQ Subject from it and
    creates a session. The Subject is stored in a variable caller and the call is forwarded to the target EJB. After returning,
    the session is invalidated.
    Implementing classes need to extend AbstractRestBean and add the SetCallerInterceptor:

    @Interceptors(SetCallerInterceptor.class)
    @Stateless
    public class ResourceHandlerBean extends AbstractRestBean implements ResourceHandlerLocal {

State / Documentation

Please check the automatically generated documentation for available URIs and HTTP verbs. You can find the documentation either at

Entry point

The entry point for the API is http://localhost:7080/rest/

Examples for concrete URIs

This is work in progress and likely not the final state. When in doubt consult the code

All of the following is relative to http://localhost:7080/rest/1/:

uri

verbs

description

implemented

resource/{id}

GET

Get details of the resource with id id

images/author/images/icons/emoticons/check0.gif

resource/platforms

GET

List the platforms

images/author/images/icons/emoticons/check0.gif

resource/{id}/children

GET

Get the direct children of the resource with id id

images/author/images/icons/emoticons/check0.gif

resource/{id}/availability

GET

Get the current availability of the resource with id id

images/author/images/icons/emoticons/check0.gif

resource/{id}/schedules

GET

Get the metric schedules of the resource with id id

images/author/images/icons/emoticons/check0.gif

 

 

 

 

user/favorites/resource

GET

List the favorite resources of the current user

images/author/images/icons/emoticons/check0.gif

user/favorites/resource/{id}

PUT

Add the resource with id id to the list the favorite resources of the current user

images/author/images/icons/emoticons/check0.gif

user/favorites/resource/{id}

DELETE

Remove the resource with id id from the list the favorite resources of the current user

images/author/images/icons/emoticons/check0.gif

 

 

 

 

metric/data/{u}

GET

Get the metric data for schedule u

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

metric/schedule/{id}

GET

Get the metric schedule with id id

images/author/images/icons/emoticons/check0.gif

metric/schedule/{id}

PUT

Update the metric schedule with id id (enabled,interval)

images/author/images/icons/emoticons/check0.gif

metric/data/resource/{rId}

GET

Get the metric aggregate for resource rId

images/author/images/icons/emoticons/check0.gif

 

 

 

 

status

GET

Return generic server status (like the summary portlet)

 

 

 

 

alert/

GET

List alerts

alert/{id}

GET

Display alert with id id

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

alert/{id}

PUT

Acknowledge alert with id id

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

alert/{id}

DELETE

Purge alert with id id

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

alert/definition

GET

Display alert definitions

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

alert/definition/{id}

GET

Display alert definition with id id

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

alert/definition/{id}

PUT

Update alert definition with id id

 

 

 

 

group/

GET

List groups

images/author/images/icons/emoticons/check0.gif

group/

POST

Create a new group

images/author/images/icons/emoticons/star_yellow0.gif

group/{id}

GET

Get the specific group

images/author/images/icons/emoticons/check0.gif

group/{id}

PUT

Update group (name only at the moment

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

group/{id}

DELETE

Delete the group

images/author/images/icons/emoticons/check.gif images/author/images/icons/emoticons/star_yellow0.gif

group/{id}/resources

GET

Get the resources of this group

images/author/images/icons/emoticons/check0.gif

group/{id}/resource/{rid}

PUT

Add resource rid to group id

images/author/images/icons/emoticons/check0.gif

group/{id}/resource/{rid}

DELETE

Remove resource rid from group id

images/author/images/icons/emoticons/check0.gif

Items with images/author/images/icons/emoticons/star_yellow.gif will need a better data model and/ or evaluation of query parameters or more work

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 08:03:26 UTC, last content change 2013-09-18 19:41:19 UTC.