Skip to content

Commit

Permalink
Fixes #16 - Pagination issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiwo Awoyinfa committed Jun 21, 2023
1 parent 137ce81 commit f50c29a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
4 changes: 3 additions & 1 deletion amplify/backend/function/teamListGroups/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def list_idc_group_membership(groupId):
paginator = p.paginate(IdentityStoreId=sso_instance,
GroupId=groupId,
)
all_groups=[]
for page in paginator:
return page["GroupMemberships"]
all_groups.extend(page["GroupMemberships"])
return all_groups
except ClientError as e:
print(e.response['Error']['Message'])

Expand Down
8 changes: 6 additions & 2 deletions amplify/backend/function/teamRouter/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ def list_idc_group_membership(userId):
MemberId={
'UserId': userId
})
all_idc_groups = []
for page in paginator:
return page["GroupMemberships"]
all_idc_groups.extend(page["GroupMemberships"])
return all_idc_groups
except ClientError as e:
print(e.response['Error']['Message'])
return []
Expand Down Expand Up @@ -389,8 +391,10 @@ def list_group_membership(groupId):
paginator = p.paginate(IdentityStoreId=sso_instance['IdentityStoreId'],
GroupId=groupId,
)
all_groups = []
for page in paginator:
return page["GroupMemberships"]
all_groups.extend(page["GroupMemberships"])
return all_groups
except ClientError as e:
print(e.response['Error']['Message'])

Expand Down
4 changes: 3 additions & 1 deletion amplify/backend/function/teamgetGroups/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ def list_idc_group_membership(userId):
MemberId={
'UserId': userId
})
all_groups = []
for page in paginator:
return page["GroupMemberships"]
all_groups.extend(page["GroupMemberships"])
return all_groups
except ClientError as e:
print(e.response['Error']['Message'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def get_mgmt_ps():
paginator = p.paginate(
InstanceArn=sso_instance['InstanceArn'],
AccountId=mgmt_account_id,)
all_permissions = []
for page in paginator:
return page["PermissionSets"]
all_permissions.extend(page["PermissionSets"])
return all_permissions
except ClientError as e:
print(e.response['Error']['Message'])

Expand Down
4 changes: 3 additions & 1 deletion amplify/backend/function/teamgetPermissions/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def get_mgmt_ps():
paginator = p.paginate(
InstanceArn=sso_instance['InstanceArn'],
AccountId=mgmt_account_id,)
all_permissions = []
for page in paginator:
return page["PermissionSets"]
all_permissions.extend(page["PermissionSets"])
return all_permissions
except ClientError as e:
print(e.response['Error']['Message'])
return []
Expand Down
4 changes: 3 additions & 1 deletion amplify/backend/function/teamgetUsers/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def list_idc_users(IdentityStoreId):
client = boto3.client('identitystore')
p = client.get_paginator('list_users')
paginator = p.paginate(IdentityStoreId=IdentityStoreId)
all_users = []
for page in paginator:
return page["Users"]
all_users.extend(page["Users"])
return all_users
except ClientError as e:
print(e.response['Error']['Message'])

Expand Down

0 comments on commit f50c29a

Please sign in to comment.