mongodb / go-client-mongodb-atlas

Go Client for MongoDB Atlas
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/
Apache License 2.0
79 stars 33 forks source link

Organizations endpoints #100

Closed p-mongo closed 4 years ago

p-mongo commented 4 years ago

I attempted to implement organization retrieval for mongocli (https://github.com/mongodb/mongocli/issues/208, https://github.com/mongodb/mongocli/issues/207) but it seems mongodbatlas does not have anything to do with organizations. If this is accurate can the respective endpoints be added please?

gssbzn commented 4 years ago

Hi @p-mongo the reason we have kept Organizations out of this client is that some endpoints require you to have personal API keys which you can't get on Atlas anymore. I can bring what we've done for the Ops Manager client but I'll let @themantissa decide on this first

p-mongo commented 4 years ago

I'm afraid I do not understand. There are organization endpoints documented in the api. I implemented a client for these endpoints in Ruby. If there are some endpoints that require specific keys, and there is no way to provide those keys to mongodbatlas presently, I can see how implementing these endpoints may not make sense. But I do not understand why mongodbatlas would not expose operations which are usable using the normal credentials today.

themantissa commented 4 years ago

Thank you @gssbzn for the tag. Hi, @p-mongo currently there is no API method for creating organizations via the API for Atlas (see https://docs.atlas.mongodb.com/reference/api/organizations/) for the aforementioned reason, hence we have not included organizations in this client because it was, until recently, primarily used by infrastructure as code tools that do not well manage API resources that do not have all CRUD capabilities, i.e. organizations have read/update/delete but not create. Currently organizations must be created within the Atlas UI.

However, with this client increasingly being used by other tools we could consider adding organization support for the RUD. In fact we have a PR we did not review and merge for this https://github.com/mongodb/go-client-mongodb-atlas/pull/33. Depending on demand for this we can review potentially adding support for RUD.

Also note the RUD methods for organizations are accessible vi the programmatic API keys.