Created
August 26, 2019 19:53
-
-
Save BedrosovaYulia/96f8662653c8fc5fe235bd5d8126df73 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@staticmethod | |
def prepare_report(item): | |
"""Prepare report for answer to AWS Config""" | |
rotation_arn = item['RotationLambdaARN'] | |
aa_days = item['RotationRules']['AutomaticallyAfterDays'] | |
secret_name = item['Name'] | |
if not rotation_arn: | |
answer = { | |
"type": "NON_COMPLIANT", | |
"annotation": "Value of RotationLambdaARN = null (empty) for Secret {}. Refer to documentation here: {}. ".format( | |
secret_name, | |
Environment.get_reference_url(), | |
) | |
} | |
elif aa_days > 90: | |
answer = { | |
"type": "NON_COMPLIANT", | |
"annotation": "Automatic rotation for the Secter {} is after {} days. Refer to documentation here: {}. ".format( | |
secret_name, | |
aa_days, | |
Environment.get_reference_url(), | |
) | |
} | |
else: | |
answer = { | |
"type": "COMPLIANT", | |
"annotation": "Automatic rotation for the Secter {} is after {} days. Refer to documentation here: {}. ".format( | |
secret_name, | |
aa_days, | |
Environment.get_reference_url(), | |
) | |
} | |
return answer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment