AWS Config for Python using Code Loom#7566
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.
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.
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.
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.
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.
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.
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.
I'll have to run the tests, they look like they could follow the pattern better.
| error_code=error_code, | ||
| ) | ||
|
|
||
| def stub_put_configuration_recorder(self, recorder, error_code=None): |
There was a problem hiding this comment.
Good that it added the stubber functions.
|
We've taken lessons learned from this output, so closing |
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.