> -----Original Message-----
> From: prasanna [mailto:srivatsav.prasa...@gmail.com]
> Sent: Friday, March 29, 2013 10:16 PM
> To: dev@cloudstack.apache.org
> Subject: Re: cloudmonkey printing enhancements proposal
> 
> On 30 March 2013 09:20, Justin Grudzien <grudz...@gmail.com> wrote:
> >
> > My company is building a private cloud and we are moving to
> > cloudstack. As we begun investigating the cloudmonkey CLI we found
> > that the output was slightly hard to read. I have begun working on
> > some optimizations that I think will benefit the community and I
> > reached out to Rohit, who recommended that I join this list and
> > present my ideas. Here is what I am
> > proposing:
> >
> > 1. Add json output to cloudmonkey
> > I have accomplished this by adding a config parameter called display,
> > which can be set to json, tabularize, or default. I have removed the
> > tabularize parameter.
> >
> > Justins-MacBook-Pro:cloudmonkey grudzien$ cloudmonkey list users
> > account=grudzien {
> >   "count": 1,
> >   "user": [
> >     {
> >       "account": "grudzien",
> >       "accountid": "b799783d-e5bb-460a-be0e-3966bd69edda",
> >       "accounttype": 1,
> >       "apikey": "*nokey*",
> >       "created": "2013-03-27T16:09:17-0500",
> >       "domain": "ROOT",
> >       "domainid": "7e61c32f-9873-4944-947a-dcc00d3bebdc",
> >       "email": "grudz...@gmail.com",
> >       "firstname": "Justin",
> >       "id": "265930bc-62ef-41f8-849c-e58593ca4b1f",
> >       "lastname": "Grudzien",
> >       "secretkey": "*nokey*",
> >       "state": "enabled",
> >       "username": "grudzien"
> >     }
> >   ]
> > }
> >
> > 2. Add filtering as a standard parameter for all output types.
> > The only thing that has filtering now is the tabular output and grep
> > breaks the json.
> >
> > Justins-MacBook-Pro:cloudmonkey grudzien$ cloudmonkey list users
> > account=grudzien filter=account,email,username,state
> > {
> >   "count": 1,
> >   "user": [
> >     {
> >       "account": "grudzien",
> >       "email": "grudz...@gmail.com",
> >       "state": "enabled",
> >       "username": "grudzien"
> >     }
> >   ]
> > }
> >
> 
> +1 - JSON output would make it very good to consume into other api
> response processing. Right now cloudmonkey actually isn't aware of the
> response object model. For certain API responses that return embedded
> objects (eg: listNetworks [1]) it would be good to return the JSON
> appropriately formatted as well.
> 
> [1] https://gist.github.com/vogxn/5255883

If cloudmonkey cares about json response now, it makes sense that both 
cloudmonkey and marvin share the same code to send api command and parse json 
response. Isn't it?

> 
> 
> > 3. Add color to the json output
> > I was thinking of colorizing the keys in the key/value pairs to
> > increase readability.
> >
> > 4. Move the color option from the config file to the command line.
> > There are two reasons for this. First, I want to be able to wrap a
> > script around cloudmonkey and not have to worry about colorization
> > that will impede me processing the output and second I think it would
> > be more useful to use the highlighting on demand rather than having to
> > back out of the shell to edit a config file.
> >
> > 5. Standardize messaging for the output types.
> > Right now certain kinds of messaging is presented differently for an
> > output type. For example, if I issue an api command that doesn't exist
> > it displays a generic error message, regardless of the output type
> > selected. Ideally, all output would be in the specified format.
> >
> > I have the first two working and am planning on implementing the
> > others as I flesh them out. I will submit a patch when I feel it is
> > ready. Any early feedback on whether these changes will be useful to
> others is appreciated.
> 
> Patches most welcome!
> 
> 
> 
> 
> --
> Prasanna.,

Reply via email to