incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rohit Yadav (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CLOUDSTACK-926) ApiDiscoverService: Implement a plugin mechanism that exposes the list of APIs through a discovery service on the management server
Date Wed, 09 Jan 2013 11:02:12 GMT

     [ https://issues.apache.org/jira/browse/CLOUDSTACK-926?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rohit Yadav resolved CLOUDSTACK-926.
------------------------------------

    Resolution: Fixed

Fixed on master (came through merge of api_refactoring on master):

commit 2c04dad529ff9b67f78d86316a9e1f6e93d503a4
Author: Rohit Yadav <bhaisaab@apache.org>
Date:   Tue Jan 8 18:48:18 2013 -0800

    ApiDiscovery: New plugin to help discover apis on mgmt server
    
    - Introduces api/discovery plugin that helps discover apis on the mgmt server
    - It's a pluggable service, therefore has it's own api-discovery_commands.properties
      where the discovery api, listApi can be blacklisted (by removing it), or it's
      role mask can be changed
    - By default its response has all the apis
    - Changes in other parts of the code to make it work, viz. components.xml, pom.xml,
      and in ApiServer where it is used as an adapter to get apiname, cmd mappings
    
    The ApiDiscoveryService interface is a contract that the implementing class will
    provide:
    
    1. A means to get all the apis as a list of response, plugin is free to implement
       the response class, as long as it extends on the BaseResponse:
    
        ListResponse<? extends BaseResponse> listApis();
    
    2. Provides a map of apiname as the key and cmd class as the value:
    
        Map<String, Class<?>> getApiNameCmdClassMapping();
    
    Signed-off-by: Rohit Yadav <bhaisaab@apache.org>


commit d613c59dcbbca884fd8b31f5a1d58bb3f6d0e67c
Author: Rohit Yadav <bhaisaab@apache.org>
Date:   Tue Jan 8 20:00:13 2013 -0800

    plugins: Fix apidiscovery's annotation field values and example plugin's name
    
    Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
                
> ApiDiscoverService: Implement a plugin mechanism that exposes the list of APIs through
a discovery service on the management server
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-926
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-926
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>    Affects Versions: 4.0.0
>            Reporter: Prasanna Santhanam
>            Assignee: Rohit Yadav
>             Fix For: 4.1.0
>
>
> The  API discovery service will allow and end point to list of its supported APIs and
their details. Consumers can be CLI clients and wrappers that build on top of the available
list of APIs exposed by a Cloudstack instance.
> The response structure is an array of apis with:
> name (name of the api command), description (or docstring), since (version since the
api was introduced, empty suggests it was pre 3.x), isasync (true if api is asynchronous),
array of dictionary of params.
> The structure for list of params is:
> name (name of the parameter), description (or doctoring for the parameter), type (kind
of parameter, bool, long, map, uuid etc.), length (allowed max length for the param, default
is 255), required (if param is
> +necessary for making an api request), since (CloudStack versions no. in which param
was introduced, empty suggests it was introduced when the api was introduced).
> Example response:
> { "listapisresponse" : { "count":301 ,"apis" : [ {"name":"listAsyncJobs","description":"Lists
all pending asynchronous jobs for the
> +account.","since":"","isasync":false,"param":[{"name":"pagesize","description":"","type":"INTEGER","length":255,"required":false,"since":""},{"name":"domainid","description":"list
only resources belonging to
> +the domain specified","type":"UUID","length":255,"required":false,"since":""},{"name":"listall","description":"If
set to false, list only resources belonging to the command's caller; if set to true - list
> +resources that the caller is authorized to see. Default value is false","type":"BOOLEAN","length":255,"required":false,"since":""},{"name":"account","description":"List
resources by account. Must be used with
> +the domainId parameter.","type":"STRING","length":255,"required":false,"since":""},{"name":"startdate","description":"the
start date of the async
> +job","type":"TZDATE","length":255,"required":false,"since":""},{"name":"page","description":"","type":"INTEGER","length":255,"required":false,"since":""},{"name":"isrecursive","description":"defaults
to false,
> +but if true, lists all resources from the parent specified by the domainId till leaves.","type":"BOOLEAN","length":255,"required":false,"since":""},{"name":"keyword","description":"List
by
> +keyword","type":"STRING","length":255,"required":false,"since":""}]}
> This information is pre-cached during load time (when mgmt server starts) as a list of
response by the plugin and it takes about 677 milliseconds to generate mapping of apiname
and cmd class and 89 milliseconds
> +to pre cache the response object:
> INFO  [cloudstack.discovery.ApiDiscoveryServiceImpl] (main:) Generated apiname, cmd class
mapping in 677 ms
> INFO  [cloudstack.discovery.ApiDiscoveryServiceImpl] (main:) Discovered api, precached
response in 89 ms
> The plugin is an adapter, also a pluggable service and provides an api cmd class with
apiname listApis (suggest a better name, listApis made sense as the response is list of Apis
+ docs available on the CS mgmt
> +server to the user).
> Based on parameter annotation, we can also return information of related apis for a particular
apis (based on response class, say all vm related apis have same response class) and also
suggest apis to get the
> +parameter (wherever applicable, we know entityType, so we know the response class).
Do we want such a feature?
> Since, this is a plugin and has its own commands.properties, one can blacklist or change
role based acl (in commands.properties) or disable plugin (from components.xml) to controls
or use this plugin as a
> +starting point to make their own discovery service (not just apis, think discovery of
resources etc.).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message