azure.purview.workflow package¶
-
class
azure.purview.workflow.
PurviewWorkflowClient
(endpoint: str, credential: TokenCredential, **kwargs: Any)[source]¶ Workflows are automated, repeatable business processes which allow organizations to track changes, enforce policy compliance, and ensure quality data across their data landscape.Workflow service is a micro service within Microsoft Purview to validate and orchestrate CUD (create, update, delete) operations on their data entities. This spec defines REST API of Purview Workflow Service, which could used for creating Purview workflow client.
- Parameters
endpoint (str) – The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. Required.
credential (TokenCredential) – Credential needed for the client to connect to Azure. Required.
- Keyword Arguments
api_version (str) – Api Version. Default value is “2022-05-01-preview”. Note that overriding this default value may result in unsupported behavior.
-
approve_approval_task
(task_id: str, approval_response_comment: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → None¶ Approve an approval task.
- Parameters
task_id (str) – The task id. Required.
approval_response_comment (JSON or IO) – The request body of approving an approval request. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
None
- Return type
- Raises
-
cancel_workflow_run
(workflow_run_id: str, run_cancel_reply: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → None¶ Cancel a workflow run.
- Parameters
workflow_run_id (str) – The workflow run id. Required.
run_cancel_reply (JSON or IO) – Reply of canceling a workflow run. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
None
- Return type
- Raises
-
create_or_replace_workflow
(workflow_id: str, workflow_create_or_update_command: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Create or replace a workflow.
- Parameters
workflow_id (str) – The workflow id. Required.
workflow_create_or_update_command (JSON or IO) – Create or update workflow payload. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "actionDag": {}, # The action DAG(Directed Acyclic Graph), it defines steps to be executed in a workflow run and their order. Required. "description": "str", # Description of a workflow. Required. "id": "str", # The id of workflow. Required. "isEnabled": bool, # Whether the workflow is enabled or not. Required. "name": "str", # The name of a workflow. Required. "triggers": [ { "type": "str", # Required. Known values are: "when_term_creation_is_requested", "when_term_deletion_is_requested", "when_term_update_is_requested", "when_terms_import_is_requested", "when_data_access_grant_is_requested", and "when_asset_update_is_requested". "underCollection": "str", # Optional. The collection name. "underGlossary": "str", # Optional. The glossary guid. "underGlossaryHierarchy": "str" # Optional. Glossary term hierarchy path. } ], "createdBy": "str", # Optional. The person who created the workflow. "createdTime": "2020-02-20 00:00:00", # Optional. The created time of workflow. "lastUpdateTime": "2020-02-20 00:00:00", # Optional. The last update time. "updatedBy": "str" # Optional. The person who updated the workflow. }
-
delete_workflow
(workflow_id: str, **kwargs: Any) → None¶ Delete a workflow.
- Parameters
workflow_id (str) – The workflow id. Required.
- Returns
None
- Return type
- Raises
-
get_workflow
(workflow_id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Get a specific workflow.
- Parameters
workflow_id (str) – The workflow id. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "actionDag": {}, # The action DAG(Directed Acyclic Graph), it defines steps to be executed in a workflow run and their order. Required. "description": "str", # Description of a workflow. Required. "id": "str", # The id of workflow. Required. "isEnabled": bool, # Whether the workflow is enabled or not. Required. "name": "str", # The name of a workflow. Required. "triggers": [ { "type": "str", # Required. Known values are: "when_term_creation_is_requested", "when_term_deletion_is_requested", "when_term_update_is_requested", "when_terms_import_is_requested", "when_data_access_grant_is_requested", and "when_asset_update_is_requested". "underCollection": "str", # Optional. The collection name. "underGlossary": "str", # Optional. The glossary guid. "underGlossaryHierarchy": "str" # Optional. Glossary term hierarchy path. } ], "createdBy": "str", # Optional. The person who created the workflow. "createdTime": "2020-02-20 00:00:00", # Optional. The created time of workflow. "lastUpdateTime": "2020-02-20 00:00:00", # Optional. The last update time. "updatedBy": "str" # Optional. The person who updated the workflow. }
-
get_workflow_run
(workflow_run_id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Get a workflow run.
- Parameters
workflow_run_id (str) – The workflow run id. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "actionDag": {}, # The action DAG(Directed Acyclic Graph), it defines actual flow. Required. "detail": { "actions": {}, # Any object. Required. "runInput": {} # Built-in variables starts with @runInput. Its properties are determined by trigger type at workflow run time. Required. }, "cancelComment": "str", # Optional. The comment when cancel a workflow run. "cancelTime": "2020-02-20 00:00:00", # Optional. The time of workflow run be canceled. "endTime": "2020-02-20 00:00:00", # Optional. The time of workflow run completed. "id": "str", # Optional. The workflow run id. "requestor": "str", # Optional. The person who submitted the user request. "runPayload": { "payload": {}, # The payload of each operation which user want to submit. Required. "targetValue": "str", # The target value which need involve workflow to update. Required. "type": "str" # The workflow run payload type. Required. Known values are: "CreateTerm", "UpdateTerm", "DeleteTerm", "ImportTerms", "UpdateAsset", and "GrantDataAccess". }, "startTime": "2020-02-20 00:00:00", # Optional. Workflow run start time. "status": "str", # Optional. The status. Known values are: "NotStarted", "InProgress", "Failed", "Completed", "Canceling", "CancellationFailed", and "Canceled". "userRequestId": "str", # Optional. The user request id. "workflowId": "str" # Optional. The workflow id. }
-
get_workflow_task
(task_id: str, **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Get a workflow task.
- Parameters
task_id (str) – The task id. Required.
- Returns
JSON object
- Return type
JSON
- Raises
Example
-
list_workflow_runs
(*, time_window: Optional[str] = None, orderby: Optional[str] = None, run_statuses: Optional[List[str]] = None, workflow_ids: Optional[List[str]] = None, **kwargs: Any) → Iterable[collections.abc.MutableMapping[str, Any]]¶ List workflow runs.
- Keyword Arguments
time_window (str) – Time window of filtering items. Known values are: “1d”, “7d”, “30d”, and “90d”. Default value is None.
orderby (str) – The key word which used to sort the results. Known values are: “status desc”, “status asc”, “requestor desc”, “requestor asc”, “startTime desc”, “startTime asc”, “createdTime desc”, and “createdTime asc”. Default value is None.
run_statuses (list[str]) – Filter workflow runs by workflow run status. Default value is None.
workflow_ids (list[str]) – Filter items by workflow id list. Default value is None.
- Returns
An iterator like instance of JSON object
- Return type
ItemPaged[JSON]
- Raises
Example
# response body for status code(s): 200 response == { "id": "str", # The workflow run id. Required. "requestor": "str", # The person who submitted the user request. Required. "runPayload": { "targetValue": "str", # The target value which need involve workflow to update. Required. "type": "str" # The workflow run payload type. Required. Known values are: "CreateTerm", "UpdateTerm", "DeleteTerm", "ImportTerms", "UpdateAsset", and "GrantDataAccess". }, "startTime": "2020-02-20 00:00:00", # Workflow run start time. Required. "status": "str", # The status. Required. Known values are: "NotStarted", "InProgress", "Failed", "Completed", "Canceling", "CancellationFailed", and "Canceled". "workflowId": "str", # The workflow id. Required. "cancelComment": "str", # Optional. The comment when cancel a workflow run. "cancelTime": "2020-02-20 00:00:00", # Optional. The time of workflow run be canceled. "endTime": "2020-02-20 00:00:00", # Optional. The time of workflow run completed. "userRequestId": "str" # Optional. The user request id. }
-
list_workflow_tasks
(*, view_mode: Optional[str] = None, workflow_ids: Optional[List[str]] = None, time_window: Optional[str] = None, orderby: Optional[str] = None, task_types: Optional[List[str]] = None, task_statuses: Optional[List[str]] = None, workflow_name_keyword: Optional[str] = None, **kwargs: Any) → Iterable[collections.abc.MutableMapping[str, Any]]¶ Get all workflow tasks.
- Keyword Arguments
view_mode (str) – To filter user’s sent, received or history workflow tasks. Default value is None.
workflow_ids (list[str]) – Filter items by workflow id list. Default value is None.
time_window (str) – Time window of filtering items. Known values are: “1d”, “7d”, “30d”, and “90d”. Default value is None.
orderby (str) – The key word which used to sort the results. Known values are: “status desc”, “status asc”, “requestor desc”, “requestor asc”, “startTime desc”, “startTime asc”, “createdTime desc”, and “createdTime asc”. Default value is None.
task_types (list[str]) – Filter items by workflow task type. Default value is None.
task_statuses (list[str]) – Filter workflow tasks by status. Default value is None.
workflow_name_keyword (str) – The key word which could used to filter workflow item with related workflow. Default value is None.
- Returns
An iterator like instance of JSON object
- Return type
ItemPaged[JSON]
- Raises
Example
-
list_workflows
(**kwargs: Any) → Iterable[collections.abc.MutableMapping[str, Any]]¶ List all workflows.
- Returns
An iterator like instance of JSON object
- Return type
ItemPaged[JSON]
- Raises
Example
# response body for status code(s): 200 response == { "description": "str", # Description of a workflow. Required. "id": "str", # The id of workflow. Required. "isEnabled": bool, # Whether the workflow is enabled or not. Required. "name": "str", # The name of a workflow. Required. "triggers": [ { "type": "str", # Required. Known values are: "when_term_creation_is_requested", "when_term_deletion_is_requested", "when_term_update_is_requested", "when_terms_import_is_requested", "when_data_access_grant_is_requested", and "when_asset_update_is_requested". "underCollection": "str", # Optional. The collection name. "underGlossary": "str", # Optional. The glossary guid. "underGlossaryHierarchy": "str" # Optional. Glossary term hierarchy path. } ], "createdBy": "str", # Optional. The person who created the workflow. "createdTime": "2020-02-20 00:00:00", # Optional. The created time of workflow. "lastUpdateTime": "2020-02-20 00:00:00", # Optional. The last update time. "updatedBy": "str" # Optional. The person who updated the workflow. }
-
reassign_workflow_task
(task_id: str, reassign_command: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → None¶ Reassign a workflow task.
- Parameters
task_id (str) – The task id. Required.
reassign_command (JSON or IO) – The request body of reassigning a workflow task. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
None
- Return type
- Raises
-
reject_approval_task
(task_id: str, approval_response_comment: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → None¶ Reject an approval task.
- Parameters
task_id (str) – The task id. Required.
approval_response_comment (JSON or IO) – The request body of rejecting an approval request. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
None
- Return type
- Raises
-
send_request
(request: azure.core.rest._rest_py3.HttpRequest, **kwargs: Any) → azure.core.rest._rest_py3.HttpResponse[source]¶ Runs the network request through the client’s chained policies.
>>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") <HttpRequest [GET], url: 'https://www.example.org/'> >>> response = client.send_request(request) <HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
- Parameters
request (HttpRequest) – The network request you want to make. Required.
- Keyword Arguments
stream (bool) – Whether the response payload will be streamed. Defaults to False.
- Returns
The response of your network call. Does not do error handling on your response.
- Return type
-
submit_user_requests
(user_requests_payload: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → collections.abc.MutableMapping[str, Any]¶ Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow’s trigger matches with an operation in request, a run of the workflow is created.
- Parameters
user_requests_payload (JSON or IO) – The payload of submitting a user request. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
JSON object
- Return type
JSON
- Raises
Example
# response body for status code(s): 200 response == { "operations": [ { "payload": {}, # The payload of each operation which user want to submit. Required. "type": "str", # The operation type. Required. Known values are: "CreateTerm", "UpdateTerm", "DeleteTerm", "ImportTerms", "UpdateAsset", and "GrantDataAccess". "workflowRunIds": [ "str" # Optional. The list of operations user want to submit, each operation matches one Purview API call and will do the operation directly. Required. ] } ], "requestId": "str", # The user request id. Required. "requestor": "str", # The person who submitted the user request. Required. "status": "str", # The status. Required. Known values are: "NotStarted", "InProgress", "Failed", "Completed", "Canceling", "CancellationFailed", and "Canceled". "comment": "str" # Optional. The comment when submit a user request. }
-
update_task_status
(task_id: str, task_update_command: Union[collections.abc.MutableMapping[str, Any], IO], **kwargs: Any) → None¶ Update the status of a workflow task request.
- Parameters
task_id (str) – The task id. Required.
task_update_command (JSON or IO) – Request body of updating workflow task request. Is either a model type or a IO type. Required.
- Keyword Arguments
content_type (str) – Body Parameter content-type. Known values are: ‘application/json’. Default value is None.
- Returns
None
- Return type
- Raises