Hi, Thanks for the suggestions :D I'll try to take out the REST part and implement it in a generic way. I saw a recent discussion on re-factoring the REST API to further standardize the status codes and Exception types, etc. Hope it would help me to get through.
Thanks. On Mon, May 4, 2015 at 8:34 PM, Udara Liyanage <ud...@wso2.com> wrote: > HI Milindu, > > Few suggestions.... > > > Isn't it better to take out REST client from Stratos.py. Rest client seems > a common module which other components may need. May be Cartridge agent and > CLI uses the same module. > > Handle responses in a generic way at one place(This is what we learn from > existing CLI). From version to version return codes, response format may > change in Stratos REST API. In that case you only need to change at one > place if you have handled in a generic manner. > > On Mon, May 4, 2015 at 2:16 PM, Milindu Sanoj Kumarage < > agentmili...@gmail.com> wrote: > >> >> Hi, >> >> I thought of separating the Python CLI into 3 main parts, those are, >> >> 1. Main.py - that contains the entry point, it does the initializing >> parts, creates a CLI instance and runs the loop, >> 2. CLI.py - this is the actual CLI that extends Cmd2. This contains the >> command to def mappings, argument and flag handling, printing outputs, etc. >> 3. Stratos.py - this contains the actual business logic, that is, which >> REST end point to call, and do what with the response, what to show, what >> not, etc. At the end, this would be like a Python API for Stratos. >> >> This way, in the future, we can even replace Cmd2 CLI framework without >> any issue, if we have to. >> >> Your ideas? :) >> > > > > -- > > Udara Liyanage > Software Engineer > WSO2, Inc.: http://wso2.com > lean. enterprise. middleware > > web: http://udaraliyanage.wordpress.com > phone: +94 71 443 6897 >