Skip to content

Conversation

@elminster-aom
Copy link
Contributor

@elminster-aom elminster-aom commented Nov 7, 2025

Fixes: #3813

Summary

From API Docs https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim, implement:

  • GET /scim/v2/enterprises/{enterprise}/Groups

Breaking Change

The SCIMService.ListSCIMProvisionedGroupsForEnterprise method has been moved to EnterpriseService.ListProvisionedSCIMEnterpriseGroups.

@elminster-aom elminster-aom changed the title Implement Enterprise SCIM Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMGroupsForEnterprise Nov 10, 2025
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.33%. Comparing base (025030e) to head (4ed75ac).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elminster-aom elminster-aom marked this pull request as ready for review November 12, 2025 16:58
@elminster-aom elminster-aom mentioned this pull request Nov 12, 2025
12 tasks
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Nov 12, 2025
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.

Thanks, @elminster-aom!
Did we agree in another PR not to have methods end with the suffix ...ForEnterprise?

// 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
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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:

- SCIMDisplayReference.Ref

Copy link
Contributor Author

@elminster-aom elminster-aom Nov 13, 2025

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 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) {
Copy link
Contributor

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:

Suggested change
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) {

Copy link
Contributor Author

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}/Users endpoint is implemented as ListSCIMProvisionedIdentities()

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.

Copy link
Contributor Author

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?

@elminster-aom
Copy link
Contributor Author

Did we agree in another PR not to have methods end with the suffix ...ForEnterprise?

@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.

@elminster-aom elminster-aom changed the title Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMGroupsForEnterprise Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMEnterpriseGroups Nov 13, 2025
@gmlewis
Copy link
Collaborator

gmlewis commented Nov 13, 2025

Did we agree in another PR not to have methods end with the suffix ...ForEnterprise?

@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 enterpriseService.MethodToCall so we shouldn't need to repeat the ForEnterprise part.

@gmlewis gmlewis changed the title Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMEnterpriseGroups feat!: Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMEnterpriseGroups Nov 13, 2025
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, @elminster-aom!
LGTM
Awaiting second LGTM+Approval before merging.

cc: @alexandear

@elminster-aom elminster-aom changed the title feat!: Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMEnterpriseGroups feat!: Implement Enterprise SCIM - EnterpriseService.ListProvisionedSCIMGroups Nov 13, 2025
Comment on lines 60 to 72
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"`
}
Copy link
Contributor Author

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?

Suggested change
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"`
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

go-github/github/github.go

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 {

Copy link
Contributor Author

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)

Comment on lines 60 to 72
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"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

go-github/github/github.go

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 {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Enterprise SCIM

5 participants