<commit_before>service: tfp52calls52weeks
provider:
  name: aws
  runtime: nodejs4.3
  cfLogs: true
  # Prod deploys to us-west-2
  region: us-east-1
  stage: dev

  iamRoleStatements:
    - Effect: "Allow"
      Action:
        - "dynamodb:*"
      Resource: "arn:aws:dynamodb:${self:provider.region}:*:table/*"
    - Effect: "Allow"
      Action:
        - "SNS:Publish"
      Resource: "arn:aws:sns:${self:provider.region}:*:refresh-users"
    - Effect: "Allow"
      Action:
        - "lambda:InvokeFunction"
      Resource: "arn:aws:lambda:${self:provider.region}:*:function:${self:service}-${opt:stage}-notify-user"
# TODO(jon): Explore ETL'ing of http://www.senate.gov/general/contact_information/senators_cfm.xml
#            to local storage?
#     - Effect: "Allow"
#       Action:
#         - "SNS:Publish"
#       Resource: "arn:aws:sns:${self:provider.region}:*:refresh-senators"

# you can define service wide environment variables here
#  environment:
#    variable1: value1

# you can add packaging information here
#package:
#  include:
#    - include-me.js
#    - include-me-dir/**
#  exclude:
#    - exclude-me.js
#    - exclude-me-dir/**

# package:
#   include:
#     - functions/*
#     - lib/**
#   exclude:
#     - .git/**

functions:
  schedule-fanout:
    handler: functions/schedule_fanout.handler
    environment:
      SUBMIT_USER_FUNCTION_NAME: ${self:service}-${opt:stage}-notify-user
    events:
      - schedule: cron(0/15 * * * ? *)
  notify-user:
    handler: functions/notify_user.handler
  robots:
    handler: functions/robots.handler
    events:
      - http:
          path: robots.txt
          method: get
  submit-user:
    handler: functions/submit_user.handler
    environment:
      GOOGLE_API: ${env:GOOGLE_API}
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          integration: lambda
          path: users/register
          method: post
          cors: true
  mc-subscribe:
    handler: functions/mc-subscribe.handler
    environment:
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          integration: lambda
          path: mailchimp/hook/subscribe
          method: post
          cors: true
  mc-unsubscribe:
    handler: functions/mc-unsubscribe.handler
    environment:
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          path: mailchimp/hook/unsubscribe
          integration: lambda
          method: post
          cors: true

  noreply:
    handler: functions/echo.handler

  migrate:
    handler: functions/migrate.handler
    environment:
      STAGE: ${opt:stage}
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}

# resources:
#   Resources:
#     usersTable:
#       Type: AWS::DynamoDB::Table<commit_msg>MC expects GET to work on webhooks -,-  theres probably a more elegant way to do this<commit_after>service: tfp52calls52weeks
provider:
  name: aws
  runtime: nodejs4.3
  cfLogs: true
  # Prod deploys to us-west-2
  region: us-east-1
  stage: dev

  iamRoleStatements:
    - Effect: "Allow"
      Action:
        - "dynamodb:*"
      Resource: "arn:aws:dynamodb:${self:provider.region}:*:table/*"
    - Effect: "Allow"
      Action:
        - "SNS:Publish"
      Resource: "arn:aws:sns:${self:provider.region}:*:refresh-users"
    - Effect: "Allow"
      Action:
        - "lambda:InvokeFunction"
      Resource: "arn:aws:lambda:${self:provider.region}:*:function:${self:service}-${opt:stage}-notify-user"
# TODO(jon): Explore ETL'ing of http://www.senate.gov/general/contact_information/senators_cfm.xml
#            to local storage?
#     - Effect: "Allow"
#       Action:
#         - "SNS:Publish"
#       Resource: "arn:aws:sns:${self:provider.region}:*:refresh-senators"

# you can define service wide environment variables here
#  environment:
#    variable1: value1

# you can add packaging information here
#package:
#  include:
#    - include-me.js
#    - include-me-dir/**
#  exclude:
#    - exclude-me.js
#    - exclude-me-dir/**

# package:
#   include:
#     - functions/*
#     - lib/**
#   exclude:
#     - .git/**

functions:
  schedule-fanout:
    handler: functions/schedule_fanout.handler
    environment:
      SUBMIT_USER_FUNCTION_NAME: ${self:service}-${opt:stage}-notify-user
    events:
      - schedule: cron(0/15 * * * ? *)
  notify-user:
    handler: functions/notify_user.handler
  robots:
    handler: functions/robots.handler
    events:
      - http:
          path: robots.txt
          method: get
  submit-user:
    handler: functions/submit_user.handler
    environment:
      GOOGLE_API: ${env:GOOGLE_API}
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          integration: lambda
          path: users/register
          method: post
          cors: true

  mc-subscribe:
    handler: functions/mc-subscribe.handler
    environment:
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          integration: lambda
          path: mailchimp/hook/subscribe
          method: get
          cors: true
      - http:
          integration: lambda
          path: mailchimp/hook/subscribe
          method: post
          cors: true
  mc-unsubscribe:
    handler: functions/mc-unsubscribe.handler
    environment:
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}
    events:
      - http:
          path: mailchimp/hook/unsubscribe
          integration: lambda
          method: get
          cors: true
      - http:
          path: mailchimp/hook/unsubscribe
          integration: lambda
          method: post
          cors: true

  noreply:
    handler: functions/echo.handler

  migrate:
    handler: functions/migrate.handler
    environment:
      STAGE: ${opt:stage}
      MAILCHIMP_API: ${env:MAILCHIMP_API}
      MAILCHIMP_LIST_ID: ${env:MAILCHIMP_LIST_ID}

# resources:
#   Resources:
#     usersTable:
#       Type: AWS::DynamoDB::Table
{'fraction_non_alphanumeric': 0.12014191259474279, 'fraction_numerical': 0.0041928721174004195, 'mean_word_length': 2.5019762845849804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '863088', 'n_tokens_mistral': 2069, 'n_tokens_neox': 2056, 'n_words': 384}