Provision a workflow

Provisioning a workflow is a one-time setup process usually performed by a cluster administrator to create resources that will be used by end users.

The workflows template field may contain multiple workflows. The workflow with the provision key can be executed with this API. This API is also executed when the Create or Update Workflow API is called with the provision parameter set to true.

You can only provision a workflow if it has not yet been provisioned. Deprovision the workflow if you need to repeat provisioning.

Path and HTTP methods

  1. POST /_plugins/_flow_framework/workflow/<workflow_id>/_provision

Path parameters

The following table lists the available path parameters.

ParameterData typeDescription
workflow_idStringThe ID of the workflow to be provisioned. Required.

Query parameters

If you have included a substitution expression in the template, you may pass it as a query parameter or as a string value of a request body field. For example, if you specified a credential field in a template as openAI_key: '$', then you can include the openai_key parameter as a query parameter or body field so it can be substituted during provisioning. For example, the following request provides a query parameter:

  1. POST /_plugins/_flow_framework/workflow/<workflow_id>/_provision?<parameter>=<value>
ParameterData typeDescription
User-provided substitution expressionsStringParameters matching substitution expressions in the template. Optional.

Example requests

  1. POST /_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50/_provision

copy

The following request substitutes the expression $ with the value “12345” using a query parameter:

  1. POST /_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50/_provision?openai_key=12345

copy

The following request substitutes the expression $ with the value “12345” using the request body:

  1. POST /_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50/_provision
  2. {
  3. "openai_key" : "12345"
  4. }

copy

Example response

OpenSearch responds with the same workflow_id that was used in the request:

  1. {
  2. "workflow_id" : "8xL8bowB8y25Tqfenm50"
  3. }

To obtain the provisioning status, query the Get Workflow State API.