Class: AWSCDK::Triggers::TriggerProps

Inherits:
TriggerOptions
  • Object
show all
Defined in:
triggers/trigger_props.rb

Overview

Props for Trigger.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execute_after: nil, execute_before: nil, execute_on_handler_change: nil, handler:, invocation_type: nil, timeout: nil) ⇒ TriggerProps

Returns a new instance of TriggerProps.

Parameters:

  • execute_after (Array<Constructs::Construct>, nil) (defaults to: nil)

    Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned.

  • execute_before (Array<Constructs::Construct>, nil) (defaults to: nil)

    Adds this trigger as a dependency on other constructs.

  • execute_on_handler_change (Boolean, nil) (defaults to: nil)

    Re-executes the trigger every time the handler changes.

  • handler (AWSCDK::Lambda::Function)

    The AWS Lambda function of the handler to execute.

  • invocation_type (AWSCDK::Triggers::InvocationType, nil) (defaults to: nil)

    The invocation type to invoke the Lambda function with.

  • timeout (AWSCDK::Duration, nil) (defaults to: nil)

    The timeout of the invocation call of the Lambda function to be triggered.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'triggers/trigger_props.rb', line 13

def initialize(execute_after: nil, execute_before: nil, execute_on_handler_change: nil, handler:, invocation_type: nil, timeout: nil)
  @execute_after = execute_after
  Jsii::Type.check_type(@execute_after, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImNvbnN0cnVjdHMuQ29uc3RydWN0In0sImtpbmQiOiJhcnJheSJ9fQ==")), "executeAfter") unless @execute_after.nil?
  @execute_before = execute_before
  Jsii::Type.check_type(@execute_before, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImNvbnN0cnVjdHMuQ29uc3RydWN0In0sImtpbmQiOiJhcnJheSJ9fQ==")), "executeBefore") unless @execute_before.nil?
  @execute_on_handler_change = execute_on_handler_change
  Jsii::Type.check_type(@execute_on_handler_change, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "executeOnHandlerChange") unless @execute_on_handler_change.nil?
  @handler = handler
  Jsii::Type.check_type(@handler, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkZ1bmN0aW9uIn0=")), "handler")
  @invocation_type = invocation_type
  Jsii::Type.check_type(@invocation_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi50cmlnZ2Vycy5JbnZvY2F0aW9uVHlwZSJ9")), "invocationType") unless @invocation_type.nil?
  @timeout = timeout
  Jsii::Type.check_type(@timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "timeout") unless @timeout.nil?
end

Instance Attribute Details

#execute_afterArray<Constructs::Construct>? (readonly)

Note:

Default: []

Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned.

You can also use trigger.executeAfter() to add additional dependencies.

Returns:

  • (Array<Constructs::Construct>, nil)


34
35
36
# File 'triggers/trigger_props.rb', line 34

def execute_after
  @execute_after
end

#execute_beforeArray<Constructs::Construct>? (readonly)

Note:

Default: []

Adds this trigger as a dependency on other constructs.

This means that this trigger will get executed before the given construct(s).

You can also use trigger.executeBefore() to add additional dependents.

Returns:

  • (Array<Constructs::Construct>, nil)


44
45
46
# File 'triggers/trigger_props.rb', line 44

def execute_before
  @execute_before
end

#execute_on_handler_changeBoolean? (readonly)

Note:

Default: true

Re-executes the trigger every time the handler changes.

This implies that the trigger is associated with the current_version of the handler, which gets recreated every time the handler or its configuration is updated.

Returns:

  • (Boolean, nil)


53
54
55
# File 'triggers/trigger_props.rb', line 53

def execute_on_handler_change
  @execute_on_handler_change
end

#handlerAWSCDK::Lambda::Function (readonly)

The AWS Lambda function of the handler to execute.



57
58
59
# File 'triggers/trigger_props.rb', line 57

def handler
  @handler
end

#invocation_typeAWSCDK::Triggers::InvocationType? (readonly)

Note:

Default: RequestResponse

The invocation type to invoke the Lambda function with.



62
63
64
# File 'triggers/trigger_props.rb', line 62

def invocation_type
  @invocation_type
end

#timeoutAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(2)

The timeout of the invocation call of the Lambda function to be triggered.

Returns:



67
68
69
# File 'triggers/trigger_props.rb', line 67

def timeout
  @timeout
end

Class Method Details

.jsii_propertiesObject



69
70
71
72
73
74
75
76
77
78
# File 'triggers/trigger_props.rb', line 69

def self.jsii_properties
  {
    :execute_after => "executeAfter",
    :execute_before => "executeBefore",
    :execute_on_handler_change => "executeOnHandlerChange",
    :handler => "handler",
    :invocation_type => "invocationType",
    :timeout => "timeout",
  }
end

Instance Method Details

#to_jsiiObject



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'triggers/trigger_props.rb', line 80

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "executeAfter" => @execute_after,
    "executeBefore" => @execute_before,
    "executeOnHandlerChange" => @execute_on_handler_change,
    "handler" => @handler,
    "invocationType" => @invocation_type,
    "timeout" => @timeout,
  })
  result.compact
end