FINBOURNE Workflow API
Project description
lusid-workflow-sdk
FINBOURNE Technology
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.1.798
- Package version: 2.0.31
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.finbourne.com
Requirements.
Python 3.7+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/finbourne/workflow-sdk-python.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/finbourne/workflow-sdk-python.git
)
Then import the package:
import lusid_workflow
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import lusid_workflow
Tests
Execute pytest
to run the tests.
Getting Started
You'll need to provide some configuration to connect to the lusid_workflow application. These can be provided using a secrets file or environment variables.
Environment variables
In order to use short lived access tokens you will need to have appropriate values set for the following environment variables:
FBN_TOKEN_URL,
FBN_LUSID_WORKFLOW_API_URL,
FBN_USERNAME,
FBN_PASSWORD,
FBN_CLIENT_ID,
FBN_CLIENT_SECRET,
FBN_ACCESS_TOKEN
To use a long lived Personal Access Token, you must provide the following environment variables:
FBN_LUSID_WORKFLOW_API_URL,
FBN_ACCESS_TOKEN
You can send your requests to lusid_workflow via a proxy, by setting FBN_PROXY_ADDRESS
.
If your proxy has basic auth enabled, you must akso supply FBN_PROXY_USERNAME
and FBN_PROXY_PASSWORD
Secrets file
In order to use short lived access tokens you will need to have appropriate values set in a secrets.json
file in the same folder as your script.
{
"api":
{
"tokenUrl":"<your-token-url>",
"lusid_workflowUrl":"<FINBOURNE-application-url>",
"username":"<your-username>",
"password":"<your-password>",
"clientId":"<your-client-id>",
"clientSecret":"<your-client-secret>",
}
}
To use a long lived Personal Access Token, you must provide a secrets.json
with the following variables:
{
"api":
{
"lusid_workflowUrl":"<FINBOURNE-application-url>",
"accessToken":"<your-access-token>"
}
}
You can send your requests to lusid_workflow via a proxy, by adding a proxy section to your secrets.json
.
If your proxy has basic auth enabled, you must also supply a username
and password
in this section.
{
"api":
{
"lusid_workflowUrl":"<FINBOURNE-application-url>",
"accessToken":"<your-access-token>"
},
"proxy":
{
"address":"<your-proxy-address>",
"username":"<your-proxy-username>",
"password":"<your-proxy-password>"
}
}
Using the SDK
Please follow the installation procedure and then run the following:
import time
import lusid_workflow
from lusid_workflow.exceptions import ApiException
from pprint import pprint
import os
from lusid_workflow import (
ApiClientFactory,
TaskDefinitionsApi,
EnvironmentVariablesConfigurationLoader,
SecretsFileConfigurationLoader,
ArgsConfigurationLoader
)
# Use the lusid_workflow ApiClientFactory to build Api instances with a configured api client
# By default this will read config from environment variables
# Then from a secrets.json file found in the current working directory
api_client_factory = ApiClientFactory()
# The ApiClientFactory can be passed an iterable of configuration loaders to read configuration from
api_url = "https://fbn-prd.lusid.com/workflow"
# Path to a secrets.json file containing authentication credentials
# See https://support.lusid.com/knowledgebase/article/KA-01667/en-us
# for a detailed guide to setting up the SDK make authenticated calls to LUSID APIs
secrets_path = os.getenv("FBN_SECRETS_PATH")
app_name="LusidJupyterNotebook"
config_loaders = [
EnvironmentVariablesConfigurationLoader(),
SecretsFileConfigurationLoader(api_secrets_file=secrets_path),
ArgsConfigurationLoader(api_url=api_url, app_name=app_name)
]
api_client_factory = ApiClientFactory(config_loaders=config_loaders)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Enter a context with an instance of the ApiClientFactory to ensure the connection pool is closed after use
async with api_client_factory:
# Create an instance of the API class
api_instance = api_client_factory.build(TaskDefinitionsApi)
create_task_definition_request = {"id":{"scope":"A1","code":"ZZZ"},"displayName":"An example TaskDefinition","description":"Test","states":[{"name":"Submitted"},{"name":"InProgress"},{"name":"SendingSurvey"},{"name":"Done"},{"name":"SurveyNotSent"},{"name":"NotDone"}],"fieldSchema":[{"name":"clientId","type":"String"},{"name":"assignee","type":"String"},{"name":"resolutionDetail","type":"String"}],"initialState":{"name":"Submitted","requiredFields":["clientId"]},"triggers":[{"name":"start","trigger":{"type":"External"}},{"name":"cancel","trigger":{"type":"External"}},{"name":"resolve","trigger":{"type":"External"}},{"name":"timeout","trigger":{"type":"External"}},{"name":"success","trigger":{"type":"External"}},{"name":"failure","trigger":{"type":"External"}}],"transitions":[{"fromState":"Submitted","toState":"InProgress","trigger":"start","guard":"fields['assignee'] exists AND fields['assignee'] NOT eq ''"},{"fromState":"InProgress","toState":"SendingSurvey","trigger":"resolve","guard":"fields['resolutionDetail'] exists AND fields['resolutionDetail'] NOT eq ''","action":"health-check"},{"fromState":"SendingSurvey","toState":"Done","trigger":"success"},{"fromState":"SendingSurvey","toState":"SurveyNotSent","trigger":"failure"},{"fromState":"SendingSurvey","toState":"NotDone","trigger":"timeout"},{"fromState":"InProgress","toState":"NotDone","trigger":"cancel","guard":"fields['cancellationDetail'] exists AND fields['cancellationDetail'] NOT eq ''"}],"actions":[{"name":"health-check","runAsUserId":"user-id","actionDetails":{"type":"RunWorker","workerId":{"scope":"Health","code":"HealthCheckWorker"},"workerAsAt":"2022-01-01T01:02:03.0000000+00:00","workerParameters":{},"workerStatusTriggers":{"started":null,"completedWithResults":null,"completedNoResults":null,"failedToStart":null,"failedToComplete":null},"childTaskConfigurations":[{"taskDefinitionId":{"scope":"AAA","code":"BBB"},"mapStackingKeyFrom":null,"childTaskFields":{"assignee":{"mapFrom":"foo","setTo":"bar"}},"resultMatchingPattern":null,"taskDefinitionAsAt":null,"initialTrigger":"test-trigger"}]}}]} # CreateTaskDefinitionRequest | The data to create a Task Definition
try:
# [EXPERIMENTAL] CreateTaskDefinition: Create a new Task Definition
api_response = await api_instance.create_task_definition(create_task_definition_request)
print("The response of TaskDefinitionsApi->create_task_definition:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling TaskDefinitionsApi->create_task_definition: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://fbn-prd.lusid.com/workflow
Class | Method | HTTP request | Description |
---|---|---|---|
TaskDefinitionsApi | create_task_definition | POST /api/taskdefinitions | [EXPERIMENTAL] CreateTaskDefinition: Create a new Task Definition |
TaskDefinitionsApi | delete_task_definition | DELETE /api/taskdefinitions/{scope}/{code} | [EXPERIMENTAL] DeleteTaskDefinition: Delete a Task Definition |
TaskDefinitionsApi | get_task_definition | GET /api/taskdefinitions/{scope}/{code} | [EXPERIMENTAL] GetTaskDefinition: Get a Task Definition |
TaskDefinitionsApi | list_task_definitions | GET /api/taskdefinitions | [EXPERIMENTAL] ListTaskDefinitions: List Task Definitions |
TaskDefinitionsApi | list_tasks_for_task_definition | GET /api/taskdefinitions/{scope}/{code}/tasks | [EXPERIMENTAL] ListTasksForTaskDefinition: List Tasks for a Task Definition |
TaskDefinitionsApi | update_task_definition | PUT /api/taskdefinitions/{scope}/{code} | [EXPERIMENTAL] UpdateTaskDefinition: Update an existing Task Definition |
TasksApi | create_task | POST /api/tasks | [EXPERIMENTAL] CreateTask: Create a new Task |
TasksApi | delete_task | DELETE /api/tasks/{id} | [EXPERIMENTAL] DeleteTask: Delete a Task |
TasksApi | get_task | GET /api/tasks/{id} | [EXPERIMENTAL] GetTask: Get a Task |
TasksApi | list_tasks | GET /api/tasks | [EXPERIMENTAL] ListTasks: List Tasks |
TasksApi | update_task | POST /api/tasks/{id} | [EXPERIMENTAL] UpdateTask: Update a Task |
WorkersApi | create_worker | POST /api/workers | [EXPERIMENTAL] CreateWorker: Create a new Worker |
WorkersApi | delete_worker | DELETE /api/workers/{scope}/{code} | [EXPERIMENTAL] DeleteWorker: Delete a Worker |
WorkersApi | get_worker | GET /api/workers/{scope}/{code} | [EXPERIMENTAL] GetWorker: Get a Worker |
WorkersApi | get_worker_result | GET /api/workers/{runId}/$result | [EXPERIMENTAL] GetWorkerResult: Get the status of a specific run of a worker with any relevant results |
WorkersApi | list_workers | GET /api/workers | [EXPERIMENTAL] ListWorkers: List Workers |
WorkersApi | run_worker | POST /api/workers/{scope}/{code}/$run | [EXPERIMENTAL] RunWorker: Run a Worker |
WorkersApi | update_worker | PUT /api/workers/{scope}/{code} | [EXPERIMENTAL] UpdateWorker: Update a Worker |
Documentation For Models
- ActionDefinition
- ActionDefinitionResponse
- ActionDetails
- ActionDetailsResponse
- CreateChildTaskConfiguration
- CreateChildTasksAction
- CreateChildTasksActionResponse
- CreateTaskDefinitionRequest
- CreateTaskRequest
- CreateWorkerRequest
- DeletedEntityResponse
- Fail
- FailResponse
- FieldMapping
- GetWorkerResultResponse
- HealthCheck
- HealthCheckResponse
- InitialState
- Link
- LuminesceView
- LuminesceViewResponse
- LusidProblemDetails
- LusidValidationProblemDetails
- PagedResourceListOfTask
- PagedResourceListOfTaskDefinition
- PagedResourceListOfWorker
- Parameter
- ParameterValue
- ResourceId
- ResourceListOfTask
- ResultField
- ResultMatchingPattern
- ResultantChildTaskConfiguration
- RunWorkerAction
- RunWorkerActionResponse
- RunWorkerRequest
- RunWorkerResponse
- Sleep
- SleepResponse
- Stack
- Task
- TaskDefinition
- TaskDefinitionVersion
- TaskFieldDefinition
- TaskInstanceField
- TaskStateDefinition
- TaskSummary
- TaskTransitionDefinition
- TransitionTriggerDefinition
- TriggerParentTaskAction
- TriggerParentTaskActionResponse
- TriggerSchema
- UpdateTaskDefinitionRequest
- UpdateTaskRequest
- UpdateWorkerRequest
- VersionInfo
- Worker
- WorkerConfiguration
- WorkerConfigurationResponse
- WorkerStatusTriggers
Documentation For Authorization
Authentication schemes defined for the API:
oauth2
- Type: OAuth
- Flow: implicit
- Authorization URL: https://lusid.okta.com/oauth2/default/v1/authorize
- Scopes: N/A
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lusid_workflow_sdk-2.0.31.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2930344afe405dc9d6be13978fad9f09e6ead1f31dfecb4221962d6795a0c070 |
|
MD5 | 5d44b26dd4ee3f66b7032486d61b8b5b |
|
BLAKE2b-256 | 8ff2ad62e9ca9f6f61e6f36ee91d5f5c8963d1fe12eaae63ce972a42dce4ee5e |
Hashes for lusid_workflow_sdk-2.0.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30219a1936670d7ffdaeaf4ece908581abafea8b1ed19803a36f4692d6ad3598 |
|
MD5 | 1634e7e3a18d40cf49101a8725dd10e6 |
|
BLAKE2b-256 | cf8e8c13ca9a0ab781488da9a2600c5a93e843756c1814eacb5486a2b0a5af82 |