Method: Jets::Job::Dsl::KinesisEvent#kinesis_event

Defined in:
lib/jets/job/dsl/kinesis_event.rb

#kinesis_event(stream_name, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jets/job/dsl/kinesis_event.rb', line 3

def kinesis_event(stream_name, options={})
  stream_arn = full_kinesis_stream_arn(stream_name)
  default_iam_policy = default_kinesis_stream_policy(stream_arn)

  # Create iam policy allows access to queue
  # Allow disabling in case use wants to add permission application-wide and not have extra IAM policy
  iam_policy_props = options.delete(:iam_policy) || @iam_policy || default_iam_policy
  iam_policy(iam_policy_props) unless iam_policy_props == :disable

  props = options # by this time options only has EventSourceMapping properties
  default = {
    EventSourceArn: stream_arn,
    StartingPosition: "LATEST",
  }
  props = default.merge(props)

  event_source_mapping(props)
end