Sorry for my tardiness. Work, life, then more work.
On Wed, Apr 23, 2014 at 11:10 AM, Jon Perritt <
jrpe...@gmail.com> wrote:
> 1. I've broken out tokens, service catalogs, and endpoints into their own
> packages. This makes the Identity API more consistent with Compute and
> Object Storage.
> Usage would now look like the following:
>
> ao, err := utils.AuthOptions()
> gr, err := token.Get(ao)
> token, err = token.Extract(gr)
> sc, err := serviceCatalog.Extract(gr)
> sce, err = serviceCatalog.Entries(sc)
This is a lot of steps, and I'm afraid that someone new to Gophercloud
won't be able to divine the correct sequence very easily from reading
a godoc. Would it be possible to add this to the utils package to
help automate the process for the common case? Also, might be worth
putting code examples in the doc.go file of the Identity package.
> 2. I've used common verbs to refer to HTTP requests. When getting data out
> of a data structure (such as a map[string]interface{}) I've used the verb
> 'Extract'.
> I think this is more intuitive to understand what's happening; Namely, you
> make a request to get a token with token.Get and you then extract the token
> object with token.Extract.
I like this, but not for the same reason. One of the things that
always irked me was the discrepency between those who prefer GetFoo()
and just plain Foo(). Idiomatically, Go prefers Foo(), without any
special verb prefix. However, it's sometimes more convenient to use a
verb to distinguish a getter from a simple member field. I like the
use of Extract, because it's more explicit, while at the same time not
lying to the user about possible idempotency.
> Thoughts?
Overall, I like it; I'm just worried about possible explosion of steps
needed to just get something done. Authentication, arguably, should
be the simplest possible thing to get done.
Also, can this be easily wrapped up to support auto-reauth going forward?
--
Samuel A. Falvo II