-
Notifications
You must be signed in to change notification settings - Fork 5.8k
AWS Config for Python using Code Loom #7566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
995302d
to
f4bf910
Compare
1929228
to
b61a30d
Compare
@@ -0,0 +1,195 @@ | |||
# zexi 0.4.0 | |||
config_PutConfigurationRecorder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it edited the old file and made a new one. We should decide which to keep.
def __init__(self, config_wrapper, s3_resource, iam_resource): | ||
""" | ||
:param config_wrapper: An object that wraps AWS Config operations. | ||
:param s3_resource: A Boto3 S3 resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it using resources instead of clients?
# Get IAM role ARN | ||
self.role_arn = q.ask( | ||
"Enter the ARN of an IAM role that grants AWS Config permissions to access your resources " | ||
"(e.g., arn:aws:iam::123456789012:role/config-role): ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want it to create this role, right?
# Show recorder status | ||
print("Checking configuration recorder status...") | ||
try: | ||
statuses = self.config_wrapper.describe_configuration_recorder_status([self.recorder_name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this change the configuration of the bucket so that there is something to view? Maybe I'm not seeing it.
print("-" * 60) | ||
|
||
if self.recorder_name: | ||
cleanup = q.ask( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a bucket (and maybe a role?) to clean up also?
recorders = response.get('ConfigurationRecorders', []) | ||
|
||
if recorders: | ||
print(f"Found {len(recorders)} configuration recorder(s):") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use pagination for all of the listing operations.
|
||
import sys | ||
import os | ||
sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to run the tests, they look like they could follow the pattern better.
@@ -94,3 +94,155 @@ def stub_describe_conformance_pack_compliance( | |||
response, | |||
error_code=error_code, | |||
) | |||
|
|||
def stub_put_configuration_recorder(self, recorder, error_code=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that it added the stubber functions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.