Skip to content

Commit

Permalink
Merge pull request #313 from sabre1041/azure-pagesize
Browse files Browse the repository at this point in the history
Added pagesize to all Azure invocations
  • Loading branch information
raffaelespazzoli authored May 2, 2024
2 parents ba3ad9a + 39ba712 commit 99878a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/syncer/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import (
)

var (
azureLogger = logf.Log.WithName("syncer_azure")
caser = cases.Title(language.Und, cases.NoLower)
azureLogger = logf.Log.WithName("syncer_azure")
caser = cases.Title(language.Und, cases.NoLower)
azurePageSize = int32(999)
)

const (
Expand Down Expand Up @@ -215,6 +216,7 @@ func (a *AzureSyncer) Sync() ([]userv1.Group, error) {
filter := fmt.Sprintf("displayName eq '%s'", baseGroup)
groupRequestParameters := &msgroups.GroupsRequestBuilderGetQueryParameters{
Filter: &filter,
Top: &azurePageSize,
}

groupRequestConfiguration := &msgroups.GroupsRequestBuilderGetRequestConfiguration{
Expand Down Expand Up @@ -249,6 +251,7 @@ func (a *AzureSyncer) Sync() ([]userv1.Group, error) {
if a.Provider.Filter != "" {
requestParameters := &msgroups.ItemMembersRequestBuilderGetQueryParameters{
Filter: &a.Provider.Filter,
Top: &azurePageSize,
}
baseGroupMembersRequestConfiguration = &msgroups.ItemMembersRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
Expand Down Expand Up @@ -291,6 +294,7 @@ func (a *AzureSyncer) Sync() ([]userv1.Group, error) {
if a.Provider.Filter != "" {
groupRequestParameters := &msgroups.GroupsRequestBuilderGetQueryParameters{
Filter: &a.Provider.Filter,
Top: &azurePageSize,
}
groupConfiguration.QueryParameters = groupRequestParameters

Expand Down Expand Up @@ -384,10 +388,9 @@ func (a *AzureSyncer) listGroupMembers(groupID *string) ([]string, error) {
selectParameter = []string{GraphUserNameAttribute}
}

pageSize := int32(999)
queryParameters := msgroups.ItemTransitiveMembersRequestBuilderGetQueryParameters{
Select: selectParameter,
Top: &pageSize,
Top: &azurePageSize,
}

transitiveMembersGetConfiguration := msgroups.ItemTransitiveMembersRequestBuilderGetRequestConfiguration{
Expand Down

0 comments on commit 99878a6

Please sign in to comment.