3 ms·
> err = v.Retrieve(ctx, []string{"Datastore"}, []string{"summary"}, &dss) I am no Go expert but is that sort of thing ([]string part) used commonly in Go? Soun
by blinkingled 9y ago
> err = v.Retrieve(ctx, []string{"Datastore"}, []string{"summary"}, &dss)
I am no Go expert but is that sort of thing ([]string part) used commonly in Go? Sounds like the API would be better if it wasn't so "string oriented" for a lack of better term? This sounds like you are parsing random text which is fine at a lower level where it could be better abstracted out?
- zaphar 9y agoThe whole library is pretty low level actually. If you plan on using it I recommend wrapping it with a better API.
- hangonhn 9y agoNot sure how familiar you are with the vSphere API but the whole thing is done over HTTP, which would explain why it's so string heavy. The SDKs VMware releases for various languages just papers over this.
- blinkingled 9y agoI guess the least the API could do is provide some suitably named constants that represent the various elements such that the call becomes something like - err = v.Retrieve(ctx, VSphere.DATASTORE, VSphere.SUMMARY, &dss) The constants can just be enums that map to the actual valid string representations. That way API user knows the full extent of the parameters and doesn't have to rely on arbitrary strings.