integration/resources/templates/combination/connector_event_rule_to_lambda_write.yaml [1:55]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Resources:
  TriggerFunction:
    Type: AWS::Serverless::Function
    Properties:
      Runtime: nodejs18.x
      Handler: index.handler
      Timeout: 10  # in case eb has delay
      InlineCode: |
        const {
          EventBridge
        } = require("@aws-sdk/client-eventbridge"),
        {
          SQS
        } = require("@aws-sdk/client-sqs");

        exports.handler = async (event) => {
          const eb = new EventBridge();
          const response = await eb.putEvents({
            Entries: [{
              Source: process.env.EVENT_SOURCE,
              Detail: "{}",
              DetailType: "Test",
            }]
          });

          const sqs = new SQS();
          const data = await sqs.receiveMessage({
            QueueUrl: process.env.QUEUE_URL,
            WaitTimeSeconds: 5,
          });

          if (data.Messages.length == 0) {
            throw 'No messages in the queue!';
          }
        };
      Environment:
        Variables:
          QUEUE_URL: !Ref VerificationQueue
          EVENT_SOURCE: !Sub '${AWS::StackName}-test-event'
      Policies:
      - EventBridgePutEventsPolicy:
          EventBusName: default
      - SQSPollerPolicy:
          QueueName: !GetAtt VerificationQueue.QueueName

  EventRule:
    Type: AWS::Events::Rule
    Properties:
      Description: !Sub 'EventRule-${AWS::StackName}'
      EventPattern:
        source:
        - !Sub '${AWS::StackName}-test-event'
      Targets:
      - Arn: !GetAtt Function.Arn
        Id: Target
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



integration/resources/templates/combination/connector_event_rule_to_lambda_write_multiple.yaml [1:55]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Resources:
  TriggerFunction:
    Type: AWS::Serverless::Function
    Properties:
      Runtime: nodejs18.x
      Handler: index.handler
      Timeout: 10  # in case eb has delay
      InlineCode: |
        const {
          EventBridge
        } = require("@aws-sdk/client-eventbridge"),
        {
          SQS
        } = require("@aws-sdk/client-sqs");

        exports.handler = async (event) => {
          const eb = new EventBridge();
          const response = await eb.putEvents({
            Entries: [{
              Source: process.env.EVENT_SOURCE,
              Detail: "{}",
              DetailType: "Test",
            }]
          });

          const sqs = new SQS();
          const data = await sqs.receiveMessage({
            QueueUrl: process.env.QUEUE_URL,
            WaitTimeSeconds: 5,
          });

          if (data.Messages.length == 0) {
            throw 'No messages in the queue!';
          }
        };
      Environment:
        Variables:
          QUEUE_URL: !Ref VerificationQueue
          EVENT_SOURCE: !Sub '${AWS::StackName}-test-event'
      Policies:
      - EventBridgePutEventsPolicy:
          EventBusName: default
      - SQSPollerPolicy:
          QueueName: !GetAtt VerificationQueue.QueueName

  EventRule:
    Type: AWS::Events::Rule
    Properties:
      Description: !Sub 'EventRule-${AWS::StackName}'
      EventPattern:
        source:
        - !Sub '${AWS::StackName}-test-event'
      Targets:
      - Arn: !GetAtt Function.Arn
        Id: Target
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



