On Wed, Jul 27, 2016 at 8:25 PM Rick Harding <[email protected]> wrote:
> That being said, any API client that requires three API calls to login >> should be beat over the head with a fail stick, but there are many cases >> where performing some workflow might require multiple api calls. The API >> clients should work out a single function of "doSomethingAwesome(param1, >> pararm1)" when it's in fact performing multiple API steps because it makes >> sense for end users, or I guess developers in this case. >> > > Just to flesh this out with an obvious example that came to mind. There > are three "addCharm"-ish API calls. > > addCharm [1] > addCharmWithAuthorization [2] > addLocalCharm [3] > > Writing an API client in Python or other languages I'd want to provide a > single addCharm method that just made the right API call to Juju based on > the arguments provided. If you provided a macaroon from a current logged > in session, I'd make a addCharmWithAuthorization. If you passed a local > './xxxx' path as the charm url then I'd call out with addLocalCharm. > There's no need to push the complexity of those three different calls to > the end user of the API client. > And in python-libjuju we absolutely will hide that implementation detail when it makes sense. For example, some non-existant psuedo code: ``` from libjuju import Model m = Model.connect() m.deploy(charm, name=None, config=None, macaroon=None ...) ``` Where charm is a store url or local url. Marco
-- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
