def lambda_handler()

in SecurityGroups/config/code/index.py [0:0]


def lambda_handler(event, context):
    csvParser()
    try:
        sg_response = client.describe_security_groups()
        sg_list_result, vpc_list_result = describe_pipeline_managed_security_groups(sg_response)
        missing_vpc_list = get_vpc_id(vpc_list_result)
        if missing_vpc_list:
            for vpc in missing_vpc_list:
                sg = create_pipeline_managed_security_groups(vpc)  # This is adding new SG to the list of SG
                sg_list_result.append(sg)

        for sg in sg_list_result:
            current_ingress_rule_list = currentIngressRule(sg)  # Rules from the current security groups that have the tag pipeline-managed
            current_egress_rule_list = currentEgressRule(sg)
            compareSecurityGroupIngressRules(sg, current_ingress_rule_list, Ingress_Rules)
            compareSecurityGroupEgressRules(sg, current_egress_rule_list, Egress_Rules)
        cfnr.send(event, context, cfnr.SUCCESS, responseData)
    except Exception as e:
        logger.error('Something went wrong: ' + str(e))
        cfnr.send(event, context, cfnr.FAILED, responseData)
        return False