class Fog::OpenStack::Workflow::V2::Real
Public Instance Methods
create_action(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_action.rb, line 6 def create_action(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 201, :method => "POST", :path => "actions" ) end
create_action_execution(action, input = {}, params = {})
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_action_execution.rb, line 6 def create_action_execution(action, input = {}, params = {}) data = {:name => action} data[:input] = Fog::JSON.encode(input) unless input.empty? data[:params] = Fog::JSON.encode(params) unless params.empty? body = Fog::JSON.encode(data) request( :body => body, :expects => 201, :method => "POST", :path => "action_executions" ) end
create_cron_trigger(name, workflow_identifier, workflow_input = nil, workflow_params = nil, pattern = "* * * * *", first_time = nil, count = nil)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_cron_trigger.rb, line 6 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
create_environment(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_environment.rb, line 6 def create_environment(definition) unless definition["variables"].nil? definition["variables"] = Fog::JSON.encode(definition["variables"]) end body = Fog::JSON.encode(definition) request( :body => body, :expects => 201, :method => "POST", :path => "environments" ) end
create_execution(workflow, input = {})
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_execution.rb, line 6 def create_execution(workflow, input = {}) data = {:workflow_name => workflow} data[:input] = Fog::JSON.encode(input) unless input.empty? body = Fog::JSON.encode(data) request( :body => body, :expects => 201, :method => "POST", :path => "executions" ) end
create_workbook(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_workbook.rb, line 6 def create_workbook(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 201, :method => "POST", :path => "workbooks" ) end
create_workflow(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/create_workflow.rb, line 6 def create_workflow(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 201, :method => "POST", :path => "workflows" ) end
default_path_prefix()
click to toggle source
# File lib/fog/openstack/workflow/v2.rb, line 100 def default_path_prefix 'v2' end
default_service_type()
click to toggle source
# File lib/fog/openstack/workflow/v2.rb, line 104 def default_service_type %w[workflowv2] end
delete_action(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_action.rb, line 6 def delete_action(name) request( :expects => 204, :method => "DELETE", :path => "actions/#{URI.encode(name)}" ) end
delete_action_execution(id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_action_execution.rb, line 6 def delete_action_execution(id) request( :expects => 204, :method => "DELETE", :path => "action_executions/#{id}" ) end
delete_cron_trigger(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_cron_trigger.rb, line 6 def delete_cron_trigger(name) request( :expects => 204, :method => "DELETE", :path => "cron_triggers/#{URI.encode(name)}" ) end
delete_environment(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_environment.rb, line 6 def delete_environment(name) request( :expects => 204, :method => "DELETE", :path => "environments/#{URI.encode(name)}" ) end
delete_execution(id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_execution.rb, line 6 def delete_execution(id) request( :expects => 204, :method => "DELETE", :path => "executions/#{id}" ) end
delete_workbook(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_workbook.rb, line 6 def delete_workbook(name) request( :expects => 204, :method => "DELETE", :path => "workbooks/#{URI.encode(name)}" ) end
delete_workflow(identifier)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/delete_workflow.rb, line 6 def delete_workflow(identifier) request( :expects => 204, :method => "DELETE", :path => "workflows/#{identifier}" ) end
get_action(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_action.rb, line 6 def get_action(name) request( :expects => 200, :method => "GET", :path => "actions/#{URI.encode(name)}" ) end
get_action_execution(execution_id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_action_execution.rb, line 6 def get_action_execution(execution_id) request( :expects => 200, :method => "GET", :path => "action_executions/#{execution_id}" ) end
get_cron_trigger(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_cron_trigger.rb, line 6 def get_cron_trigger(name) request( :expects => 200, :method => "GET", :path => "cron_triggers/#{URI.encode(name)}" ) end
get_environment(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_environment.rb, line 6 def get_environment(name) request( :expects => 200, :method => "GET", :path => "environments/#{URI.encode(name)}" ) end
get_execution(execution_id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_execution.rb, line 6 def get_execution(execution_id) request( :expects => 200, :method => "GET", :path => "executions/#{execution_id}" ) end
get_task(id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_task.rb, line 6 def get_task(id) request( :expects => 200, :method => "GET", :path => "tasks/#{id}" ) end
get_workbook(name)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_workbook.rb, line 6 def get_workbook(name) request( :expects => 200, :method => "GET", :path => "workbooks/#{URI.encode(name)}" ) end
get_workflow(identifier)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/get_workflow.rb, line 6 def get_workflow(identifier) request( :expects => 200, :method => "GET", :path => "workflows/#{identifier}" ) end
list_action_executions()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_action_executions.rb, line 6 def list_action_executions request( :expects => 200, :method => "GET", :path => "action_executions" ) end
list_actions(params = {})
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_actions.rb, line 6 def list_actions(params = {}) body = Fog::JSON.encode(params) request( :body => body, :expects => 200, :method => "GET", :path => "actions" ) end
list_cron_triggers()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_cron_triggers.rb, line 6 def list_cron_triggers request( :expects => 200, :method => "GET", :path => "cron_triggers" ) end
list_environments()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_environments.rb, line 6 def list_environments request( :expects => 200, :method => "GET", :path => "environments" ) end
list_executions()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_executions.rb, line 6 def list_executions request( :expects => 200, :method => "GET", :path => "executions" ) end
list_services()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_services.rb, line 6 def list_services request( :expects => 200, :method => "GET", :path => "services" ) end
list_tasks(workflow_execution_id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_tasks.rb, line 6 def list_tasks(workflow_execution_id) request( :expects => 200, :method => "GET", :path => "executions/#{workflow_execution_id}/tasks" ) end
list_workbooks()
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_workbooks.rb, line 6 def list_workbooks request( :expects => 200, :method => "GET", :path => "workbooks" ) end
list_workflows(params = {})
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/list_workflows.rb, line 6 def list_workflows(params = {}) body = Fog::JSON.encode(params) request( :body => body, :expects => 200, :method => "GET", :path => "workflows" ) end
request(params)
click to toggle source
# File lib/fog/openstack/workflow/v2.rb, line 108 def request(params) response = @connection.request( params.merge( :headers => { 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}" ) ) rescue Excon::Errors::Unauthorized => error if error.response.body != "Bad username or password" # token expiration @openstack_must_reauthenticate = true authenticate retry else # bad credentials raise error end rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::OpenStack::Workflow::NotFound.slurp(error) else error end else unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end
rerun_task(task_ex_id)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/rerun_task.rb, line 6 def rerun_task(task_ex_id) rerun_payload = { :id => task_ex_id, :state => 'RUNNING', :reset => true } body = Fog::JSON.encode(rerun_payload) request( :body => body, :expects => 200, :method => "PUT", :path => "tasks/#{task_ex_id}" ) end
update_action(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_action.rb, line 6 def update_action(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "PUT", :path => "actions" ) end
update_action_execution(id, name, value)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_action_execution.rb, line 6 def update_action_execution(id, name, value) # valid values for name are: # state, output # https://github.com/openstack/python-mistralclient/blob/master/mistralclient/commands/v2/action_executions.py data = {:id => id} data[name] = Fog::JSON.encode(value) body = Fog::JSON.encode(data) request( :body => body, :expects => 200, :method => "PUT", :path => "action_executions" ) end
update_environment(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_environment.rb, line 6 def update_environment(definition) unless definition["variables"].nil? definition["variables"] = Fog::JSON.encode(definition["variables"]) end body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "PUT", :path => "environments" ) end
update_execution(id, name, value)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_execution.rb, line 6 def update_execution(id, name, value) # valid values for name are: # state, description, env # https://github.com/openstack/python-mistralclient/blob/master/mistralclient/commands/v2/executions.py data = {:id => id} data[name] = Fog::JSON.encode(value) body = Fog::JSON.encode(data) request( :body => body, :expects => 200, :method => "PUT", :path => "executions" ) end
update_workbook(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_workbook.rb, line 6 def update_workbook(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "PUT", :path => "workbooks" ) end
update_workflow(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/update_workflow.rb, line 6 def update_workflow(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "PUT", :path => "workflows" ) end
validate_action(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/validate_action.rb, line 6 def validate_action(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "POST", :path => "actions/validate" ) end
validate_workbook(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/validate_workbook.rb, line 6 def validate_workbook(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "POST", :path => "workbooks/validate" ) end
validate_workflow(definition)
click to toggle source
# File lib/fog/openstack/workflow/v2/requests/validate_workflow.rb, line 6 def validate_workflow(definition) body = Fog::JSON.encode(definition) request( :body => body, :expects => 200, :method => "POST", :path => "workflows/validate" ) end