service: serverless-podcast

frameworkVersion: "=1.4.0"

custom:
  bucket: ${file(config.${opt:stage, self:provider.stage}.yml):bucket}

provider:
  name: aws
  runtime: nodejs4.3
  stage: prod
  region: eu-central-1
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:*
        #- s3:ListObjects
        #- s3:HeadObject
        #- s3:PutObject
      Resource:
        - arn:aws:s3:::${self:custom.bucket}
        - arn:aws:s3:::${self:custom.bucket}/*

functions:
  updateFeed:
    handler: handler.updateFeed
    events:
      - s3:
          bucket: ${self:custom.bucket}
          event: s3:ObjectCreated:*
          rules:
            - suffix: .mp3
      - s3:
          bucket: ${self:custom.bucket}
          event: s3:ObjectRemoved:*
          rules:
            - suffix: .mp3
    environment:
      STAGE: ${opt:stage, self:provider.stage}
  updateHTML:
    handler: handler.updateHTML
    environment:
      STAGE: ${opt:stage, self:provider.stage}

service: serverless-podcast

frameworkVersion: "=1.4.0"

custom:
  bucket: ${file(config.${opt:stage, self:provider.stage}.yml):bucket}

provider:
  name: aws
  runtime: nodejs4.3
  stage: prod
  region: eu-central-1
  iamRoleStatements:
    - Effect: Allow
      Action:
        - s3:*
        #- s3:ListObjects
        #- s3:HeadObject
        #- s3:PutObject
      Resource:
        - arn:aws:s3:::${self:custom.bucket}
        - arn:aws:s3:::${self:custom.bucket}/*

functions:
  updateFeed:
    handler: handler.updateFeed
    events:
      - s3:
          bucket: ${self:custom.bucket}
          event: s3:ObjectCreated:*
          rules:
            - prefix: 'episodes/'
            - suffix: .mp3
      - s3:
          bucket: ${self:custom.bucket}
          event: s3:ObjectRemoved:*
          rules:
            - prefix: 'episodes/'
            - suffix: .mp3
    environment:
      STAGE: ${opt:stage, self:provider.stage}
  updateHTML:
    handler: handler.updateHTML
    environment:
      STAGE: ${opt:stage, self:provider.stage}

Move episodes in bucket to episodes/
Move episodes in bucket to episodes/
