generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,68 @@ | ||
"""Testing AWS service (will be removed)""" | ||
import os | ||
from integrations.aws import identity_store | ||
|
||
from integrations.aws import identity_store, client as aws_client | ||
# from modules.aws import sync_groups | ||
|
||
# from integrations.aws import identity_store | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
|
||
def aws_dev_command(client, body, respond): | ||
groups = identity_store.list_groups() | ||
if not groups: | ||
respond("There was an error retrieving the groups.") | ||
# user = identity_store.create_user("test.user@test_email.com", "Test", "User") | ||
# if not user: | ||
# respond("There was an error creating the user.") | ||
# return | ||
# respond(f"Created user with user_id: {user}") | ||
user_id = identity_store.get_user_id("test.user@test_email.com") | ||
if not user_id: | ||
respond("No user found.") | ||
return | ||
respond(f"Found {len(groups)} groups.") | ||
for k, v in groups[0].items(): | ||
print(f"{k}: {v}") | ||
respond(f"Found user_id: {user_id}") | ||
# result = identity_store.delete_user(user_id) | ||
# if not result: | ||
# respond("There was an error deleting the user.") | ||
# return | ||
# if result: | ||
# respond("User deleted.") | ||
# groups = identity_store.list_groups_with_membership() | ||
# if not groups: | ||
# respond("There was an error retrieving the groups.") | ||
# return | ||
# respond(f"Found {len(groups)} groups.") | ||
# for k, v in groups[0].items(): | ||
# print(f"{k}: {v}") | ||
# users = identity_store.list_users() | ||
# if not users: | ||
# respond("There was an error retrieving the users.") | ||
# return | ||
# respond(f"Found {len(users)} users.") | ||
|
||
users = identity_store.list_users() | ||
if not users: | ||
respond("There was an error retrieving the users.") | ||
return | ||
respond(f"Found {len(users)} users.") | ||
# user = identity_store.get_user_id("[email protected]") | ||
# if not user: | ||
# respond("There was an error retrieving the user.") | ||
# return | ||
# respond(f"Found user: {user}") | ||
|
||
# groups = identity_store.list_groups() | ||
# if not groups: | ||
# respond("There was an error retrieving the groups.") | ||
# return | ||
# respond(f"Found {len(groups)} groups.") | ||
|
||
# matching_groups = sync_groups.get_aws_google_groups() | ||
# if not matching_groups: | ||
# respond("There was an error retrieving the groups.") | ||
# return | ||
# print(f"Found {len(matching_groups[0])} AWS matching groups.") | ||
# print(f"Found {len(matching_groups[1])} Google matching groups.") | ||
# for group in matching_groups[0]: | ||
# print(group) | ||
# # join each group in a multiline string | ||
# aws_groups = "\n".join(str(group) for group in matching_groups[0]) | ||
# respond(f"aws_groups:\n{aws_groups}") | ||
# for group in matching_groups[1]: | ||
# print(group) | ||
# for i in range(5): | ||
# respond(f"google_group: {matching_groups[1][i]}") |