NetApp WFA - Commands, Code, Reservation, Verification

Continuing my NetApp Workflow Automation (WFA) learning, yesterday I learnt that you can just create a command with PowerShell that only takes inputs and use those inputs in a ‘Reservation Script’ and a ‘Verification Script’.
Reservation and Verification Scripts are MySQL queries.

Example of this kind of PowerShell code:

param(
  [parameter(Mandatory=$true, HelpMessage="Something name")]
  [String]$somethingName,
  [parameter(Mandatory=$true, HelpMessage="Another name")]
  [String]$anotherName,
)

Example of Reservation Script code (remember that dictionaryItem is really like a table in MySQL):

DELETE
FROM
  scheme.dictionaryItem
WHERE
  dictionaryItem.somethingName = '${somethingName}'
  AND dictionaryItem.anotherName = '${anotherName}';

Example of Verification Script code:

SELECT
  'success'
FROM
  (SELECT 1) AS t
WHERE
  NOT EXISTS(
    SELECT
      dictionaryItem.anotherName
    FROM
      scheme.dictionaryItem
    WHERE
      dictionaryItem.anotherName = '${anotherName}'
      AND dictionaryItem.somethingName = '${somethingName}'
  );

Image: New Command Definition - Properties, Code, Parameters Definition, Parameters Mapping, Reservation, Verification

THE END

Random comment (I didn't want to write a post for this) you can have OR in your WHERE statements. For example:

WHERE
    vserver.name = '${vserver}'
    AND (
        cluster.primary_address = '${cluster_address}'       
        OR cluster.name = '${cluster_address}'
    )
    AND volume.name  = '${volume}'
    AND qtree.name != '${qtree}'

Comments