8000 Update security manager operations to use organization roles REST APIs by just-joshing · Pull Request #3421 · google/go-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update security manager operations to use organization roles REST APIs #3421

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

Closed
wants to merge 7 commits into from
Closed

Conversation

just-joshing
Copy link
Contributor

The organization security manager role REST APIs are being sunset (https://gh.io/security-managers-rest-api-sunset) in favor of the organization roles REST APIs.

Instead of introducing a breaking change by removing the operations from go-github, this PR updates the operations to use the organization roles REST APIs so consumers (such as Terraform) can continue to manage organization security manager teams without needing to change code.

Copy link
codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.

Project coverage is 92.19%. Comparing base (2b8c7fa) to head (faf36ea).
Report is 215 commits behind head on master.

Files with missing lines Patch % Lines
github/orgs_security_managers.go 82.14% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3421      +/-   ##
==========================================
- Coverage   97.72%   92.19%   -5.53%     
==========================================
  Files         153      173      +20     
  Lines       13390    14949    +1559     
==========================================
+ Hits        13085    13782     +697     
- Misses        215     1072     +857     
- Partials       90       95       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator
@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @just-joshing.
I've raised a pagination concern that hopefully you can address.

}
}

return nil, resp, errors.New("security manager role not found")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test that covers this error.

return teams, resp, nil
options := &ListOptions{PerPage: 100}
securityManagerTeams := make([]*Team, 0)
for {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, this will be the first endpoint that handles pagination within the call itself, whereas all other endpoints in this repo expect the caller to handle pagination (which also typically involves checking for rate limit errors).

Honestly, I'm not seeing the need here to introduce pagination in this endpoint.
We have a section in the README.md discussing this issue.
Do you have a strong argument for including pagination here?
If we start doing this, then others will start wanting to add it to their favorite endpoint too, and I'm concerned that this will snowball and one implementation won't solve everyone's needs for pagination.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gmlewis! The reason I did that is because the previous API did not support pagination, so I didn't want to change the contract here. My goal was for these operations to continue to work the same way they did previously so consumers of the library would not face any interruptions from these when updating to newer versions of the library.

But based on other feedback here as well, it sounds like it might be more desirable to keep the library closer to a 1:1 with the GitHub APIs, so I will mark them as deprecated instead.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jan 7, 2025
@stevehipwell
Copy link
Contributor

@just-joshing why not mark these methods as deprecated (as has been done for other deprecated endpoint methods)? The org role methods are already available in this package and I don't see a benefit to adding this extra complexity?

@just-joshing
Copy link
Contributor Author

@just-joshing why not mark these methods as deprecated (as has been done for other deprecated endpoint methods)? The org role methods are already available in this package and I don't see a benefit to adding this extra complexity?

Hi @stevehipwell! The reason I took this route was because I believed it would be beneficial to consumers of the library since they could update to newer versions without needing to update any code using the security manager teams operations. These operations can continue to be supported by the library. It's just the internals that change.

But if the library is supposed to be closer to a 1:1 representation of the GitHub APIs, then I can understand wanting to deprecate instead.

I'll close this PR.

@just-joshing
Copy link
Contributor Author
just-joshing commented Jan 7, 2025

@stevehipwell, @gmlewis, here's the replacement PR that adds deprecation messages instead. Thank you for reviewing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsReview PR is awaiting a review before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0