code: function buildCloudwatchEvent(options, functionType) {
    validateCloudWatchEvent(functionType, options.eventSources);
  
    let eventName = options.name + utils.capitalizeFirst(functionType);
    let event = {
      Resources: {}
    };
  
    event.Resources[eventName + 'Permission'] = {
      Type: 'AWS::Lambda::Permission',
      Properties: {
        FunctionName: cf.getAtt(options.name, 'Arn'),
        Action: 'lambda:InvokeFunction',
        Principal: 'events.amazonaws.com',
        SourceArn: cf.getAtt(eventName + 'Rule', 'Arn')
      }
    };
  
    event.Resources[eventName + 'Rule'] = {
      Type: 'AWS::Events::Rule',
      Properties: {
        RoleArn: cf.if('HasDispatchSnsArn', cf.getAtt('LambdaCfnDispatchRole', 'Arn'), cf.getAtt('LambdaCfnRole', 'Arn')),
        State: 'ENABLED',
        Targets: [
          {
            Arn: cf.getAtt(options.name, 'Arn'),
            Id: options.name
          }
        ]
      }
    };
  
    if (functionType === 'cloudwatchEvent') {
      event.Resources[eventName + 'Rule'].Properties.EventPattern = options.eventSources.cloudwatchEvent.eventPattern;
    } else {
      event.Resources[eventName + 'Rule'].Properties.ScheduleExpression = options.eventSources.schedule.expression;
    }
  
    return event;
  }
docs: Build CloudWatch events
  
  This function creates
  
  - A Permission to access lambda invokation events
  - A EventPattern rule in case of cloudwatchEvent function type
  - A Schedule Expression in case of schedule function type.
  @param options
  @param functionType