service: jenkins-hook

provider:
  name: aws
  runtime: python2.7
  stage: dev
  region: eu-west-1
  memorySize: 128
  timeout: 4

custom: ${file(bot_settings.yml)}

functions:
  hook:
    name: ${self:service}-jenbot-hook-${opt:stage, self:provider.stage}
    description: Slack hook handler
    handler: hook_handler.handler
    environment:
      slackWebhook: ${self:custom.${opt:stage, self:provider.stage}.slackWebhook}
    events:
      - http:
          path: hook
          method: post

  command:
    name: ${self:service}-jenbot-command-${opt:stage, self:provider.stage}
    description: Slack command handler
    handler: command_handler.handler
    environment:
      jenkinsUser: ${self:custom.${opt:stage, self:provider.stage}.jenkinsUser}
      jenkinsPassword: ${self:custom.${opt:stage, self:provider.stage}.jenkinsPassword}
      slackToken: ${self:custom.${opt:stage, self:provider.stage}.slackToken}
    events:
      - http:
          path: command
          method: post

service: jenkins-hook

provider:
  name: aws
  runtime: python2.7
  stage: dev
  region: eu-west-1
  memorySize: 128
  timeout: 4
  iamRoleStatements:
    -  Effect: "Allow"
       Action:
         - "xray:PutTraceSegments"
         - "xray:PutTelemetryRecords"
       Resource: "*"

custom: ${file(bot_settings.yml)}

functions:
  hook:
    name: ${self:service}-jenbot-hook-${opt:stage, self:provider.stage}
    description: Slack hook handler
    handler: hook_handler.handler
    environment:
      slackWebhook: ${self:custom.${opt:stage, self:provider.stage}.slackWebhook}
    events:
      - http:
          path: hook
          method: post

  command:
    name: ${self:service}-jenbot-command-${opt:stage, self:provider.stage}
    description: Slack command handler
    handler: command_handler.handler
    environment:
      jenkinsUser: ${self:custom.${opt:stage, self:provider.stage}.jenkinsUser}
      jenkinsPassword: ${self:custom.${opt:stage, self:provider.stage}.jenkinsPassword}
      slackToken: ${self:custom.${opt:stage, self:provider.stage}.slackToken}
    events:
      - http:
          path: command
          method: post

Add X-Ray permissions to lambda role
Add X-Ray permissions to lambda role
