Skip to content

Instantly share code, notes, and snippets.

@BedrosovaYulia
Created August 26, 2019 19:53
Show Gist options
  • Save BedrosovaYulia/96f8662653c8fc5fe235bd5d8126df73 to your computer and use it in GitHub Desktop.
Save BedrosovaYulia/96f8662653c8fc5fe235bd5d8126df73 to your computer and use it in GitHub Desktop.
@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