Skip to content

Instantly share code, notes, and snippets.

@ozgurakan
Last active April 13, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozgurakan/efef0c3928fdb00f4eade006dd2f6de6 to your computer and use it in GitHub Desktop.
Save ozgurakan/efef0c3928fdb00f4eade006dd2f6de6 to your computer and use it in GitHub Desktop.
#!/bin/python3
def is_s3_enabled(result):
attributes = result['Attributes']
s3_logs_enabled = False
for attribute in attributes:
if attribute['Key'] == 'access_logs.s3.enabled':
if attribute['Value'].title() == 'True':
s3_logs_enabled = True
break
return s3_logs_enabled
result = {
"Attributes": [
{
"Value": "True",
"Key": "access_logs.s3.enabled"
},
{
"Value": "60",
"Key": "idle_timeout.timeout_seconds"
},
{
"Value": "",
"Key": "access_logs.s3.prefix"
},
{
"Value": "false",
"Key": "deletion_protection.enabled"
},
{
"Value": "",
"Key": "access_logs.s3.bucket"
}
]
}
if is_s3_enabled(result):
print("S3 Access Logs is enabled")
else:
print("S3 Access Logs is not enabled")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment