Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion github/scim.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,26 @@ type ListSCIMProvisionedIdentitiesOptions struct {
Filter *string `url:"filter,omitempty"`
}

// ListSCIMProvisionedGroupsForEnterpriseOptions represents options for ListSCIMProvisionedGroupsForEnterprise.
//
// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise--parameters
type ListSCIMProvisionedGroupsForEnterpriseOptions struct {
// Filter specifies the matching results to return.
// Multiple filters are not supported. Possible filters are externalId, id, and displayName.
// For example: ?filter=externalId eq "9138790-10932-109120392-12321".
// (Optional.)
Filter *string `url:"filter,omitempty"`
// ExcludedAttributes excludes the specified attribute from being returned in the results.
// Using this parameter can speed up response time. (Optional.)
ExcludedAttributes *string `url:"excludedAttributes,omitempty"`
// StartIndex used for pagination: the starting index of the first result to return when paginating through values. (Optional.)
// Default: 1.
StartIndex *int `url:"startIndex,omitempty"`
// Count used for pagination: the number of results to return per page. (Optional.)
// Default: 30.
Count *int `url:"count,omitempty"`
}

// ListSCIMProvisionedIdentities lists SCIM provisioned identities.
//
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities
Expand Down Expand Up @@ -252,8 +272,12 @@ func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID
// 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 *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, _ *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) {
func (s *SCIMService) ListSCIMProvisionedGroupsForEnterprise(ctx context.Context, enterprise string, opts *ListSCIMProvisionedGroupsForEnterpriseOptions) (*SCIMProvisionedGroups, *Response, error) {
u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise)
u, err := addOptions(u, opts)
if err != nil {
return nil, nil, err
}

req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand Down
13 changes: 12 additions & 1 deletion github/scim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ func TestSCIMService_ListSCIMProvisionedGroups(t *testing.T) {

mux.HandleFunc("/scim/v2/enterprises/o/Groups", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{
"startIndex": "1",
"excludedAttributes": "members,meta",
"count": "3",
"filter": `externalId eq "00u1dhhb1fkIGP7RL1d8"`,
})
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(`{
"schemas": [
Expand Down Expand Up @@ -162,7 +168,12 @@ func TestSCIMService_ListSCIMProvisionedGroups(t *testing.T) {
})

ctx := context.Background()
opts := &ListSCIMProvisionedIdentitiesOptions{}
opts := &ListSCIMProvisionedGroupsForEnterpriseOptions{
StartIndex: Ptr(1),
ExcludedAttributes: Ptr("members,meta"),
Count: Ptr(3),
Filter: Ptr(`externalId eq "00u1dhhb1fkIGP7RL1d8"`),
}
groups, _, err := client.SCIM.ListSCIMProvisionedGroupsForEnterprise(ctx, "o", opts)
if err != nil {
t.Errorf("SCIM.ListSCIMProvisionedIdentities returned error: %v", err)
Expand Down
Loading