Package: lusid-workflow-sdk
lusid-workflow-sdkFINBOURNE TechnologyThis Python package is automatically generated by theOpenAPI Generatorproject:API version: 0.1.782Package version: 2.0.25Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visithttps://www.finbourne.comRequirements.Python 3.7+Installation & Usagepip installIf the python package is hosted on a repository, you can install directly using:pipinstallgit+https://github.com/finbourne/workflow-sdk-python.git(you may need to runpipwith root permission:sudo pip install git+https://github.com/finbourne/workflow-sdk-python.git)Then import the package:importlusid_workflowSetuptoolsInstall viaSetuptools.pythonsetup.pyinstall--user(orsudo python setup.py installto install the package for all users)Then import the package:importlusid_workflowTestsExecutepytestto run the tests.Getting StartedYou'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 variablesIn order to useshort lived access tokensyou 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_TOKENTo use a long lived Personal Access Token, you must provide the following environment variables:FBN_LUSID_WORKFLOW_API_URL,
FBN_ACCESS_TOKENYou can send your requests to lusid_workflow via a proxy, by settingFBN_PROXY_ADDRESS.
If your proxy has basic auth enabled, you must akso supplyFBN_PROXY_USERNAMEandFBN_PROXY_PASSWORDSecrets fileIn order to useshort lived access tokensyou will need to have appropriate values set in asecrets.jsonfile 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 asecrets.jsonwith 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 yoursecrets.json.
If your proxy has basic auth enabled, you must also supply ausernameandpasswordin 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 SDKPlease follow theinstallation procedureand then run the following:importtimeimportlusid_workflowfromlusid_workflow.exceptionsimportApiExceptionfrompprintimportpprintimportosfromlusid_workflowimport(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 directoryapi_client_factory=ApiClientFactory()# The ApiClientFactory can be passed an iterable of configuration loaders to read configuration fromapi_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 APIssecrets_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 useasyncwithapi_client_factory:# Create an instance of the API classapi_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","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 Definitiontry:# [EXPERIMENTAL] CreateTaskDefinition: Create a new Task Definitionapi_response=awaitapi_instance.create_task_definition(create_task_definition_request)print("The response of TaskDefinitionsApi->create_task_definition:\n")pprint(api_response)exceptApiExceptionase:print("Exception when calling TaskDefinitionsApi->create_task_definition:%s\n"%e)Documentation for API EndpointsAll URIs are relative tohttps://fbn-prd.lusid.com/workflowClassMethodHTTP requestDescriptionTaskDefinitionsApicreate_task_definitionPOST/api/taskdefinitions[EXPERIMENTAL] CreateTaskDefinition: Create a new Task DefinitionTaskDefinitionsApidelete_task_definitionDELETE/api/taskdefinitions/{scope}/{code}[EXPERIMENTAL] DeleteTaskDefinition: Delete a Task DefinitionTaskDefinitionsApiget_task_definitionGET/api/taskdefinitions/{scope}/{code}[EXPERIMENTAL] GetTaskDefinition: Get a Task DefinitionTaskDefinitionsApilist_task_definitionsGET/api/taskdefinitions[EXPERIMENTAL] ListTaskDefinitions: List Task DefinitionsTaskDefinitionsApilist_tasks_for_task_definitionGET/api/taskdefinitions/{scope}/{code}/tasks[EXPERIMENTAL] ListTasksForTaskDefinition: List Tasks for a Task DefinitionTaskDefinitionsApiupdate_task_definitionPUT/api/taskdefinitions/{scope}/{code}[EXPERIMENTAL] UpdateTaskDefinition: Update an existing Task DefinitionTasksApicreate_taskPOST/api/tasks[EXPERIMENTAL] CreateTask: Create a new TaskTasksApidelete_taskDELETE/api/tasks/{id}[EXPERIMENTAL] DeleteTask: Delete a TaskTasksApiget_taskGET/api/tasks/{id}[EXPERIMENTAL] GetTask: Get a TaskTasksApilist_tasksGET/api/tasks[EXPERIMENTAL] ListTasks: List TasksTasksApiupdate_taskPOST/api/tasks/{id}[EXPERIMENTAL] UpdateTask: Update a TaskWorkersApicreate_workerPOST/api/workers[EXPERIMENTAL] CreateWorker: Create a new WorkerWorkersApidelete_workerDELETE/api/workers/{scope}/{code}[EXPERIMENTAL] DeleteWorker: Delete a WorkerWorkersApiget_workerGET/api/workers/{scope}/{code}[EXPERIMENTAL] GetWorker: Get a WorkerWorkersApiget_worker_resultGET/api/workers/{runId}/$result[EXPERIMENTAL] GetWorkerResult: Get the status of a specific run of a worker with any relevant resultsWorkersApilist_workersGET/api/workers[EXPERIMENTAL] ListWorkers: List WorkersWorkersApirun_workerPOST/api/workers/{scope}/{code}/$run[EXPERIMENTAL] RunWorker: Run a WorkerWorkersApiupdate_workerPUT/api/workers/{scope}/{code}[EXPERIMENTAL] UpdateWorker: Update a WorkerDocumentation For ModelsActionDefinitionActionDefinitionResponseActionDetailsActionDetailsResponseCreateChildTaskConfigurationCreateChildTasksActionCreateChildTasksActionResponseCreateTaskDefinitionRequestCreateTaskRequestCreateWorkerRequestDeletedEntityResponseFailFailResponseFieldMappingGetWorkerResultResponseHealthCheckHealthCheckResponseInitialStateLinkLuminesceViewLuminesceViewResponseLusidProblemDetailsLusidValidationProblemDetailsPagedResourceListOfTaskPagedResourceListOfTaskDefinitionPagedResourceListOfWorkerParameterParameterValueResourceIdResourceListOfTaskResultFieldResultMatchingPatternResultantChildTaskConfigurationRunWorkerActionRunWorkerActionResponseRunWorkerRequestRunWorkerResponseSleepSleepResponseStackTaskTaskDefinitionTaskDefinitionVersionTaskFieldDefinitionTaskInstanceFieldTaskStateDefinitionTaskSummaryTaskTransitionDefinitionTransitionTriggerDefinitionTriggerParentTaskActionTriggerParentTaskActionResponseTriggerSchemaUpdateTaskDefinitionRequestUpdateTaskRequestUpdateWorkerRequestVersionInfoWorkerWorkerConfigurationWorkerConfigurationResponseWorkerStatusTriggersDocumentation For AuthorizationAuthentication schemes defined for the API:oauth2Type: OAuthFlow: implicitAuthorization URL:https://lusid.okta.com/oauth2/default/v1/authorizeScopes: N/AAuthorinfo@finbourne.com