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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
module Fog
module OpenStack
class Workflow
class V2
class Real
def create_cron_trigger(name,
workflow_identifier,
workflow_input = nil,
workflow_params = nil,
pattern = "* * * * *",
first_time = nil,
count = nil)
data = {
:name => name,
:pattern => pattern,
:first_execution_time => first_time,
:remaining_executions => count
}
if workflow_identifier
data[:workflow_id] = workflow_identifier
end
if workflow_input
data[:workflow_input] = Fog::JSON.encode(workflow_input)
end
if workflow_params
data[:workflow_params] = Fog::JSON.encode(workflow_params)
end
body = Fog::JSON.encode(data)
request(
:body => body,
:expects => 201,
:method => "POST",
:path => "cron_triggers"
)
end
end
class Mock
def create_cron_trigger(_name,
_workflow_identifier,
_workflow_input = nil,
_workflow_params = nil,
_pattern = nil,
_first_time = nil,
_count = nil)
response = Excon::Response.new
response.status = 201
response.body = ""
response
end
end
end
end
end
end
|