forked from aws-samples/aws-flow-ruby-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.rb
32 lines (26 loc) · 882 Bytes
/
utils.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'bundler/setup'
require 'aws/decider'
require 'logger'
# These are utilities that are common to all samples and recipes
module SharedUtils
def setup_domain(domain_name)
swf = AWS::SimpleWorkflow.new
domain = swf.domains[domain_name]
unless domain.exists?
swf.domains.create(domain_name, 10)
end
domain
end
def build_workflow_worker(domain, klass, task_list)
AWS::Flow::WorkflowWorker.new(domain.client, domain, task_list, klass)
end
def build_generic_activity_worker(domain, task_list)
AWS::Flow::ActivityWorker.new(domain.client, domain, task_list)
end
def build_activity_worker(domain, klass, task_list)
AWS::Flow::ActivityWorker.new(domain.client, domain, task_list, klass)
end
def build_workflow_client(domain, options_hash)
AWS::Flow::workflow_client(domain.client, domain) { options_hash }
end
end