service: ringcentral-add-in-framework
provider:
  stage: ${opt:stage, 'prod'}
  name: aws
  runtime: nodejs14.x
  region: us-east-1
  memorySize: 256
  environment: ${file(./env.yml)}
  profile: default
  # iamRoleStatements:
  #   - Effect: Allow
  #     Action:
  #       - lambda:InvokeFunction
  #     Resource: ""
  deploymentBucket:
    tags:
      Department: dev
      Owner: Your name
      Stage: production
      Environment: your-env-tag
      Team: your-team
      Name: ringcentral-add-in-framework
  tags:
    Department: dev
    Owner: Your name
    Stage: production
    Environment: your-env-tag
    Team: your-team
    Name: ringcentral-add-in-framework
package:
  excludeDevDependencies: true
  patterns:
    - '.json'
    - '.js'
    - 'node_modules/**'
functions:
  app:
    handler: lambda.app
    # role: arn:aws:iam::111111:role/xxxx-prod-us-east-1-lambdaRole
    events:
      - http:
          method: any
          path: /{proxy+}
          cors: false
resources:
  Resources:
    subscriptionTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ringcentral-add-in-framework-webhooks
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
    userTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: ringcentral-add-in-framework-users
        AttributeDefinitions:
          - AttributeName: id
            AttributeType: S
        KeySchema:
          - AttributeName: id
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
plugins:
  - serverless-deployment-bucket
  - serverless-plugin-log-retention
logRetentionInDays: 180 # used to set a global value for all functions