lib/plugins/platform/platform.js/Platform/getS3Subscription
class Platform:  getS3Subscription(event, fn) {
    const provider = this.data.service.provider;
    const subscription = {
      functionId: this.serverless.service.getFunction(fn).name,
      details: {
        function: this.serverless.service.getFunction(fn).name,
      },
      provider,
      permissions: {
        type: 'aws IAM',
        action: 'lambda:InvokeFunction',
        sourceAccount: 'Amazon',
      },
    };
    if (typeof event === 'string') {
      subscription.type = 'aws.s3.ObjectCreated';
      subscription.details.source = `AWS::S3::${event}`;
      subscription.details.bucket = event;
      subscription.details.event = 's3:ObjectCreated:*';
      subscription.details.rules = null;
      subscription.permissions.sourceArn = `arn:aws:s3:::${event}`;
    } else if (typeof event === 'object') {
      subscription.type = this.getS3Type(event.event);
      subscription.details.source = `AWS::S3::${event.bucket}`;
      subscription.details.bucket = event.bucket;
      subscription.details.event = event.event;
      subscription.details.rules = event.rules || null;
      subscription.permissions.sourceArn = `arn:aws:s3:::${event.bucket}`;
    }
    subscription.event = event;
    return subscription;
  }