congress.datasources.mistral_driver module

congress.datasources.mistral_driver module

Mistral Driver for Congress

This driver allows the creation of Congress datasources that interfaces with Mistral workflows service. The Congress datasource reflects as Congress tables the Mistral data on workflows, workflow executions, actions, and action executions. The datasource also supports the triggering of Mistral APIs such as initiation of a workflows or actions. The triggering of workflows or actions is especially useful for creating Congress policies that take remedial action.

Datasource creation CLI example: $ openstack congress datasource create mistral mistral_datasource –config username=admin –config tenant_name=admin –config auth_url=http://127.0.0.1/identity –config password=password

class congress.datasources.mistral_driver.MistralDriver(name='', args=None)

Bases: congress.datasources.datasource_driver.PollingDataSourceDriver, congress.datasources.datasource_driver.ExecutionDriver

ACTIONS = 'actions'
ACTION_EXECUTIONS = 'action_executions'
TRANSLATORS = [{'table-name': 'workflows', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'scope'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'namespace'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'project_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'definition'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}), 'selector-type': 'DOT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'actions', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'is_system'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'definition'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'scope'}), 'selector-type': 'DOT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'workflow_executions', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state_info'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_namespace'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'params'}), 'selector-type': 'DOT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'action_executions', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state_info'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'task_execution_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'task_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'accepted'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_namespace'}), 'selector-type': 'DOT_SELECTOR', 'translation-type': 'HDICT'}]
WORKFLOWS = 'workflows'
WORKFLOW_EXECUTIONS = 'workflow_executions'
action_executions_translator = {'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state_info'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'task_execution_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'task_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'accepted'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_namespace'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'action_executions', 'translation-type': 'HDICT'}
actions_translator = {'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'is_system'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'definition'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'scope'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'actions', 'translation-type': 'HDICT'}
execute(action, action_args)

Overwrite ExecutionDriver.execute().

static get_datasource_info()
initialize_update_method()
value_trans = {'translation-type': 'VALUE'}
workflow_executions_translator = {'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state_info'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'workflow_namespace'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'params'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'workflow_executions', 'translation-type': 'HDICT'}
workflows_translator = {'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'scope'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'input'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'namespace'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'project_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'created_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'updated_at'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'definition'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'description'}), 'selector-type': 'DOT_SELECTOR', 'table-name': 'workflows', 'translation-type': 'HDICT'}
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.