diff --git a/.apigentools-info b/.apigentools-info index 823337415d..9bc1c026ae 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-30 17:56:17.160652", - "spec_repo_commit": "4380003d" + "regenerated": "2024-07-30 19:24:55.550204", + "spec_repo_commit": "edbd396a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-30 17:56:17.178544", - "spec_repo_commit": "4380003d" + "regenerated": "2024-07-30 19:24:55.567305", + "spec_repo_commit": "edbd396a" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d5bfe90d97..8f7bfc3166 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -358,6 +358,13 @@ components: required: true schema: type: string + InstanceId: + description: The ID of the workflow instance. + in: path + name: instance_id + required: true + schema: + type: string MetricID: description: The name of the log-based metric. in: path @@ -543,6 +550,13 @@ components: schema: example: 00000000-0000-9999-0000-000000000000 type: string + WorkflowId: + description: The ID of the workflow. + in: path + name: workflow_id + required: true + schema: + type: string requestBodies: {} responses: BadRequestResponse: @@ -23831,6 +23845,107 @@ components: - PAST_SIX_MONTHS - PAST_ONE_YEAR - ALERT + WorkflowInstanceCreateMeta: + description: Additional information for creating a workflow instance. + properties: + payload: + additionalProperties: {} + description: The input parameters to the workflow. + type: object + type: object + WorkflowInstanceCreateRequest: + description: Request used to create a workflow instance. + properties: + meta: + $ref: '#/components/schemas/WorkflowInstanceCreateMeta' + type: object + WorkflowInstanceCreateResponse: + additionalProperties: {} + description: Response returned upon successful workflow instance creation. + properties: + data: + $ref: '#/components/schemas/WorkflowInstanceCreateResponseData' + type: object + WorkflowInstanceCreateResponseData: + additionalProperties: {} + description: Data about the created workflow instance. + properties: + id: + description: The ID of the workflow execution. It can be used to fetch the + execution status. + type: string + type: object + WorkflowInstanceListItem: + additionalProperties: {} + description: An item in the workflow instances list. + properties: + id: + description: The ID of the workflow instance + type: string + type: object + WorkflowListInstancesResponse: + additionalProperties: {} + description: Response returned when listing workflow instances. + properties: + data: + description: A list of workflow instances. + items: + $ref: '#/components/schemas/WorkflowInstanceListItem' + type: array + meta: + $ref: '#/components/schemas/WorkflowListInstancesResponseMeta' + type: object + WorkflowListInstancesResponseMeta: + additionalProperties: {} + description: Metadata about the instances list + properties: + page: + $ref: '#/components/schemas/WorkflowListInstancesResponseMetaPage' + type: object + WorkflowListInstancesResponseMetaPage: + additionalProperties: {} + description: Page information for the list instances response. + properties: + totalCount: + description: The total count of items. + format: int64 + type: integer + type: object + WorklflowCancelInstanceResponse: + description: Information about the canceled instance. + properties: + data: + $ref: '#/components/schemas/WorklflowCancelInstanceResponseData' + type: object + WorklflowCancelInstanceResponseData: + description: Data about the canceled instance. + properties: + id: + description: The id of the canceled instance + type: string + type: object + WorklflowGetInstanceResponse: + additionalProperties: {} + description: The state of the given workflow instance. + properties: + data: + $ref: '#/components/schemas/WorklflowGetInstanceResponseData' + type: object + WorklflowGetInstanceResponseData: + additionalProperties: {} + description: The data of the instance response. + properties: + attributes: + $ref: '#/components/schemas/WorklflowGetInstanceResponseDataAttributes' + type: object + WorklflowGetInstanceResponseDataAttributes: + additionalProperties: {} + description: The attributes of the instance response data. + properties: + id: + description: The id of the instance. + type: string + type: object securitySchemes: AuthZ: description: This API uses OAuth 2 with the implicit grant flow. @@ -37850,6 +37965,108 @@ paths: summary: Get user memberships tags: - Teams + /api/v2/workflows/{workflow_id}/instances: + get: + description: List all instances of a given workflow. + operationId: ListWorkflowInstances + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowListInstancesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List workflow instances + tags: + - Workflow Automation + post: + description: Execute the given workflow + operationId: CreateWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceCreateResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Execute a workflow + tags: + - Workflow Automation + x-codegen-request-body-name: body + /api/v2/workflows/{workflow_id}/instances/{instance_id}: + get: + description: Get a specific execution of a given workflow. + operationId: GetWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/InstanceId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorklflowGetInstanceResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a workflow instance + tags: + - Workflow Automation + /api/v2/workflows/{workflow_id}/instances/{instance_id}/cancel: + put: + description: Cancels a specific execution of a given workflow. + operationId: CancelWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/InstanceId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorklflowCancelInstanceResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Cancel a workflow instance + tags: + - Workflow Automation security: - apiKeyAuth: [] appKeyAuth: [] @@ -38221,4 +38438,9 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users +- description: Automate your teams operational processes with Datadog Workflow Automation. + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/service_management/workflows/ + name: Workflow Automation x-group-parameters: true diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index af038c4305..0e8f92c6f1 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -361,6 +361,13 @@ datadog\_api\_client.v2.api.users\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.workflow\_automation\_api module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.api.workflow_automation_api + :members: + :show-inheritance: + Module contents --------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index afcaacd3b6..ceed60ad91 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -10721,6 +10721,97 @@ datadog\_api\_client.v2.model.widget\_live\_span module :members: :show-inheritance: +datadog\_api\_client.v2.model.workflow\_instance\_create\_meta module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_instance_create_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_instance\_create\_request module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.workflow_instance_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_instance\_create\_response module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_instance_create_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_instance\_create\_response\_data module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_instance_create_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_instance\_list\_item module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_instance_list_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_list\_instances\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.workflow_list_instances_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_list\_instances\_response\_meta module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.workflow_list_instances_response_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_list\_instances\_response\_meta\_page module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.workflow_list_instances_response_meta_page + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.worklflow\_cancel\_instance\_response module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.worklflow_cancel_instance_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.worklflow\_cancel\_instance\_response\_data module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.worklflow_cancel_instance_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.worklflow\_get\_instance\_response module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.worklflow_get_instance_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.worklflow\_get\_instance\_response\_data module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.worklflow_get_instance_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.worklflow\_get\_instance\_response\_data\_attributes module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.worklflow_get_instance_response_data_attributes + :members: + :show-inheritance: + Module contents --------------- diff --git a/examples/v2/workflow-automation/CancelWorkflowInstance.py b/examples/v2/workflow-automation/CancelWorkflowInstance.py new file mode 100644 index 0000000000..bc0d48f602 --- /dev/null +++ b/examples/v2/workflow-automation/CancelWorkflowInstance.py @@ -0,0 +1,16 @@ +""" +Cancel a workflow instance returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.cancel_workflow_instance( + workflow_id="ccf73164-1998-4785-a7a3-8d06c7e5f558", + instance_id="305a472b-71ab-4ce8-8f8d-75db635627b5", + ) + + print(response) diff --git a/examples/v2/workflow-automation/CreateWorkflowInstance.py b/examples/v2/workflow-automation/CreateWorkflowInstance.py new file mode 100644 index 0000000000..1aa9bb324a --- /dev/null +++ b/examples/v2/workflow-automation/CreateWorkflowInstance.py @@ -0,0 +1,21 @@ +""" +Execute a workflow returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi +from datadog_api_client.v2.model.workflow_instance_create_meta import WorkflowInstanceCreateMeta +from datadog_api_client.v2.model.workflow_instance_create_request import WorkflowInstanceCreateRequest + +body = WorkflowInstanceCreateRequest( + meta=WorkflowInstanceCreateMeta( + payload=dict([("input", "value")]), + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.create_workflow_instance(workflow_id="ccf73164-1998-4785-a7a3-8d06c7e5f558", body=body) + + print(response) diff --git a/examples/v2/workflow-automation/GetWorkflowInstance.py b/examples/v2/workflow-automation/GetWorkflowInstance.py new file mode 100644 index 0000000000..2bd6e4e92a --- /dev/null +++ b/examples/v2/workflow-automation/GetWorkflowInstance.py @@ -0,0 +1,16 @@ +""" +Get a workflow instance returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.get_workflow_instance( + workflow_id="ccf73164-1998-4785-a7a3-8d06c7e5f558", + instance_id="305a472b-71ab-4ce8-8f8d-75db635627b5", + ) + + print(response) diff --git a/examples/v2/workflow-automation/ListWorkflowInstances.py b/examples/v2/workflow-automation/ListWorkflowInstances.py new file mode 100644 index 0000000000..424c34bab1 --- /dev/null +++ b/examples/v2/workflow-automation/ListWorkflowInstances.py @@ -0,0 +1,15 @@ +""" +List workflow instances returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.list_workflow_instances( + workflow_id="ccf73164-1998-4785-a7a3-8d06c7e5f558", + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/workflow_automation_api.py b/src/datadog_api_client/v2/api/workflow_automation_api.py new file mode 100644 index 0000000000..b866807baa --- /dev/null +++ b/src/datadog_api_client/v2/api/workflow_automation_api.py @@ -0,0 +1,241 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.workflow_list_instances_response import WorkflowListInstancesResponse +from datadog_api_client.v2.model.workflow_instance_create_response import WorkflowInstanceCreateResponse +from datadog_api_client.v2.model.workflow_instance_create_request import WorkflowInstanceCreateRequest +from datadog_api_client.v2.model.worklflow_get_instance_response import WorklflowGetInstanceResponse +from datadog_api_client.v2.model.worklflow_cancel_instance_response import WorklflowCancelInstanceResponse + + +class WorkflowAutomationApi: + """ + Automate your teams operational processes with Datadog Workflow Automation. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._cancel_workflow_instance_endpoint = _Endpoint( + settings={ + "response_type": (WorklflowCancelInstanceResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/instances/{instance_id}/cancel", + "operation_id": "cancel_workflow_instance", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "instance_id": { + "required": True, + "openapi_types": (str,), + "attribute": "instance_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._create_workflow_instance_endpoint = _Endpoint( + settings={ + "response_type": (WorkflowInstanceCreateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/instances", + "operation_id": "create_workflow_instance", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WorkflowInstanceCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._get_workflow_instance_endpoint = _Endpoint( + settings={ + "response_type": (WorklflowGetInstanceResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/instances/{instance_id}", + "operation_id": "get_workflow_instance", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "instance_id": { + "required": True, + "openapi_types": (str,), + "attribute": "instance_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_workflow_instances_endpoint = _Endpoint( + settings={ + "response_type": (WorkflowListInstancesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/instances", + "operation_id": "list_workflow_instances", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + def cancel_workflow_instance( + self, + workflow_id: str, + instance_id: str, + ) -> WorklflowCancelInstanceResponse: + """Cancel a workflow instance. + + Cancels a specific execution of a given workflow. + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :param instance_id: The ID of the workflow instance. + :type instance_id: str + :rtype: WorklflowCancelInstanceResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + kwargs["instance_id"] = instance_id + + return self._cancel_workflow_instance_endpoint.call_with_http_info(**kwargs) + + def create_workflow_instance( + self, + workflow_id: str, + body: WorkflowInstanceCreateRequest, + ) -> WorkflowInstanceCreateResponse: + """Execute a workflow. + + Execute the given workflow + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :type body: WorkflowInstanceCreateRequest + :rtype: WorkflowInstanceCreateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + kwargs["body"] = body + + return self._create_workflow_instance_endpoint.call_with_http_info(**kwargs) + + def get_workflow_instance( + self, + workflow_id: str, + instance_id: str, + ) -> WorklflowGetInstanceResponse: + """Get a workflow instance. + + Get a specific execution of a given workflow. + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :param instance_id: The ID of the workflow instance. + :type instance_id: str + :rtype: WorklflowGetInstanceResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + kwargs["instance_id"] = instance_id + + return self._get_workflow_instance_endpoint.call_with_http_info(**kwargs) + + def list_workflow_instances( + self, + workflow_id: str, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + ) -> WorkflowListInstancesResponse: + """List workflow instances. + + List all instances of a given workflow. + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :param page_size: Size for a given page. The maximum allowed value is 100. + :type page_size: int, optional + :param page_number: Specific page number to return. + :type page_number: int, optional + :rtype: WorkflowListInstancesResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + return self._list_workflow_instances_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index c5b135f42e..286ee7f057 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -49,6 +49,7 @@ from datadog_api_client.v2.api.teams_api import TeamsApi from datadog_api_client.v2.api.usage_metering_api import UsageMeteringApi from datadog_api_client.v2.api.users_api import UsersApi +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi __all__ = [ @@ -103,4 +104,5 @@ "TeamsApi", "UsageMeteringApi", "UsersApi", + "WorkflowAutomationApi", ] diff --git a/src/datadog_api_client/v2/model/workflow_instance_create_meta.py b/src/datadog_api_client/v2/model/workflow_instance_create_meta.py new file mode 100644 index 0000000000..b4910cdc9f --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_instance_create_meta.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WorkflowInstanceCreateMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "payload": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + } + + attribute_map = { + "payload": "payload", + } + + def __init__(self_, payload: Union[Dict[str, Any], UnsetType] = unset, **kwargs): + """ + Additional information for creating a workflow instance. + + :param payload: The input parameters to the workflow. + :type payload: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + """ + if payload is not unset: + kwargs["payload"] = payload + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_instance_create_request.py b/src/datadog_api_client/v2/model/workflow_instance_create_request.py new file mode 100644 index 0000000000..699e244847 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_instance_create_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_instance_create_meta import WorkflowInstanceCreateMeta + + +class WorkflowInstanceCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_instance_create_meta import WorkflowInstanceCreateMeta + + return { + "meta": (WorkflowInstanceCreateMeta,), + } + + attribute_map = { + "meta": "meta", + } + + def __init__(self_, meta: Union[WorkflowInstanceCreateMeta, UnsetType] = unset, **kwargs): + """ + Request used to create a workflow instance. + + :param meta: Additional information for creating a workflow instance. + :type meta: WorkflowInstanceCreateMeta, optional + """ + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_instance_create_response.py b/src/datadog_api_client/v2/model/workflow_instance_create_response.py new file mode 100644 index 0000000000..26fe64d084 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_instance_create_response.py @@ -0,0 +1,63 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_instance_create_response_data import WorkflowInstanceCreateResponseData + + +class WorkflowInstanceCreateResponse(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_instance_create_response_data import ( + WorkflowInstanceCreateResponseData, + ) + + return { + "data": (WorkflowInstanceCreateResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WorkflowInstanceCreateResponseData, UnsetType] = unset, **kwargs): + """ + Response returned upon successful workflow instance creation. + + :param data: Data about the created workflow instance. + :type data: WorkflowInstanceCreateResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_instance_create_response_data.py b/src/datadog_api_client/v2/model/workflow_instance_create_response_data.py new file mode 100644 index 0000000000..07a6878b49 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_instance_create_response_data.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WorkflowInstanceCreateResponseData(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + return { + "id": (str,), + } + + attribute_map = { + "id": "id", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, **kwargs): + """ + Data about the created workflow instance. + + :param id: The ID of the workflow execution. It can be used to fetch the execution status. + :type id: str, optional + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_instance_list_item.py b/src/datadog_api_client/v2/model/workflow_instance_list_item.py new file mode 100644 index 0000000000..066ee8b63e --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_instance_list_item.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WorkflowInstanceListItem(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + return { + "id": (str,), + } + + attribute_map = { + "id": "id", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, **kwargs): + """ + An item in the workflow instances list. + + :param id: The ID of the workflow instance + :type id: str, optional + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_list_instances_response.py b/src/datadog_api_client/v2/model/workflow_list_instances_response.py new file mode 100644 index 0000000000..eecc533a0d --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_list_instances_response.py @@ -0,0 +1,75 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_instance_list_item import WorkflowInstanceListItem + from datadog_api_client.v2.model.workflow_list_instances_response_meta import WorkflowListInstancesResponseMeta + + +class WorkflowListInstancesResponse(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_instance_list_item import WorkflowInstanceListItem + from datadog_api_client.v2.model.workflow_list_instances_response_meta import WorkflowListInstancesResponseMeta + + return { + "data": ([WorkflowInstanceListItem],), + "meta": (WorkflowListInstancesResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[WorkflowInstanceListItem], UnsetType] = unset, + meta: Union[WorkflowListInstancesResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Response returned when listing workflow instances. + + :param data: A list of workflow instances. + :type data: [WorkflowInstanceListItem], optional + + :param meta: Metadata about the instances list + :type meta: WorkflowListInstancesResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_list_instances_response_meta.py b/src/datadog_api_client/v2/model/workflow_list_instances_response_meta.py new file mode 100644 index 0000000000..f4d89e3e60 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_list_instances_response_meta.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_list_instances_response_meta_page import ( + WorkflowListInstancesResponseMetaPage, + ) + + +class WorkflowListInstancesResponseMeta(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_list_instances_response_meta_page import ( + WorkflowListInstancesResponseMetaPage, + ) + + return { + "page": (WorkflowListInstancesResponseMetaPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: Union[WorkflowListInstancesResponseMetaPage, UnsetType] = unset, **kwargs): + """ + Metadata about the instances list + + :param page: Page information for the list instances response. + :type page: WorkflowListInstancesResponseMetaPage, optional + """ + if page is not unset: + kwargs["page"] = page + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_list_instances_response_meta_page.py b/src/datadog_api_client/v2/model/workflow_list_instances_response_meta_page.py new file mode 100644 index 0000000000..e73d18ad18 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_list_instances_response_meta_page.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WorkflowListInstancesResponseMetaPage(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + return { + "total_count": (int,), + } + + attribute_map = { + "total_count": "totalCount", + } + + def __init__(self_, total_count: Union[int, UnsetType] = unset, **kwargs): + """ + Page information for the list instances response. + + :param total_count: The total count of items. + :type total_count: int, optional + """ + if total_count is not unset: + kwargs["total_count"] = total_count + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/worklflow_cancel_instance_response.py b/src/datadog_api_client/v2/model/worklflow_cancel_instance_response.py new file mode 100644 index 0000000000..45a909d9a2 --- /dev/null +++ b/src/datadog_api_client/v2/model/worklflow_cancel_instance_response.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.worklflow_cancel_instance_response_data import WorklflowCancelInstanceResponseData + + +class WorklflowCancelInstanceResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.worklflow_cancel_instance_response_data import ( + WorklflowCancelInstanceResponseData, + ) + + return { + "data": (WorklflowCancelInstanceResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WorklflowCancelInstanceResponseData, UnsetType] = unset, **kwargs): + """ + Information about the canceled instance. + + :param data: Data about the canceled instance. + :type data: WorklflowCancelInstanceResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/worklflow_cancel_instance_response_data.py b/src/datadog_api_client/v2/model/worklflow_cancel_instance_response_data.py new file mode 100644 index 0000000000..6fe402e0ce --- /dev/null +++ b/src/datadog_api_client/v2/model/worklflow_cancel_instance_response_data.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class WorklflowCancelInstanceResponseData(ModelNormal): + @cached_property + def openapi_types(_): + return { + "id": (str,), + } + + attribute_map = { + "id": "id", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, **kwargs): + """ + Data about the canceled instance. + + :param id: The id of the canceled instance + :type id: str, optional + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/worklflow_get_instance_response.py b/src/datadog_api_client/v2/model/worklflow_get_instance_response.py new file mode 100644 index 0000000000..5a6b84b7d2 --- /dev/null +++ b/src/datadog_api_client/v2/model/worklflow_get_instance_response.py @@ -0,0 +1,61 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.worklflow_get_instance_response_data import WorklflowGetInstanceResponseData + + +class WorklflowGetInstanceResponse(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.worklflow_get_instance_response_data import WorklflowGetInstanceResponseData + + return { + "data": (WorklflowGetInstanceResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[WorklflowGetInstanceResponseData, UnsetType] = unset, **kwargs): + """ + The state of the given workflow instance. + + :param data: The data of the instance response. + :type data: WorklflowGetInstanceResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/worklflow_get_instance_response_data.py b/src/datadog_api_client/v2/model/worklflow_get_instance_response_data.py new file mode 100644 index 0000000000..25b157de95 --- /dev/null +++ b/src/datadog_api_client/v2/model/worklflow_get_instance_response_data.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.worklflow_get_instance_response_data_attributes import ( + WorklflowGetInstanceResponseDataAttributes, + ) + + +class WorklflowGetInstanceResponseData(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.worklflow_get_instance_response_data_attributes import ( + WorklflowGetInstanceResponseDataAttributes, + ) + + return { + "attributes": (WorklflowGetInstanceResponseDataAttributes,), + } + + attribute_map = { + "attributes": "attributes", + } + + def __init__(self_, attributes: Union[WorklflowGetInstanceResponseDataAttributes, UnsetType] = unset, **kwargs): + """ + The data of the instance response. + + :param attributes: The attributes of the instance response data. + :type attributes: WorklflowGetInstanceResponseDataAttributes, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/worklflow_get_instance_response_data_attributes.py b/src/datadog_api_client/v2/model/worklflow_get_instance_response_data_attributes.py new file mode 100644 index 0000000000..83fb3d8788 --- /dev/null +++ b/src/datadog_api_client/v2/model/worklflow_get_instance_response_data_attributes.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class WorklflowGetInstanceResponseDataAttributes(ModelNormal): + @cached_property + def additional_properties_type(_): + return ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + + @cached_property + def openapi_types(_): + return { + "id": (str,), + } + + attribute_map = { + "id": "id", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, **kwargs): + """ + The attributes of the instance response data. + + :param id: The id of the instance. + :type id: str, optional + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 47e62bc8ed..0b6cc31bdc 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1851,6 +1851,21 @@ from datadog_api_client.v2.model.users_response import UsersResponse from datadog_api_client.v2.model.users_type import UsersType from datadog_api_client.v2.model.widget_live_span import WidgetLiveSpan +from datadog_api_client.v2.model.workflow_instance_create_meta import WorkflowInstanceCreateMeta +from datadog_api_client.v2.model.workflow_instance_create_request import WorkflowInstanceCreateRequest +from datadog_api_client.v2.model.workflow_instance_create_response import WorkflowInstanceCreateResponse +from datadog_api_client.v2.model.workflow_instance_create_response_data import WorkflowInstanceCreateResponseData +from datadog_api_client.v2.model.workflow_instance_list_item import WorkflowInstanceListItem +from datadog_api_client.v2.model.workflow_list_instances_response import WorkflowListInstancesResponse +from datadog_api_client.v2.model.workflow_list_instances_response_meta import WorkflowListInstancesResponseMeta +from datadog_api_client.v2.model.workflow_list_instances_response_meta_page import WorkflowListInstancesResponseMetaPage +from datadog_api_client.v2.model.worklflow_cancel_instance_response import WorklflowCancelInstanceResponse +from datadog_api_client.v2.model.worklflow_cancel_instance_response_data import WorklflowCancelInstanceResponseData +from datadog_api_client.v2.model.worklflow_get_instance_response import WorklflowGetInstanceResponse +from datadog_api_client.v2.model.worklflow_get_instance_response_data import WorklflowGetInstanceResponseData +from datadog_api_client.v2.model.worklflow_get_instance_response_data_attributes import ( + WorklflowGetInstanceResponseDataAttributes, +) __all__ = [ "APIErrorResponse", @@ -3388,4 +3403,17 @@ "UsersResponse", "UsersType", "WidgetLiveSpan", + "WorkflowInstanceCreateMeta", + "WorkflowInstanceCreateRequest", + "WorkflowInstanceCreateResponse", + "WorkflowInstanceCreateResponseData", + "WorkflowInstanceListItem", + "WorkflowListInstancesResponse", + "WorkflowListInstancesResponseMeta", + "WorkflowListInstancesResponseMetaPage", + "WorklflowCancelInstanceResponse", + "WorklflowCancelInstanceResponseData", + "WorklflowGetInstanceResponse", + "WorklflowGetInstanceResponseData", + "WorklflowGetInstanceResponseDataAttributes", ] diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.frozen new file mode 100644 index 0000000000..3b73466a4c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:57.489Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.yaml new file mode 100644 index 0000000000..55337d5b58 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/workflows/malformed/instances/malformed/cancel + response: + body: + string: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value + is invalid for field workflow_id"}]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.frozen new file mode 100644 index 0000000000..674a620d56 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:57.698Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.yaml new file mode 100644 index 0000000000..96c3689b6a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_not_found_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/workflows/0233a3b7-b7ba-425e-a8cc-375ca2020b5b/instances/e0c64dc8-f946-4ae8-8d79-54569031ce67/cancel + response: + body: + string: '{"errors":[{"code":"INSTANCE_NOT_FOUND","detail":"instance e0c64dc8-f946-4ae8-8d79-54569031ce67 + not found"}]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.frozen new file mode 100644 index 0000000000..a62f2698f1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:57.827Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.yaml new file mode 100644 index 0000000000..1daa5fc0c9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_workflow_instance_returns_ok_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances/305a472b-71ab-4ce8-8f8d-75db635627b5/cancel + response: + body: + string: '{} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.frozen new file mode 100644 index 0000000000..f6b8453bd6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:57.981Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.yaml new file mode 100644 index 0000000000..d79b2e553c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_bad_request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"meta":{"payload":{"input":"value"}}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/workflows/malformed/instances + response: + body: + string: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value + is invalid for field workflow_id"}]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.frozen b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.frozen new file mode 100644 index 0000000000..becb798038 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:58.210Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.yaml b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.yaml new file mode 100644 index 0000000000..91aed31f2f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_execute_a_workflow_returns_created_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"meta":{"payload":{"input":"value"}}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances + response: + body: + string: '{"data":{"attributes":{},"id":"111e18d6-3f19-4ada-91d3-ab1e1546b8b4","type":"instances"},"meta":{"workflowId":"ccf73164-1998-4785-a7a3-8d06c7e5f558"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.frozen new file mode 100644 index 0000000000..873df33c06 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:58.459Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.yaml new file mode 100644 index 0000000000..ca69684eac --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows/malformed/instances/malformed + response: + body: + string: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value + is invalid for field workflow_id"}]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.frozen new file mode 100644 index 0000000000..72f845efca --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:58.587Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.yaml new file mode 100644 index 0000000000..1a510ab08a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows/0233a3b7-b7ba-425e-a8cc-375ca2020b5b/instances/e0c64dc8-f946-4ae8-8d79-54569031ce67 + response: + body: + string: '{"errors":[{"code":"WORKFLOW_NOT_FOUND","detail":"workflow not found"}]} + + ' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.frozen new file mode 100644 index 0000000000..95289c9822 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:58.724Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.yaml new file mode 100644 index 0000000000..a7b1525367 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_workflow_instance_returns_ok_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances/305a472b-71ab-4ce8-8f8d-75db635627b5 + response: + body: + string: '{"data":{"attributes":{"endTimestamp":"2024-07-24T18:39:58.219283Z","instanceStatus":{"detailsKind":"CANCELED","displayName":"Canceled"},"outputs":{},"source":{"manual":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"sourceForTemplating":{"initiator":{"email":"max.gale@datadoghq.com","id":"e39535f4-306b-11ee-9383-6ac9a4415a29","name":"Max + Gale"},"name":"Max Jul 24 2024 02:38","type":"manual","url":"https://app.datadoghq.com/workflow/ccf73164-1998-4785-a7a3-8d06c7e5f558?instance=305a472b-71ab-4ce8-8f8d-75db635627b5"},"startTimestamp":"2024-07-24T18:38:31.326418Z","stepStateAssociations":[{"stepName":"Sleep","stepState":"CANCELED"}],"trigger":{}},"id":"305a472b-71ab-4ce8-8f8d-75db635627b5","relationships":{"specVersion":{"data":{"id":"37d9abeb-2ac1-4185-91f8-86d92d5cbf7f","type":"spec_versions"}},"workflow":{"data":{"id":"ccf73164-1998-4785-a7a3-8d06c7e5f558","type":"workflows"}}},"type":"instances"},"included":[{"attributes":{"createdAt":"2024-07-24T18:38:29.839739Z","spec":{"steps":[{"actionId":"com.datadoghq.core.sleep","display":{"bounds":{"y":186}},"name":"Sleep","parameters":[{"name":"durationSeconds","value":300}]}],"triggers":[{"apiTrigger":{},"startStepNames":["Sleep"]}]},"workflowId":"ccf73164-1998-4785-a7a3-8d06c7e5f558"},"id":"37d9abeb-2ac1-4185-91f8-86d92d5cbf7f","type":"spec_versions"},{"attributes":{"createdAt":"2024-07-24T18:38:05.701669Z","creationSource":"workflows_ui","name":"Max + Jul 24 2024 02:38","specVersionId":"3d660f9c-7dfe-4fbd-bea5-f61eccea0600","updatedAt":"2024-07-24T18:38:59.939929Z"},"id":"ccf73164-1998-4785-a7a3-8d06c7e5f558","type":"workflows"}],"meta":{"outputsTooBig":false,"sourceTooBig":false,"triggerTooBig":false}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.frozen new file mode 100644 index 0000000000..f07d03b73b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:58.870Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.yaml new file mode 100644 index 0000000000..c2f9981dbc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows/malformed/instances + response: + body: + string: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value + is invalid for field workflow_id"}]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.frozen new file mode 100644 index 0000000000..27666a9e40 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-07-24T18:39:59.003Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.yaml new file mode 100644 index 0000000000..65368a60ad --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflow_instances_returns_ok_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances + response: + body: + string: '{"data":[{"attributes":{"instanceStatus":{"detailsKind":"IN_PROGRESS","displayName":"Running"},"source":{"api":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"startTimestamp":"2024-07-24T18:39:58.396793Z"},"id":"111e18d6-3f19-4ada-91d3-ab1e1546b8b4","type":"instances"},{"attributes":{"endTimestamp":"2024-07-24T18:39:58.219283Z","instanceStatus":{"detailsKind":"CANCELED","displayName":"Canceled"},"source":{"manual":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"startTimestamp":"2024-07-24T18:38:31.326418Z"},"id":"305a472b-71ab-4ce8-8f8d-75db635627b5","type":"instances"}],"meta":{"canceledCount":1,"failedCount":0,"page":{"totalCount":2,"totalFilteredCount":2},"succeededCount":0}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index c97bab6f78..a1effb52e5 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2430,5 +2430,29 @@ "undo": { "type": "safe" } + }, + "ListWorkflowInstances": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "CreateWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "GetWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "CancelWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } } } diff --git a/tests/v2/features/workflow_automation.feature b/tests/v2/features/workflow_automation.feature new file mode 100644 index 0000000000..fe979f72dd --- /dev/null +++ b/tests/v2/features/workflow_automation.feature @@ -0,0 +1,87 @@ +@endpoint(workflow-automation) @endpoint(workflow-automation-v2) +Feature: Workflow Automation + Automate your teams operational processes with Datadog Workflow + Automation. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "WorkflowAutomation" API + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "Bad Request" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And request contains "instance_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "Not Found" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "0233a3b7-b7ba-425e-a8cc-375ca2020b5b" + And request contains "instance_id" parameter with value "e0c64dc8-f946-4ae8-8d79-54569031ce67" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "OK" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And request contains "instance_id" parameter with value "305a472b-71ab-4ce8-8f8d-75db635627b5" + When the request is sent + Then the response status is 200 OK + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow returns "Bad Request" response + Given new "CreateWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And body with value { "meta": { "payload": { "input": "value" } } } + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow returns "Created" response + Given new "CreateWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And body with value { "meta": { "payload": { "input": "value" } } } + When the request is sent + Then the response status is 200 Created + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "Bad Request" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And request contains "instance_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "Not Found" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "0233a3b7-b7ba-425e-a8cc-375ca2020b5b" + And request contains "instance_id" parameter with value "e0c64dc8-f946-4ae8-8d79-54569031ce67" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "OK" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And request contains "instance_id" parameter with value "305a472b-71ab-4ce8-8f8d-75db635627b5" + When the request is sent + Then the response status is 200 OK + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: List workflow instances returns "Bad Request" response + Given new "ListWorkflowInstances" request + And request contains "workflow_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: List workflow instances returns "OK" response + Given new "ListWorkflowInstances" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + When the request is sent + Then the response status is 200 OK