Skip to content

Commit

Permalink
feat: Add AWS Dev module for testing AWS integrations service (will b…
Browse files Browse the repository at this point in the history
…e removed)
  • Loading branch information
gcharest authored Apr 18, 2024
1 parent 7ab0eae commit a4434fb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/modules/dev/aws_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Testing AWS service (will be removed)"""
import os

from integrations.aws import identity_store, client as aws_client
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.")
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.")
7 changes: 7 additions & 0 deletions app/modules/sre/sre.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from modules.incident import incident_helper
from modules import google_service
from modules.sre import geolocate_helper, webhook_helper
from modules.dev import aws_dev
from integrations.slack import commands as slack_commands

help_text = """
Expand Down Expand Up @@ -65,6 +66,12 @@ def sre_command(ack, command, logger, respond, client, body):
else:
respond("This command is only available in the dev environment.")
return
case "aws":
if PREFIX == "dev-":
aws_dev.aws_dev_command(client, body, respond)
else:
respond("This command is only available in the dev environment.")
return
case _:
respond(
f"Unknown command: `{action}`. Type `/sre help` to see a list of commands. \nCommande inconnue: `{action}`. Entrez `/sre help` pour une liste des commandes valides"
Expand Down

0 comments on commit a4434fb

Please sign in to comment.