New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add OrganizationsListOptions for filtering organization list results #144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sunny-b, thanks for your contribution, I'm happy to break the client to fix this, just one small comment in case you want to improve OM support as well.
I'll let @themantissa have final say on this breaking change
mongodbatlas/organizations.go
Outdated
@@ -40,6 +40,12 @@ type OrganizationsServiceOp service | |||
|
|||
var _ OrganizationsService = &OrganizationsServiceOp{} | |||
|
|||
// OrganizationsListOptions filtering options for organizations | |||
type OrganizationsListOptions struct { | |||
Name string `url:"name,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you mention Ops Manager, Ops manager also has a boolean, includeDeletedOrgs
, I've been wanting to fix this Listing option to add that one in particular but since we are breaking this I wouldn't mind taking the extra step here.
If you decide to add it be aware that it defaults to true so omitempty
may get tricky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using a bool pointer can help get around the omitempty
business. According to the docs, if the includeDeletedOrgs
param is missing in the url, then it'll still default to true
.
I added in that change and made a test to show that setListOptions
will properly omit an empty bool pointer. Please let me know if you need anything else for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this, yes, making it a pointer should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as I don't think this impacts us particularly. However added the DoU devs for a quick review to check just in case. FYI @coderGo93 and @leofigy Thanks all!
Anyway of getting the appropriate reviews for this? I would love for this feature to get merged in. We're planning on using this Go client at work and this is a much needed feature for us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏽
@sunny-b feel free to add update https://github.com/mongodb/go-client-mongodb-ops-manager with this change as well, we may be doing this anyway in the coming days |
@gssbzn Yeah that's a good idea. Though you'd need to put out a new release of this package in order to update Ops Manager as it uses the various |
@sunny-b on the ops-manager-client we usually update to master ( |
Description
Addresses #143
The Ops Manager and Atlas API supports filtering Organization list results by the name, however this Go client does not support that at the moment. This PR would add that functionality and adds a test to help ensure it works.
I recognize this is a breaking change to the interface so I'm open to discussion on a better way to do it. Though I saw this pattern in
ContainersListOptions
which is where I adopted it from.go-client-mongodb-atlas/mongodbatlas/containers.go
Lines 30 to 33 in d1f10b2
Link to any related issue(s):
Type of change:
Required Checklist:
make fmt
and formatted my codeFurther comments