in source/CRRMonitorTrailAlarm/CRRMonitorTrailAlarm.py [0:0]
def delete_trail_alarm(event, context):
trail_name = event["ResourceProperties"]["trail_name"] # Trail Name
print("Delete TrailName:" + trail_name)
# -----------------------------------------------------------------
# Create client connections
#
# events
try:
ctl = boto3.client('cloudtrail')
cwe = boto3.client('cloudwatch')
except Exception as e:
print(e)
print('Error creating Events client')
raise e
# -----------------------------------------------------------------
# Remove the Targets
#
ctl.delete_trail(
Name=trail_name
)
###Fetching source bucket details
source_bucket_list = get_source_buckets()
for bucket in source_bucket_list:
cwe.delete_alarms(
AlarmNames=[
'FailedReplicationAlarm-' + bucket,
]
)
return {}