integration/resources/templates/combination/connector_event_rule_to_eb_custom_write.yaml [1:40]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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",
              EventBusName: process.env.EVENT_BUS_NAME,
            }]
          });

          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'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



integration/resources/templates/combination/connector_event_rule_to_eb_default_write.yaml [1:40]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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",
              EventBusName: process.env.EVENT_BUS_NAME,
            }]
          });

          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'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



