Source code for

#  -*- coding: utf-8 -*-
# SPDX-License-Identifier: MPL-2.0
# Copyright 2020-2021 John Mille <>

from compose_x_common.compose_x_common import keyisset
from import Rule

from ecs_composex.common import LOG
from ecs_composex.resources_import import import_record_properties

[docs]def define_event_rule(stack, rule): """ Function to define the EventRule properties :param ecs_composex.common.stacks.ComposeXStack stack: :param rule: """ rule_props = import_record_properties(, Rule) if not keyisset("Targets", rule_props): rule_props["Targets"] = [] rule.cfn_resource = Rule(rule.logical_name, **rule_props) stack.stack_template.add_resource(rule.cfn_resource)
[docs]def create_events_template(stack, settings, new_resources): """ Function to create the CFN root template for Events Rules :param stack: :param ecs_composex.common.settings.ComposeXSettings settings: :param list new_resources: """ for resource in new_resources: if not resource.families_targets: LOG.error( f"The rule {resource.logical_name} does not have any families_targets defined" ) continue define_event_rule(stack, resource)