Class: AWSCDK::StepFunctions::StateMachineFragment

Inherits:
Constructs::Construct
  • Object
show all
Includes:
IChainable
Defined in:
step_functions/state_machine_fragment.rb

Overview

Base class for reusable state machine fragments.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id) ⇒ StateMachineFragment

Creates a new construct node.

Parameters:

  • scope (Constructs::Construct)

    The scope in which to define this construct.

  • id (String)

    The scoped construct ID.



13
14
15
16
17
# File 'step_functions/state_machine_fragment.rb', line 13

def initialize(scope, id)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id)
end

Class Method Details

.jsii_overridable_methodsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'step_functions/state_machine_fragment.rb', line 19

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :end_states => { kind: :property, name: "endStates", is_optional: false },
    :id => { kind: :property, name: "id", is_optional: false },
    :start_state => { kind: :property, name: "startState", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :_next => { kind: :method, name: "next", is_optional: false },
    :prefix_states => { kind: :method, name: "prefixStates", is_optional: false },
    :to_single_state => { kind: :method, name: "toSingleState", is_optional: false },
  }
end

Instance Method Details

#_next(_next) ⇒ AWSCDK::StepFunctions::Chain

Continue normal execution with the given state.



88
89
90
91
# File 'step_functions/state_machine_fragment.rb', line 88

def _next(_next)
  Jsii::Type.check_type(_next, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5JQ2hhaW5hYmxlIn0=")), "next")
  jsii_call_method("next", [_next])
end

#end_statesArray<AWSCDK::StepFunctions::INextable>

The states to chain onto if this fragment is used.



43
44
45
# File 'step_functions/state_machine_fragment.rb', line 43

def end_states()
  jsii_get_property("endStates")
end

#idString

Descriptive identifier for this chainable.

Returns:

  • (String)


50
51
52
# File 'step_functions/state_machine_fragment.rb', line 50

def id()
  jsii_get_property("id")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


36
37
38
# File 'step_functions/state_machine_fragment.rb', line 36

def node()
  jsii_get_property("node")
end

#prefix_states(prefix = nil) ⇒ AWSCDK::StepFunctions::StateMachineFragment

Prefix the IDs of all states in this state machine fragment.

Use this to avoid multiple copies of the state machine all having the same state IDs.

Parameters:

  • prefix (String, nil) (defaults to: nil)

    The prefix to add.

Returns:

  • (AWSCDK::StepFunctions::StateMachineFragment)


100
101
102
103
# File 'step_functions/state_machine_fragment.rb', line 100

def prefix_states(prefix = nil)
  Jsii::Type.check_type(prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "prefix") unless prefix.nil?
  jsii_call_method("prefixStates", [prefix])
end

#start_stateAWSCDK::StepFunctions::State

The start state of this state machine fragment.



57
58
59
# File 'step_functions/state_machine_fragment.rb', line 57

def start_state()
  jsii_get_property("startState")
end

#to_single_state(options = nil) ⇒ AWSCDK::StepFunctions::Parallel

Wrap all states in this state machine fragment up into a single state.

This can be used to add retry or error handling onto this state machine fragment.

Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.

Parameters:

Returns:



117
118
119
120
121
# File 'step_functions/state_machine_fragment.rb', line 117

def to_single_state(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::StepFunctions::SingleStateOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc3RlcGZ1bmN0aW9ucy5TaW5nbGVTdGF0ZU9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("toSingleState", [options])
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


64
65
66
# File 'step_functions/state_machine_fragment.rb', line 64

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



77
78
79
80
81
82
# File 'step_functions/state_machine_fragment.rb', line 77

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end