Sha256: 8dfddc14fb38126a5a9b61fb7c9931f28ff7336fe7f61f3162b5ceeea3a8c87c

Contents?: true

Size: 1021 Bytes

Versions: 9

Compression:

Stored size: 1021 Bytes

Contents

module Pipedream::Dsl::Pipeline
  module Approve
    def approve(props)
      default = {
        name: "approve",
        action_type_id: {
          category: "Approval",
          owner: "AWS",
          provider: "Manual",
          version: "1",
        },
        run_order: @run_order,
        configuration: {  # required: will be set
          notification_arn: {ref: "SnsTopic"}, # defaults to generated SNS topic
        },
      }

      # Normalize special options. Simple approach of setting the default
      case props
      when String, Symbol
        default[:configuration][:custom_data] = props
        props = {}
      when Hash
        default[:configuration][:notification_arn] = props.delete(:notification_arn) if props.key?(:notification_arn)
        default[:configuration][:custom_data] = props.delete(:custom_data) if props.key?(:custom_data)
      else
        raise "Invalid props type: #{props.class}"
      end

      options = default.merge(props)
      action(options)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pipedream-0.4.8 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.7 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.6 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.5 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.4 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.3 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.2 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.1 lib/pipedream/dsl/pipeline/approve.rb
pipedream-0.4.0 lib/pipedream/dsl/pipeline/approve.rb