diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 842f6f5c46..607e2e287b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -55232,6 +55232,35 @@ components: required: - data type: object + ListWorkflowsResponse: + description: The response object for a listing workflows request. + properties: + data: + description: A list of workflows. + items: + $ref: "#/components/schemas/WorkflowListItem" + type: array + meta: + $ref: "#/components/schemas/ListWorkflowsResponseMeta" + type: object + ListWorkflowsResponseMeta: + description: Metadata for a List Workflows response. + properties: + page: + $ref: "#/components/schemas/ListWorkflowsResponseMetaPage" + type: object + ListWorkflowsResponseMetaPage: + description: Pagination metadata for a List Workflows response. + properties: + totalCount: + description: The total number of workflows in the organization. + format: int64 + type: integer + totalFilteredCount: + description: The total number of workflows matching the applied filters. + format: int64 + type: integer + type: object Log: description: Object description of a log after being processed and stored by Datadog. properties: @@ -106572,6 +106601,58 @@ components: format: int64 type: integer type: object + WorkflowListItem: + description: A workflow returned by the list workflows endpoint. + properties: + attributes: + $ref: "#/components/schemas/WorkflowListItemAttributes" + id: + description: The workflow identifier. + readOnly: true + type: string + relationships: + $ref: "#/components/schemas/WorkflowDataRelationships" + type: + $ref: "#/components/schemas/WorkflowDataType" + required: + - type + - attributes + type: object + WorkflowListItemAttributes: + description: Attributes of a workflow returned in a list response. + properties: + createdAt: + description: When the workflow was created. + format: date-time + readOnly: true + type: string + description: + description: Description of the workflow. + type: string + name: + description: Name of the workflow. + example: "My Workflow" + type: string + published: + description: Whether the workflow is published. Unpublished workflows can only be run manually. Automatic triggers such as Schedule do not fire until the workflow is published. + type: boolean + spec: + $ref: "#/components/schemas/Spec" + nullable: true + tags: + description: Tags of the workflow. + items: + description: A tag string in `key:value` format. + type: string + type: array + updatedAt: + description: When the workflow was last updated. + format: date-time + readOnly: true + type: string + required: + - name + type: object WorkflowTriggerWrapper: description: "Schema for a Workflow-based trigger." properties: @@ -188773,6 +188854,120 @@ paths: - manage_log_reports - product_analytics_saved_widgets_write /api/v2/workflows: + get: + description: List all workflows in your organization. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). Alternatively, you can configure these permissions [in the UI](https://docs.datadoghq.com/account_management/api-app-keys/#actions-api-access). + operationId: ListWorkflows + parameters: + - description: The maximum number of workflows to return per page. + example: 50 + in: query + name: limit + required: false + schema: + default: 50 + format: int64 + type: integer + - description: The page number to return, starting from 0. + example: 0 + in: query + name: page + required: false + schema: + default: 0 + format: int64 + type: integer + - description: "The sort order for the returned workflows. Provide a comma-separated list of fields, each optionally prefixed with `-` for descending order. Supported fields are `name`, `createdAt`, `updatedAt`, `creatorName`, `ownerName`, and `lastExecutedAt`." + example: "-updatedAt" + in: query + name: sort + required: false + schema: + type: string + - description: "A search query used to filter the returned workflows. The query performs a case-insensitive substring match against each workflow's name, creator name, and handle. If the query contains a colon (for example, `team:infra`), the query is treated as a `key:value` tag filter." + example: deploy + in: query + name: filter[query] + required: false + schema: + type: string + - description: Filters the returned workflows by one or more trigger types, such as `monitor`, `schedule`, or `githubWebhook`. To specify the multiple types, repeat this parameter. + example: + - monitor + explode: true + in: query + name: filter[triggerIds] + required: false + schema: + items: + type: string + type: array + - description: Whether to include unpublished workflows in the response. + in: query + name: filter[includeUnpublished] + required: false + schema: + default: false + type: boolean + - description: Whether to include the full spec of each workflow in the response. When `false` (the default), each workflow's `spec` is returned as `null`. + in: query + name: filter[includeSpecs] + required: false + schema: + default: false + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + createdAt: "2024-01-01T00:00:00+00:00" + description: A sample workflow. + name: Example Workflow + published: true + spec: {} + tags: + - team:infra + updatedAt: "2024-01-01T00:00:00+00:00" + id: 00000000-0000-0000-0000-000000000002 + relationships: + creator: + data: + id: 00000000-0000-0000-0000-000000000009 + type: users + owner: + data: + id: 00000000-0000-0000-0000-000000000009 + type: users + type: workflows + meta: + page: + totalCount: 1 + totalFilteredCount: 1 + schema: + $ref: "#/components/schemas/ListWorkflowsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List workflows + tags: + - Workflow Automation + x-pagination: + limitParam: limit + pageParam: page + pageStart: 0 + resultsPath: data + "x-permission": + operator: OR + permissions: + - workflows_read post: description: Create a new workflow, returning the workflow ID. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). Alternatively, you can configure these permissions [in the UI](https://docs.datadoghq.com/account_management/api-app-keys/#actions-api-access). operationId: CreateWorkflow diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 8213eb3aa0..c04ed5c35c 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -20304,6 +20304,27 @@ datadog\_api\_client.v2.model.list\_vulnerable\_assets\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.list\_workflows\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_workflows_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.list\_workflows\_response\_meta module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_workflows_response_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.list\_workflows\_response\_meta\_page module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_workflows_response_meta_page + :members: + :show-inheritance: + datadog\_api\_client.v2.model.llm\_obs\_annotated\_interaction\_by\_trace\_item module -------------------------------------------------------------------------------------- @@ -45917,6 +45938,20 @@ datadog\_api\_client.v2.model.workflow\_list\_instances\_response\_meta\_page mo :members: :show-inheritance: +datadog\_api\_client.v2.model.workflow\_list\_item module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_list_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_list\_item\_attributes module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_list_item_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.workflow\_trigger\_wrapper module --------------------------------------------------------------- diff --git a/examples/v2/workflow-automation/ListWorkflows.py b/examples/v2/workflow-automation/ListWorkflows.py new file mode 100644 index 0000000000..5675879745 --- /dev/null +++ b/examples/v2/workflow-automation/ListWorkflows.py @@ -0,0 +1,13 @@ +""" +List workflows 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_workflows() + + print(response) diff --git a/examples/v2/workflow-automation/ListWorkflows_71111569.py b/examples/v2/workflow-automation/ListWorkflows_71111569.py new file mode 100644 index 0000000000..e731ef2ab2 --- /dev/null +++ b/examples/v2/workflow-automation/ListWorkflows_71111569.py @@ -0,0 +1,16 @@ +""" +List workflows returns "OK" response with pagination +""" + +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) + items = api_instance.list_workflows_with_pagination( + limit=2, + filter_query="Example-Workflow-Automation", + ) + for item in items: + print(item) diff --git a/src/datadog_api_client/v2/api/workflow_automation_api.py b/src/datadog_api_client/v2/api/workflow_automation_api.py index f32b55e50f..6436ea5a58 100644 --- a/src/datadog_api_client/v2/api/workflow_automation_api.py +++ b/src/datadog_api_client/v2/api/workflow_automation_api.py @@ -3,14 +3,19 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict, Union +import collections +from typing import Any, Dict, List, 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 ( + set_attribute_from_path, + get_attribute_from_path, UnsetType, unset, ) +from datadog_api_client.v2.model.list_workflows_response import ListWorkflowsResponse +from datadog_api_client.v2.model.workflow_list_item import WorkflowListItem from datadog_api_client.v2.model.create_workflow_response import CreateWorkflowResponse from datadog_api_client.v2.model.create_workflow_request import CreateWorkflowRequest from datadog_api_client.v2.model.get_workflow_response import GetWorkflowResponse @@ -216,6 +221,59 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_workflows_endpoint = _Endpoint( + settings={ + "response_type": (ListWorkflowsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows", + "operation_id": "list_workflows", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "limit": { + "openapi_types": (int,), + "attribute": "limit", + "location": "query", + }, + "page": { + "openapi_types": (int,), + "attribute": "page", + "location": "query", + }, + "sort": { + "openapi_types": (str,), + "attribute": "sort", + "location": "query", + }, + "filter_query": { + "openapi_types": (str,), + "attribute": "filter[query]", + "location": "query", + }, + "filter_trigger_ids": { + "openapi_types": ([str],), + "attribute": "filter[triggerIds]", + "location": "query", + "collection_format": "multi", + }, + "filter_include_unpublished": { + "openapi_types": (bool,), + "attribute": "filter[includeUnpublished]", + "location": "query", + }, + "filter_include_specs": { + "openapi_types": (bool,), + "attribute": "filter[includeSpecs]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._update_workflow_endpoint = _Endpoint( settings={ "response_type": (UpdateWorkflowResponse,), @@ -387,6 +445,129 @@ def list_workflow_instances( return self._list_workflow_instances_endpoint.call_with_http_info(**kwargs) + def list_workflows( + self, + *, + limit: Union[int, UnsetType] = unset, + page: Union[int, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + filter_trigger_ids: Union[List[str], UnsetType] = unset, + filter_include_unpublished: Union[bool, UnsetType] = unset, + filter_include_specs: Union[bool, UnsetType] = unset, + ) -> ListWorkflowsResponse: + """List workflows. + + List all workflows in your organization. This API requires a `registered application key `_. Alternatively, you can configure these permissions `in the UI `_. + + :param limit: The maximum number of workflows to return per page. + :type limit: int, optional + :param page: The page number to return, starting from 0. + :type page: int, optional + :param sort: The sort order for the returned workflows. Provide a comma-separated list of fields, each optionally prefixed with ``-`` for descending order. Supported fields are ``name`` , ``createdAt`` , ``updatedAt`` , ``creatorName`` , ``ownerName`` , and ``lastExecutedAt``. + :type sort: str, optional + :param filter_query: A search query used to filter the returned workflows. The query performs a case-insensitive substring match against each workflow's name, creator name, and handle. If the query contains a colon (for example, ``team:infra`` ), the query is treated as a ``key:value`` tag filter. + :type filter_query: str, optional + :param filter_trigger_ids: Filters the returned workflows by one or more trigger types, such as ``monitor`` , ``schedule`` , or ``githubWebhook``. To specify the multiple types, repeat this parameter. + :type filter_trigger_ids: [str], optional + :param filter_include_unpublished: Whether to include unpublished workflows in the response. + :type filter_include_unpublished: bool, optional + :param filter_include_specs: Whether to include the full spec of each workflow in the response. When ``false`` (the default), each workflow's ``spec`` is returned as ``null``. + :type filter_include_specs: bool, optional + :rtype: ListWorkflowsResponse + """ + kwargs: Dict[str, Any] = {} + if limit is not unset: + kwargs["limit"] = limit + + if page is not unset: + kwargs["page"] = page + + if sort is not unset: + kwargs["sort"] = sort + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if filter_trigger_ids is not unset: + kwargs["filter_trigger_ids"] = filter_trigger_ids + + if filter_include_unpublished is not unset: + kwargs["filter_include_unpublished"] = filter_include_unpublished + + if filter_include_specs is not unset: + kwargs["filter_include_specs"] = filter_include_specs + + return self._list_workflows_endpoint.call_with_http_info(**kwargs) + + def list_workflows_with_pagination( + self, + *, + limit: Union[int, UnsetType] = unset, + page: Union[int, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + filter_trigger_ids: Union[List[str], UnsetType] = unset, + filter_include_unpublished: Union[bool, UnsetType] = unset, + filter_include_specs: Union[bool, UnsetType] = unset, + ) -> collections.abc.Iterable[WorkflowListItem]: + """List workflows. + + Provide a paginated version of :meth:`list_workflows`, returning all items. + + :param limit: The maximum number of workflows to return per page. + :type limit: int, optional + :param page: The page number to return, starting from 0. + :type page: int, optional + :param sort: The sort order for the returned workflows. Provide a comma-separated list of fields, each optionally prefixed with ``-`` for descending order. Supported fields are ``name`` , ``createdAt`` , ``updatedAt`` , ``creatorName`` , ``ownerName`` , and ``lastExecutedAt``. + :type sort: str, optional + :param filter_query: A search query used to filter the returned workflows. The query performs a case-insensitive substring match against each workflow's name, creator name, and handle. If the query contains a colon (for example, ``team:infra`` ), the query is treated as a ``key:value`` tag filter. + :type filter_query: str, optional + :param filter_trigger_ids: Filters the returned workflows by one or more trigger types, such as ``monitor`` , ``schedule`` , or ``githubWebhook``. To specify the multiple types, repeat this parameter. + :type filter_trigger_ids: [str], optional + :param filter_include_unpublished: Whether to include unpublished workflows in the response. + :type filter_include_unpublished: bool, optional + :param filter_include_specs: Whether to include the full spec of each workflow in the response. When ``false`` (the default), each workflow's ``spec`` is returned as ``null``. + :type filter_include_specs: bool, optional + + :return: A generator of paginated results. + :rtype: collections.abc.Iterable[WorkflowListItem] + """ + kwargs: Dict[str, Any] = {} + if limit is not unset: + kwargs["limit"] = limit + + if page is not unset: + kwargs["page"] = page + + if sort is not unset: + kwargs["sort"] = sort + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if filter_trigger_ids is not unset: + kwargs["filter_trigger_ids"] = filter_trigger_ids + + if filter_include_unpublished is not unset: + kwargs["filter_include_unpublished"] = filter_include_unpublished + + if filter_include_specs is not unset: + kwargs["filter_include_specs"] = filter_include_specs + + local_page_size = get_attribute_from_path(kwargs, "limit", 50) + endpoint = self._list_workflows_endpoint + set_attribute_from_path(kwargs, "limit", local_page_size, endpoint.params_map) + pagination = { + "limit_value": local_page_size, + "results_path": "data", + "page_param": "page", + "page_start": 0, + "endpoint": endpoint, + "kwargs": kwargs, + } + return endpoint.call_with_http_info_paginated(pagination) + def update_workflow( self, workflow_id: str, diff --git a/src/datadog_api_client/v2/model/list_workflows_response.py b/src/datadog_api_client/v2/model/list_workflows_response.py new file mode 100644 index 0000000000..97c0be0522 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_workflows_response.py @@ -0,0 +1,56 @@ +# 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, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_list_item import WorkflowListItem + from datadog_api_client.v2.model.list_workflows_response_meta import ListWorkflowsResponseMeta + + +class ListWorkflowsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_list_item import WorkflowListItem + from datadog_api_client.v2.model.list_workflows_response_meta import ListWorkflowsResponseMeta + + return { + "data": ([WorkflowListItem],), + "meta": (ListWorkflowsResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[WorkflowListItem], UnsetType] = unset, + meta: Union[ListWorkflowsResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + The response object for a listing workflows request. + + :param data: A list of workflows. + :type data: [WorkflowListItem], optional + + :param meta: Metadata for a List Workflows response. + :type meta: ListWorkflowsResponseMeta, 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/list_workflows_response_meta.py b/src/datadog_api_client/v2/model/list_workflows_response_meta.py new file mode 100644 index 0000000000..ee92b62fa0 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_workflows_response_meta.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.list_workflows_response_meta_page import ListWorkflowsResponseMetaPage + + +class ListWorkflowsResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.list_workflows_response_meta_page import ListWorkflowsResponseMetaPage + + return { + "page": (ListWorkflowsResponseMetaPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: Union[ListWorkflowsResponseMetaPage, UnsetType] = unset, **kwargs): + """ + Metadata for a List Workflows response. + + :param page: Pagination metadata for a List Workflows response. + :type page: ListWorkflowsResponseMetaPage, optional + """ + if page is not unset: + kwargs["page"] = page + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/list_workflows_response_meta_page.py b/src/datadog_api_client/v2/model/list_workflows_response_meta_page.py new file mode 100644 index 0000000000..6e553ebda9 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_workflows_response_meta_page.py @@ -0,0 +1,45 @@ +# 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 ListWorkflowsResponseMetaPage(ModelNormal): + @cached_property + def openapi_types(_): + return { + "total_count": (int,), + "total_filtered_count": (int,), + } + + attribute_map = { + "total_count": "totalCount", + "total_filtered_count": "totalFilteredCount", + } + + def __init__( + self_, total_count: Union[int, UnsetType] = unset, total_filtered_count: Union[int, UnsetType] = unset, **kwargs + ): + """ + Pagination metadata for a List Workflows response. + + :param total_count: The total number of workflows in the organization. + :type total_count: int, optional + + :param total_filtered_count: The total number of workflows matching the applied filters. + :type total_filtered_count: int, optional + """ + if total_count is not unset: + kwargs["total_count"] = total_count + if total_filtered_count is not unset: + kwargs["total_filtered_count"] = total_filtered_count + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_list_item.py b/src/datadog_api_client/v2/model/workflow_list_item.py new file mode 100644 index 0000000000..799ec41055 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_list_item.py @@ -0,0 +1,77 @@ +# 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_list_item_attributes import WorkflowListItemAttributes + from datadog_api_client.v2.model.workflow_data_relationships import WorkflowDataRelationships + from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType + + +class WorkflowListItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_list_item_attributes import WorkflowListItemAttributes + from datadog_api_client.v2.model.workflow_data_relationships import WorkflowDataRelationships + from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType + + return { + "attributes": (WorkflowListItemAttributes,), + "id": (str,), + "relationships": (WorkflowDataRelationships,), + "type": (WorkflowDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + read_only_vars = { + "id", + "relationships", + } + + def __init__( + self_, + attributes: WorkflowListItemAttributes, + type: WorkflowDataType, + id: Union[str, UnsetType] = unset, + relationships: Union[WorkflowDataRelationships, UnsetType] = unset, + **kwargs, + ): + """ + A workflow returned by the list workflows endpoint. + + :param attributes: Attributes of a workflow returned in a list response. + :type attributes: WorkflowListItemAttributes + + :param id: The workflow identifier. + :type id: str, optional + + :param relationships: The definition of ``WorkflowDataRelationships`` object. + :type relationships: WorkflowDataRelationships, optional + + :param type: The definition of ``WorkflowDataType`` object. + :type type: WorkflowDataType + """ + if id is not unset: + kwargs["id"] = id + if relationships is not unset: + kwargs["relationships"] = relationships + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/workflow_list_item_attributes.py b/src/datadog_api_client/v2/model/workflow_list_item_attributes.py new file mode 100644 index 0000000000..b62d126afc --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_list_item_attributes.py @@ -0,0 +1,99 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.spec import Spec + + +class WorkflowListItemAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.spec import Spec + + return { + "created_at": (datetime,), + "description": (str,), + "name": (str,), + "published": (bool,), + "spec": (Spec,), + "tags": ([str],), + "updated_at": (datetime,), + } + + attribute_map = { + "created_at": "createdAt", + "description": "description", + "name": "name", + "published": "published", + "spec": "spec", + "tags": "tags", + "updated_at": "updatedAt", + } + read_only_vars = { + "created_at", + "updated_at", + } + + def __init__( + self_, + name: str, + created_at: Union[datetime, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + published: Union[bool, UnsetType] = unset, + spec: Union[Spec, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + updated_at: Union[datetime, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of a workflow returned in a list response. + + :param created_at: When the workflow was created. + :type created_at: datetime, optional + + :param description: Description of the workflow. + :type description: str, optional + + :param name: Name of the workflow. + :type name: str + + :param published: Whether the workflow is published. Unpublished workflows can only be run manually. Automatic triggers such as Schedule do not fire until the workflow is published. + :type published: bool, optional + + :param spec: The spec defines what the workflow does. + :type spec: Spec, optional + + :param tags: Tags of the workflow. + :type tags: [str], optional + + :param updated_at: When the workflow was last updated. + :type updated_at: datetime, optional + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if description is not unset: + kwargs["description"] = description + if published is not unset: + kwargs["published"] = published + if spec is not unset: + kwargs["spec"] = spec + if tags is not unset: + kwargs["tags"] = tags + if updated_at is not unset: + kwargs["updated_at"] = updated_at + super().__init__(kwargs) + + self_.name = name diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index c17d47b424..4a87998334 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -4263,6 +4263,9 @@ from datadog_api_client.v2.model.list_teams_sort import ListTeamsSort from datadog_api_client.v2.model.list_vulnerabilities_response import ListVulnerabilitiesResponse from datadog_api_client.v2.model.list_vulnerable_assets_response import ListVulnerableAssetsResponse +from datadog_api_client.v2.model.list_workflows_response import ListWorkflowsResponse +from datadog_api_client.v2.model.list_workflows_response_meta import ListWorkflowsResponseMeta +from datadog_api_client.v2.model.list_workflows_response_meta_page import ListWorkflowsResponseMetaPage from datadog_api_client.v2.model.log import Log from datadog_api_client.v2.model.log_attributes import LogAttributes from datadog_api_client.v2.model.log_type import LogType @@ -9233,6 +9236,8 @@ 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.workflow_list_item import WorkflowListItem +from datadog_api_client.v2.model.workflow_list_item_attributes import WorkflowListItemAttributes from datadog_api_client.v2.model.workflow_trigger_wrapper import WorkflowTriggerWrapper from datadog_api_client.v2.model.workflow_user_relationship import WorkflowUserRelationship from datadog_api_client.v2.model.workflow_user_relationship_data import WorkflowUserRelationshipData @@ -12500,6 +12505,9 @@ "ListTeamsSort", "ListVulnerabilitiesResponse", "ListVulnerableAssetsResponse", + "ListWorkflowsResponse", + "ListWorkflowsResponseMeta", + "ListWorkflowsResponseMetaPage", "Log", "LogAttributes", "LogType", @@ -15824,6 +15832,8 @@ "WorkflowListInstancesResponse", "WorkflowListInstancesResponseMeta", "WorkflowListInstancesResponseMetaPage", + "WorkflowListItem", + "WorkflowListItemAttributes", "WorkflowTriggerWrapper", "WorkflowUserRelationship", "WorkflowUserRelationshipData", diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.frozen new file mode 100644 index 0000000000..efce7c4929 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.frozen @@ -0,0 +1 @@ +2026-06-01T20:36:33.245Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.yaml new file mode 100644 index 0000000000..bb44f765ed --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response.yaml @@ -0,0 +1,101 @@ +interactions: +- request: + body: '{"data":{"attributes":{"name":"Cassette Workflow x-given","spec":{"steps":[{"actionId":"com.datadoghq.core.noop","name":"No_op"}],"triggers":[{"startStepNames":["No_op"],"workflowTrigger":{}}]}},"type":"workflows"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/workflows + response: + body: + string: '{"data":{"id":"72ea47e5-3bf2-41a2-bf7b-1857908234b6","type":"workflows","attributes":{"createdAt":"2026-06-01T20:36:33.514948Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":{"triggers":[{"startStepNames":["No_op"],"workflowTrigger":{}}],"steps":[{"name":"No_op","actionId":"com.datadoghq.core.noop"}]},"tags":[],"updatedAt":"2026-06-01T20:36:33.514948Z"},"relationships":{"creator":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"owner":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows + response: + body: + string: '{"data":[{"id":"72cfa149-f153-45bc-aad6-2f601b7bfd9b","type":"workflows","attributes":{"createdAt":"2025-06-25T11:21:13.41766Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-25T11:21:13.41766Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"fe8c24c3-6574-4cf9-a3ee-4d84dd9b4354","type":"workflows","attributes":{"createdAt":"2025-06-25T11:21:14.456399Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-25T11:21:14.456399Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"7049520d-e564-4f35-8955-1750577b508e","type":"workflows","attributes":{"createdAt":"2025-06-25T11:21:14.872733Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-25T11:21:14.872733Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"c0e61b1b-486a-498d-a6ef-5b18d713a022","type":"workflows","attributes":{"createdAt":"2025-07-28T11:14:25.070776Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-28T11:14:25.070776Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"ceaea4db-f9b7-4133-8049-734c20e08170","type":"workflows","attributes":{"createdAt":"2025-06-25T11:21:15.742156Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-25T11:21:15.742156Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"d5f402b6-c5b1-4d8f-ab32-b7102fb3ef5e","type":"workflows","attributes":{"createdAt":"2025-06-20T11:20:34.434583Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-20T11:20:34.434583Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"59006312-23ea-4467-9921-310d1a17c2d9","type":"workflows","attributes":{"createdAt":"2025-06-20T11:20:35.557523Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-20T11:20:35.557523Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"8e9f8221-5788-4f1a-a341-afe4a73e8d2d","type":"workflows","attributes":{"createdAt":"2025-06-20T11:20:35.915972Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-20T11:20:35.915972Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"73c21683-cf0b-4140-92b3-d3f1be896160","type":"workflows","attributes":{"createdAt":"2025-06-20T11:20:36.779377Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-20T11:20:36.779377Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"8cf1582b-d398-4d35-bbba-a4b957c3db30","type":"workflows","attributes":{"createdAt":"2025-05-21T11:16:44.847574Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-21T11:16:44.847574Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"58031916-ffdb-4021-8670-d78298875765","type":"workflows","attributes":{"createdAt":"2025-05-21T11:16:45.55826Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-21T11:16:45.55826Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"3b7de88e-731c-4d2f-80d9-32ed547dff86","type":"workflows","attributes":{"createdAt":"2025-05-21T11:16:45.777562Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-21T11:16:45.777562Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a187147a-094a-443a-a811-7b106914ec96","type":"workflows","attributes":{"createdAt":"2025-05-21T11:16:46.261047Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-21T11:16:46.261047Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"b7c893dc-f694-41a7-aa2b-633ceca08c2f","type":"workflows","attributes":{"createdAt":"2025-07-02T11:22:01.701809Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-02T11:22:01.701809Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"1d598ddd-5b9b-4ab7-9f7a-5e2574404ec7","type":"workflows","attributes":{"createdAt":"2025-07-02T11:22:02.789201Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-02T11:22:02.789201Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"e8508f29-ced6-4f95-a348-2ac062177472","type":"workflows","attributes":{"createdAt":"2025-07-02T11:22:03.20927Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-02T11:22:03.20927Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"f6d3e46b-eeaf-4017-a865-e1f045deae3f","type":"workflows","attributes":{"createdAt":"2025-07-02T11:22:04.030122Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-02T11:22:04.030122Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"e5fe54aa-9e17-4200-a710-cd916bfd39db","type":"workflows","attributes":{"createdAt":"2025-06-24T11:13:41.595876Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-24T11:13:41.595876Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"615d90f0-3478-4748-b489-177a4e3e2b74","type":"workflows","attributes":{"createdAt":"2025-06-24T11:13:41.828316Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-24T11:13:41.828316Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a7a049f3-4c58-4e30-8157-a3a9b3132843","type":"workflows","attributes":{"createdAt":"2025-06-24T11:13:41.921301Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-24T11:13:41.921301Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a8a64e61-7a8e-46fb-83ae-4220c7aa33ca","type":"workflows","attributes":{"createdAt":"2025-06-24T11:13:42.204916Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-24T11:13:42.204916Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a50f8797-df93-4227-968b-4a653602d405","type":"workflows","attributes":{"createdAt":"2025-06-03T11:15:35.801277Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-03T11:15:35.801277Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"5567b478-806b-4768-9a3f-2b4ac9ad04e4","type":"workflows","attributes":{"createdAt":"2025-06-03T11:15:36.152307Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-03T11:15:36.152307Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"7f306d13-6e65-4962-b89d-5acfe0ada98a","type":"workflows","attributes":{"createdAt":"2025-06-03T11:15:35.623566Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-03T11:15:35.623566Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"8e9be134-5307-451f-8e40-0cc2546b6ed2","type":"workflows","attributes":{"createdAt":"2025-06-03T11:15:35.127727Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-06-03T11:15:35.127727Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"98144b6c-fc26-4e13-9fd9-943619e791d8","type":"workflows","attributes":{"createdAt":"2025-09-23T11:13:25.508416Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-09-23T11:13:25.508416Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"f422939b-e916-46fc-ba26-d25e1dcd2c66","type":"workflows","attributes":{"createdAt":"2025-09-23T11:13:25.765614Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-09-23T11:13:25.765614Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"5480f5c0-6128-4a56-9801-37e2e44496db","type":"workflows","attributes":{"createdAt":"2025-05-20T11:16:34.563405Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-20T11:16:34.563405Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"f00c51f1-6b32-401a-8bd4-08e360f94278","type":"workflows","attributes":{"createdAt":"2025-05-20T11:16:33.073415Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-20T11:16:33.073415Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"27fae62b-27e0-4802-94f4-5fc2fdef43f7","type":"workflows","attributes":{"createdAt":"2025-05-20T11:16:33.978668Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-20T11:16:33.978668Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"c0ccd673-e34a-49dd-a16f-bac77817fa62","type":"workflows","attributes":{"createdAt":"2025-05-20T11:16:33.744349Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-20T11:16:33.744349Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"f7380a3f-dd8f-4811-ac33-3245e6ad7dec","type":"workflows","attributes":{"createdAt":"2025-05-28T11:13:45.369167Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-28T11:13:45.369167Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"03bda67d-2cee-4828-a152-b263085b59cd","type":"workflows","attributes":{"createdAt":"2025-05-22T11:13:37.2763Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-22T11:13:37.2763Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"06c78ee4-a4aa-402e-8940-63ef512490d8","type":"workflows","attributes":{"createdAt":"2025-05-22T11:13:36.897095Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-22T11:13:36.897095Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"7aa75a8b-17b9-4c7e-b5fa-194dcd5f54c9","type":"workflows","attributes":{"createdAt":"2025-05-22T11:13:36.579513Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-22T11:13:36.579513Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"81112f53-d69b-4139-8790-f2adf2d80260","type":"workflows","attributes":{"createdAt":"2025-05-22T11:13:36.994612Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-22T11:13:36.994612Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"ba03c9fa-aa23-436c-ac69-e20bde5fb108","type":"workflows","attributes":{"createdAt":"2025-05-28T11:13:45.553954Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-28T11:13:45.553954Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"cbe3cd7d-4902-4863-9aba-ac4cb9038995","type":"workflows","attributes":{"createdAt":"2025-05-28T11:13:45.659208Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-28T11:13:45.659208Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"4c1cc171-9757-4e67-874e-64c962ed5352","type":"workflows","attributes":{"createdAt":"2025-05-28T11:13:45.894752Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-28T11:13:45.894752Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"52bfc481-46b4-44c1-8392-a32f405c21be","type":"workflows","attributes":{"createdAt":"2025-07-03T11:21:31.639998Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-07-03T11:21:31.639998Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a12f3d3d-2dfb-449f-b1da-9d73dcc1284f","type":"workflows","attributes":{"createdAt":"2025-05-26T11:16:57.708411Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-26T11:16:57.708411Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"5a3ee825-3f39-4842-978c-afb8c997ba76","type":"workflows","attributes":{"createdAt":"2025-05-30T11:19:54.84087Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-30T11:19:54.84087Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"5b6dc390-841e-46e2-ad18-29aa33cd0aa1","type":"workflows","attributes":{"createdAt":"2025-05-30T11:19:52.696163Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-30T11:19:52.696163Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"80d42530-2ef1-40bb-ba31-7c44a0159a92","type":"workflows","attributes":{"createdAt":"2025-05-27T11:17:22.645064Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-27T11:17:22.645064Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a2d791d3-407a-468b-b1eb-f38676b238d9","type":"workflows","attributes":{"createdAt":"2025-05-26T11:16:56.170659Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-26T11:16:56.170659Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"08620ae9-44ed-43c3-9941-e3936f3fd68b","type":"workflows","attributes":{"createdAt":"2025-05-26T11:16:56.942366Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-26T11:16:56.942366Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"d3bba643-1ce2-44c3-8ccb-3ad7647ec64d","type":"workflows","attributes":{"createdAt":"2025-05-26T11:16:57.184285Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-26T11:16:57.184285Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"a7ba3c17-c21b-4e50-8109-ae258395fcf0","type":"workflows","attributes":{"createdAt":"2025-05-27T11:17:22.915147Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-27T11:17:22.915147Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"8222b63d-8c1d-49fd-b31a-f18c870785e8","type":"workflows","attributes":{"createdAt":"2025-05-27T11:17:23.444244Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-27T11:17:23.444244Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}},{"id":"cb5040a1-b989-41bf-9a4f-59c75c0523e0","type":"workflows","attributes":{"createdAt":"2025-05-27T11:17:21.869589Z","description":"","name":"Cassette + Workflow x-given","published":true,"spec":null,"tags":[],"updatedAt":"2025-05-27T11:17:21.869589Z"},"relationships":{"creator":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}},"owner":{"data":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","type":"users"}}}}],"meta":{"page":{"totalCount":548,"totalFilteredCount":548}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/workflows/72ea47e5-3bf2-41a2-bf7b-1857908234b6 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.frozen b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.frozen new file mode 100644 index 0000000000..9c4802e3e5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.frozen @@ -0,0 +1 @@ +2026-06-01T21:52:42.662Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.yaml b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.yaml new file mode 100644 index 0000000000..8ed7678c90 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_list_workflows_returns_ok_response_with_pagination.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/workflows?filter%5Bquery%5D=Test-List_workflows_returns_OK_response_with_pagination-1780350762&limit=2&page=0 + response: + body: + string: '{"data":[],"meta":{"page":{"totalCount":547,"totalFilteredCount":0}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3f66e97af8..32eeb14e33 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -9234,6 +9234,12 @@ "type": "safe" } }, + "ListWorkflows": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, "CreateWorkflow": { "tag": "Workflow Automation", "undo": { diff --git a/tests/v2/features/workflow_automation.feature b/tests/v2/features/workflow_automation.feature index df51d50139..96b0adf4e2 100644 --- a/tests/v2/features/workflow_automation.feature +++ b/tests/v2/features/workflow_automation.feature @@ -142,6 +142,28 @@ Feature: Workflow Automation When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: List workflows returns "Bad Request" response + Given new "ListWorkflows" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/workflow-automation-dev + Scenario: List workflows returns "OK" response + Given there is a valid "workflow" in the system + And new "ListWorkflows" request + When the request is sent + Then the response status is 200 OK + + @replay-only @skip-validation @team:DataDog/workflow-automation-dev @with-pagination + Scenario: List workflows returns "OK" response with pagination + Given new "ListWorkflows" request + And request contains "filter[query]" parameter with value "{{ unique }}" + And request contains "limit" parameter with value 2 + When the request with pagination is sent + Then the response status is 200 OK + And the response has 0 items + @team:DataDog/workflow-automation-dev Scenario: Update an existing Workflow returns "Bad request" response Given there is a valid "workflow" in the system