def _inject_subscription(self, function, topic, filterPolicy): subscription = SNSSubscription(self.logical_id) subscription.Protocol = 'lambda' subscription.Endpoint = function.get_runtime_attr("arn") subscription.TopicArn = topic if CONDITION in function.resource_attributes: subscription.set_resource_attribute(CONDITION, function.resource_attributes[CONDITION]) if filterPolicy is not None: subscription.FilterPolicy = filterPolicy return subscription
def _inject_subscription(self, protocol, endpoint, topic, region, filterPolicy, resource_attributes): subscription = SNSSubscription(self.logical_id) subscription.Protocol = protocol subscription.Endpoint = endpoint subscription.TopicArn = topic if region is not None: subscription.Region = region if CONDITION in resource_attributes: subscription.set_resource_attribute(CONDITION, resource_attributes[CONDITION]) if filterPolicy is not None: subscription.FilterPolicy = filterPolicy return subscription