Class: AWSCDK::LambdaEventSources::SNSEventSource

Inherits:
Jsii::Object
  • Object
show all
Includes:
AWSCDK::Lambda::IEventSource
Defined in:
lambda_event_sources/sns_event_source.rb

Overview

Use an Amazon SNS topic as an event source for AWS Lambda.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(topic, props = nil) ⇒ SNSEventSource

Returns a new instance of SNSEventSource.

Parameters:



11
12
13
14
15
16
# File 'lambda_event_sources/sns_event_source.rb', line 11

def initialize(topic, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::LambdaEventSources::SNSEventSourceProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(topic, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc25zLklUb3BpYyJ9")), "topic")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhX2V2ZW50X3NvdXJjZXMuU25zRXZlbnRTb3VyY2VQcm9wcyJ9")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(topic, props)
end

Class Method Details

.jsii_overridable_methodsObject



18
19
20
21
22
23
# File 'lambda_event_sources/sns_event_source.rb', line 18

def self.jsii_overridable_methods
  {
    :topic => { kind: :property, name: "topic", is_optional: false },
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bind(target) ⇒ void

This method returns an undefined value.

Called by lambda.addEventSource to allow the event source to bind to this function.

Parameters:



34
35
36
37
# File 'lambda_event_sources/sns_event_source.rb', line 34

def bind(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "target")
  jsii_call_method("bind", [target])
end

#topicAWSCDK::SNS::ITopic

Returns:



26
27
28
# File 'lambda_event_sources/sns_event_source.rb', line 26

def topic()
  jsii_get_property("topic")
end