8.2.1. NGCLIENT-WORKFLOWS

8.2.1.1. SYNOPSIS

ngclient workflows list [workflow-id] [options...]

ngclient workflows import workflow-file [options...]

ngclient workflows update workflow-id workflow-file [options...]

ngclient workflows delete workflow-id [options...]

8.2.1.2. DESCRIPTION

The list command is used to list one or more existing workflows from Ngenea Hub. By default, workflows are output in json format, one per line. The --yaml flag can be used to output as yaml.

The import command can be used to import a new, custom workflow from a json or yaml formatted file.

Currently it is not possible to invoke these custom workflows from ngclient, once created. They can be invoked from the Ngenea Hub UI or via the REST API.

The update command can be used to update an existing workflow from a json or yaml formatted file. The file can contain only the fields you want to change to perform a partial update, or a whole workflow definition for a full replacement.

NOTE - it's not possible to make partial changes to the fields or filter_rules blocks. They can only be replaced as a whole.

The delete command can be used to delete an existing workflow, by id.

Base URL and API key settings can be read from a config file, rather than being passed on the command line. See ngenea-client.conf(5) for more information on the configuration format. CLI flags take precedence over config file settings.

Interacting with workflows requires Ngenea Hub authentication. The ngclient(1) authenticate command can be used to generate a client key from a username or access token.

8.2.1.3. OPTION SUMMARY

      workflow-id          Unique workflow identifier
      workflow-file        File containing a custom workflow definition

    --yaml                 List workflows in yaml format

    --base-url             Base URL of the {{ brand_name }} API

-c, --config CONFIG        Alternative configuration file path
    --client-key KEY       Client API key to authenticate with

-h, --help                 Print help message and exit

8.2.1.3.1. OPTIONS

  • workflow-file

    Path to a json or yaml formatted file, containing a workflow definition.

    If '-' is used, the workflow definition will be read from stdin.

    The workflow format is described in the main documentation, section '4.4. Custom Workflows'

  • --yaml

    List workflows in yaml format.

    By default, workflows are output in json format, one per line (jsonl).

    The --yaml flag will output the workflows in structured yaml format. If multiple workflows are being listed, each one will be separated by a blank line.

  • --base-url

    Base URL of the Ngenea Hub API, which operations will be performed against.

    This can be used to perform Ngenea Hub operations on a remote server.

    If not specified, the default is http://localhost:8000/api

  • -c, --config

    The path to an alternative configuration file.

    If not specified, the default configuration paths will be used. The default paths are in the user's HOME directory $HOME/.config/ngenea/ngenea-client.conf, and the global configuration at /etc/ngenea/ngenea-client.conf

    See ngenea-client.conf(5) for more information on the configuration format.

    Command line options take precedence over any corresponding config file settings.

  • --client-key

    Ngenea Hub authentication client key.

    This can be generated via the Ngenea Hub REST API, or using ngclient(1) authenticate

  • -h, --help

    Prints the help message.

8.2.1.4. EXAMPLES

8.2.1.4.1. GENERATE A CLIENT KEY

$ ngclient authenticate --username pixadmin -k ngclient-pixadmin
pixadmin's password:

jDBh2cRk6.LswQfylT2BtGiqtYUWhMB1iipJmQNgr

The following examples assume that the client key has been saved in the default config file.

8.2.1.4.2. GET AN EXISTING WORKFLOW

$ ngclient workflows list 1
{"id": 1, "name": "migrate", "label": "Migrate", "icon_classes": ["fa fa-cloud fa-stack-2x text-success", "fa fa-angle-up fa-stack-2x text-light"], "discovery": "recursive", "enabled": true, "visible": true, "fields": [], "filter_rules": [{"type": "all", "state": "all", "action": [{"name": "dynamo.tasks.migrate"}], "description": "Migrates a file off from a given path"}]}

8.2.1.4.3. LIST ALL EXISTING WORKFLOWS IN YAML FORMAT

$ ngclient workflows list --yaml
id: 1
name: migrate
label: Migrate
discovery: recursive
...
enabled: true
visible: true

id: 2
name: premigrate
label: Premigrate
discovery: recursive
...
enabled: true
visible: true

...

(the above example output has been truncated)

8.2.1.4.4. IMPORT A CUSTOM WORKFLOW

Using the following workflow definition in json format

$ cat overwrite_workflow.json
{"name": "recall_overwrite", "label": "Overwrite On Recall", "icon_classes": ["fa fa-cloud fa-stack-2x text-primary", "fa fa-caret-down fa-stack-2x text-light"], "filter_rules": [{"type": "all", "state": "all", "action": [{"name": "dynamo.tasks.reverse_stub", "site": "*destinationsite", "overwrite": true}]}], "fields": [{"name": "destinationsite", "type": "enum[site]", "label": "Destination Site", "value": "site"}]}

Import the workflow as follows

ngclient workflows import overwrite_workflow.json

8.2.1.4.5. RENAME A WORKFLOW

With the change in yaml format, using '-' to read from stdin

echo "name: overwrite_on_recall" | ngclient workflows update 6 -

8.2.1.4.6. DELETE A WORKFLOW

ngclient workflows delete 6

8.2.1.5. AVAILABILITY

Distributed as part of the ngenea-hub-client rpm, or the ngclient wheel (Python) for non-Red Hat based systems.

The ngclient wheel can be installed and run on any operating system.

8.2.1.6. SEE ALSO

ngclient(1), ngenea-client.conf(5)

8.2.1.7. LICENSE

2021 ArcaPix Limited

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.