-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat!: Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMGroups #3814
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3814 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 194 195 +1
Lines 13990 13990
=======================================
Hits 12917 12917
Misses 884 884
Partials 189 189 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
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, @elminster-aom!
Did we agree in another PR not to have methods end with the suffix ...ForEnterprise?
github/enterprise_scim.go
Outdated
| // SCIMEnterpriseDisplayReference represents a JSON SCIM (System for Cross-domain Identity Management) resource. | ||
| type SCIMEnterpriseDisplayReference struct { | ||
| Value string `json:"value"` // The local unique identifier for the member | ||
| Ref string `json:"$ref"` //nolint:jsonfieldname // The $ref is a standard SCIM field |
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.
Sorry about this. I should update jsonfieldname linter to ignore the dollar sign. I'll work on that.
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 understand that in the meantime, I must keep the //nolint:jsonfieldname.
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.
Oh, I forgot... this is one of those cases that can be handled by adding a line like this one to the exceptions list:
Line 205 in 025030e
| - SCIMDisplayReference.Ref |
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, this is a better solution (commit 862685b)
github/enterprise_scim.go
Outdated
| // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise | ||
| // | ||
| //meta:operation GET /scim/v2/enterprises/{enterprise}/Groups | ||
| func (s *EnterpriseService) ListProvisionedSCIMGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsForEnterpriseOptions) (*SCIMEnterpriseGroups, *Response, error) { |
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 we can simplify:
| func (s *EnterpriseService) ListProvisionedSCIMGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsForEnterpriseOptions) (*SCIMEnterpriseGroups, *Response, error) { | |
| func (s *EnterpriseService) ListProvisionedSCIMGroups(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsOptions) (*SCIMEnterpriseGroups, *Response, error) { |
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.
As mentioned in #issuecomment-3527067929, I find it can be confusing when compared to the organization-SCIM resources, such as:
- The
GET /scim/v2/organizations/{org}/Usersendpoint is implemented asListSCIMProvisionedIdentities()
Following your suggestion, the method for GET /scim/v2/enterprises/{enterprise}/Users endpoint must be ListProvisionedSCIMUsers() but I find easier to understand ListProvisionedSCIMEnterpriseUsers().
Based on that, I would like to suggest ListProvisionedSCIMEnterpriseGroups() & ListProvisionedSCIMEnterpriseGroupsOptions here, but I am happy to follow your advice.
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.
Sorry, I was this slow. Thanks @gmlewis
the service must first be specified, like
enterpriseService.MethodToCall
So I'd like to change my previous suggestion. What about ListProvisionedSCIMGroups() & ListProvisionedSCIMGroupsEnterpriseOptions?
@gmlewis, I couldn't find the PR you mention but I think the word "Enterprise" should appear somehow (Maybe with just an "E"? Suggestions are welcome) otherwise it may get confusing with the other SCIM resources in /github/scim.go. |
The idea is that for all our methods, the service must first be specified, like |
gmlewis
left a comment
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.
Thank you, @elminster-aom!
LGTM
Awaiting second LGTM+Approval before merging.
cc: @alexandear
| type ListProvisionedSCIMGroupsEnterpriseOptions struct { | ||
| // If specified, only results that match the specified filter will be returned. Multiple filters are not supported. | ||
| // Possible filters are `externalId`, id, and `displayName`. For example,`?filter=externalId eq "9138790-10932-109120392-12321"`. | ||
| Filter *string `url:"filter,omitempty"` | ||
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | ||
| ExcludedAttributes *string `url:"excludedAttributes,omitempty"` | ||
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | ||
| // Default: 1. | ||
| StartIndex *int `url:"startIndex,omitempty"` | ||
| // Used for pagination: the number of results to return per page. | ||
| // Default: 30. | ||
| Count *int `url:"count,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.
Did I make a mistake here using pointers?
| type ListProvisionedSCIMGroupsEnterpriseOptions struct { | |
| // If specified, only results that match the specified filter will be returned. Multiple filters are not supported. | |
| // Possible filters are `externalId`, id, and `displayName`. For example,`?filter=externalId eq "9138790-10932-109120392-12321"`. | |
| Filter *string `url:"filter,omitempty"` | |
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | |
| ExcludedAttributes *string `url:"excludedAttributes,omitempty"` | |
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | |
| // Default: 1. | |
| StartIndex *int `url:"startIndex,omitempty"` | |
| // Used for pagination: the number of results to return per page. | |
| // Default: 30. | |
| Count *int `url:"count,omitempty"` | |
| } | |
| type ListProvisionedSCIMGroupsEnterpriseOptions struct { | |
| // If specified, only results that match the specified filter will be returned. Multiple filters are not supported. | |
| // Possible filters are `externalId`, id, and `displayName`. For example,`?filter=externalId eq "9138790-10932-109120392-12321"`. | |
| Filter string `url:"filter,omitempty"` | |
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | |
| ExcludedAttributes string `url:"excludedAttributes,omitempty"` | |
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | |
| // Default: 1. | |
| StartIndex int `url:"startIndex,omitempty"` | |
| // Used for pagination: the number of results to return per page. | |
| // Default: 30. | |
| Count int `url:"count,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.
Yes.
Lines 262 to 288 in 4ed75ac
| type ListCursorOptions struct { | |
| // For paginated result sets, page of results to retrieve. | |
| Page string `url:"page,omitempty"` | |
| // For paginated result sets, the number of results to include per page. | |
| PerPage int `url:"per_page,omitempty"` | |
| // For paginated result sets, the number of results per page (max 100), starting from the first matching result. | |
| // This parameter must not be used in combination with last. | |
| First int `url:"first,omitempty"` | |
| // For paginated result sets, the number of results per page (max 100), starting from the last matching result. | |
| // This parameter must not be used in combination with first. | |
| Last int `url:"last,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. | |
| After string `url:"after,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. | |
| Before string `url:"before,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query continues the search using this cursor. | |
| Cursor string `url:"cursor,omitempty"` | |
| } | |
| // UploadOptions specifies the parameters to methods that support uploads. | |
| type UploadOptions struct { |
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.
Thank you and done (commit e8fffba)
| type ListProvisionedSCIMGroupsEnterpriseOptions struct { | ||
| // If specified, only results that match the specified filter will be returned. Multiple filters are not supported. | ||
| // Possible filters are `externalId`, id, and `displayName`. For example,`?filter=externalId eq "9138790-10932-109120392-12321"`. | ||
| Filter *string `url:"filter,omitempty"` | ||
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | ||
| ExcludedAttributes *string `url:"excludedAttributes,omitempty"` | ||
| // Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time. | ||
| // Default: 1. | ||
| StartIndex *int `url:"startIndex,omitempty"` | ||
| // Used for pagination: the number of results to return per page. | ||
| // Default: 30. | ||
| Count *int `url:"count,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.
Yes.
Lines 262 to 288 in 4ed75ac
| type ListCursorOptions struct { | |
| // For paginated result sets, page of results to retrieve. | |
| Page string `url:"page,omitempty"` | |
| // For paginated result sets, the number of results to include per page. | |
| PerPage int `url:"per_page,omitempty"` | |
| // For paginated result sets, the number of results per page (max 100), starting from the first matching result. | |
| // This parameter must not be used in combination with last. | |
| First int `url:"first,omitempty"` | |
| // For paginated result sets, the number of results per page (max 100), starting from the last matching result. | |
| // This parameter must not be used in combination with first. | |
| Last int `url:"last,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. | |
| After string `url:"after,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. | |
| Before string `url:"before,omitempty"` | |
| // A cursor, as given in the Link header. If specified, the query continues the search using this cursor. | |
| Cursor string `url:"cursor,omitempty"` | |
| } | |
| // UploadOptions specifies the parameters to methods that support uploads. | |
| type UploadOptions struct { |
Fixes: #3813
Summary
From API Docs https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim, implement:
/scim/v2/enterprises/{enterprise}/GroupsBreaking Change
The
SCIMService.ListSCIMProvisionedGroupsForEnterprisemethod has been moved toEnterpriseService.ListProvisionedSCIMEnterpriseGroups.