NAME
WFA::Client - A perl WFA client for interacting with OnCommand Workflow Automation
VERSION
Version 0.01
SYNOPSIS
my $wfa = WFA::Client->new(
server => $hostname_or_ip,
username => $username,
password => $password,
);
my $workflow = $wfa->get_workflow($workflow_name);
my $job = $workflow->execute(
parameter => 'value',
);
$job->poll_for_completion();
my $success = $job->success();
DESCRIPTION
This module provides access to execute jobs on an OnCommand WFA server via the REST interface.
CONSTRUCTOR
my $wfa = WFA::Client->new(server => $server, username => $username, password => $password)
Create a new WFA client object. It accepts the following named options:
- server =>
'myserver'
-
Required. The hostname or IP address of a WFA server.
- username =>
'myuser'
-
Required. The WFA username.
- password =>
'mypass'
-
Required. The WFA password.
- use_ssl => 1
-
Default. Connect using SSL. This is the most secure and preferred method.
METHODS
my @workflow_names = $wfa->get_workflow_names()
Get the list of workflows available on the server. This only returns names, see get_workflow
for retrieving workflow details.
my $workflow = $wfa->get_workflow($workflow_name)
Retrieve an individual workflow. This returns a WFA::Workflow
object.
- $workflow_name
-
The name of the workflow to retrieve. See
get_workflow_names
for a list of available workflows.
LOW-LEVEL INTERFACE
There is a low-level interface which provides access to make arbitrary requests to WFA. It also provides access to the raw responses from WFA for these actions. It can be used in conjunction with the high-level interface and is best used when the high-level interface is lacking the desired functionality.
Manually executing a workflow:
my $workflow = $wfa->get_workflow('MyWorkflow');
my $execute_action = $workflow->url_for_action('execute');
my $execute_parameter_xml = $wfa->construct_xml_request_parameters(Parameter => 'value');
my $response = $wfa->submit_wfa_request($execute_action, $execute_parameter_xml);
Accessing workflow raw values:
my $workflow = $wfa->get_workflow('MyWorkflow');
my @workflow_actions = $workflow->actions();
my $workflow_raw_context = $workflow->response();
Accessing job raw values:
my $job = $wfa->execute();
my @job_actions = $job->actions();
my $job_raw_context = $job->response();
my $response = $wfa->submit_wfa_request($url, $optional_paramater_xml)
Make a call to WFA for a given URL. This can include a properly formatted parameter xml blob which can be generated by construct_xml_request_parameters
.
- $url
-
Required. The url to call. This usually comes from
$workflow-
url_for_action($action)> or$job-
url_for_action($action)>. - $optional_paramater_xml
-
This is an optional xml string which will be POST-ed to the given
$url
. Seeconstruct_xml_request_parameters
.
my $parameter_xml = $wfa->construct_xml_request_parameters(%parameters)
Generate a properly formatted xml parameter blob which can be used to pass parameters to WFA. This is typically required for execute
actions.