I want to create workflow where user enters a business unit name and command creates an export policy on a cluster whose data is stored in the playground database
I created a playground table that holds data abount business units and corresponding clusters and their IP addresses:
create table bu (
id int(11) not nul auto_increment primary key,
I managed to create playground tables and successfully created filters and finders based on that.
But I cannot find out how to use information from SQL directly in a command.
I wanted to create a modification of "Create Export policy" command where user enters a business unit name and command creates an export policy on a cluster whose data is stored in the playground database, like this:
[parameter(Mandatory=$true, HelpMessage="Business Unit Name")]
... I need to fetch here data from playground database, like this:
"select cluster_name from playground.bu_data where bu = '$BU"'
# connect to controller
Connect-WfaCluster $Cluster <====== how can I get this $Cluster?
Now in your workflow, you for this parameter declare variable as $Cluster_name and go to Setup > User-Inputs tab. Double-click to edit this variable input from string to type: Query. Now write your query and you get the Cluster.
2. You can make use of the mysql .NET connector and the attached powershell module to run queries directly from your command.
Here is another approach which I use since it does not require installation of additional software (I believe that the .NET mysql modules will be included with future releases of WFA so the approach above will be appropriate then)...:
### begin snip ###
# Default credentials for playground database
$MySQLAdminUserName = 'wfa'
$MySQLAdminPassword = 'Wfa123'
$MySQLDatabase = 'playground'
$MySQLHost = "localhost"
Get-WFALogger -Info -message $("Obtaining MySQL location.")
# Attempt to find mysql.exe based on the wfa tmp working path, or default location if not found