From b7e7748d89da39249d28fafaa259426e7c9acb7e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 30 Jan 2026 13:52:39 +0000 Subject: [PATCH] Regenerate client from commit e447222 of spec repo --- .generator/schemas/v2/openapi.yaml | 420 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 126 ++++++ .../ExecuteWorkflowFromTemplate.py | 42 ++ .../ExecuteWorkflowFromWebhook.py | 20 + .../UpdateWorkflowFavorite.py | 25 ++ src/datadog_api_client/configuration.py | 3 + .../v2/api/workflow_automation_api.py | 215 +++++++++ .../v2/model/workflow_favorite_request.py | 40 ++ .../workflow_favorite_request_attributes.py | 33 ++ .../model/workflow_favorite_request_data.py | 48 ++ .../model/workflow_favorite_request_type.py | 35 ++ .../workflow_headless_execution_config.py | 67 +++ .../workflow_headless_execution_connection.py | 40 ++ .../workflow_headless_execution_request.py | 44 ++ ...w_headless_execution_request_attributes.py | 46 ++ ...orkflow_headless_execution_request_data.py | 68 +++ ...orkflow_headless_execution_request_type.py | 37 ++ .../workflow_headless_execution_response.py | 44 ++ ..._headless_execution_response_attributes.py | 34 ++ ...rkflow_headless_execution_response_data.py | 68 +++ ...rkflow_headless_execution_response_type.py | 37 ++ .../workflow_webhook_execution_response.py | 44 ++ ...w_webhook_execution_response_attributes.py | 40 ++ ...orkflow_webhook_execution_response_data.py | 68 +++ ...orkflow_webhook_execution_response_type.py | 37 ++ src/datadog_api_client/v2/models/__init__.py | 42 ++ tests/v2/features/undo.json | 18 + tests/v2/features/workflow_automation.feature | 87 ++++ 28 files changed, 1828 insertions(+) create mode 100644 examples/v2/workflow-automation/ExecuteWorkflowFromTemplate.py create mode 100644 examples/v2/workflow-automation/ExecuteWorkflowFromWebhook.py create mode 100644 examples/v2/workflow-automation/UpdateWorkflowFavorite.py create mode 100644 src/datadog_api_client/v2/model/workflow_favorite_request.py create mode 100644 src/datadog_api_client/v2/model/workflow_favorite_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/workflow_favorite_request_data.py create mode 100644 src/datadog_api_client/v2/model/workflow_favorite_request_type.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_config.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_connection.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_request.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_request_data.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_request_type.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_response.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_response_data.py create mode 100644 src/datadog_api_client/v2/model/workflow_headless_execution_response_type.py create mode 100644 src/datadog_api_client/v2/model/workflow_webhook_execution_response.py create mode 100644 src/datadog_api_client/v2/model/workflow_webhook_execution_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/workflow_webhook_execution_response_data.py create mode 100644 src/datadog_api_client/v2/model/workflow_webhook_execution_response_type.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a2cda6f2d6..21392fb0d7 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -804,6 +804,14 @@ components: example: f9ec96b0-8c8a-4b0a-9b0a-1b2c3d4e5f6a format: uuid type: string + OrgIdQuery: + description: The organization ID + in: query + name: orgId + required: true + schema: + format: uuid + type: string PageNumber: description: Specific page number to return. in: query @@ -834,6 +842,13 @@ components: example: 10 format: int64 type: integer + ParentId: + description: The ID of the parent workflow + in: path + name: parent_id + required: true + schema: + type: string ProductName: description: Name of the product to be deleted, either `logs` or `rum`. in: path @@ -65608,6 +65623,154 @@ components: type: string writeOnly: true type: object + WorkflowFavoriteRequest: + properties: + data: + $ref: '#/components/schemas/WorkflowFavoriteRequestData' + required: + - data + type: object + WorkflowFavoriteRequestAttributes: + properties: + favorite: + description: Whether to mark the workflow as favorite (true) or unfavorite + (false) + example: true + type: boolean + required: + - favorite + type: object + WorkflowFavoriteRequestData: + properties: + attributes: + $ref: '#/components/schemas/WorkflowFavoriteRequestAttributes' + type: + $ref: '#/components/schemas/WorkflowFavoriteRequestType' + required: + - type + - attributes + type: object + WorkflowFavoriteRequestType: + description: The type for workflow favorite request + enum: + - workflow_favorite_request + example: workflow_favorite_request + type: string + x-enum-varnames: + - WORKFLOW_FAVORITE_REQUEST + WorkflowHeadlessExecutionConfig: + properties: + connections: + description: List of connections to use for the workflow execution + items: + $ref: '#/components/schemas/WorkflowHeadlessExecutionConnection' + type: array + inputs: + additionalProperties: {} + description: Input parameters for the workflow execution + example: {} + type: object + required: + - connections + - inputs + type: object + WorkflowHeadlessExecutionConnection: + properties: + connection_id: + description: The ID of the connection + example: 11111111-1111-1111-1111-111111111111 + format: uuid + type: string + label: + description: The label for the connection + example: INTEGRATION_DATADOG + type: string + required: + - label + - connection_id + type: object + WorkflowHeadlessExecutionRequest: + properties: + data: + $ref: '#/components/schemas/WorkflowHeadlessExecutionRequestData' + required: + - data + type: object + WorkflowHeadlessExecutionRequestAttributes: + properties: + config: + $ref: '#/components/schemas/WorkflowHeadlessExecutionConfig' + template_id: + description: The ID of the workflow template to execute + example: template-789 + type: string + required: + - template_id + - config + type: object + WorkflowHeadlessExecutionRequestData: + properties: + attributes: + $ref: '#/components/schemas/WorkflowHeadlessExecutionRequestAttributes' + id: + description: The ID of the parent workflow + example: '1234' + type: string + type: + $ref: '#/components/schemas/WorkflowHeadlessExecutionRequestType' + required: + - type + - id + - attributes + type: object + WorkflowHeadlessExecutionRequestType: + description: The type for workflow headless execution request + enum: + - workflow_headless_execution_request + example: workflow_headless_execution_request + type: string + x-enum-varnames: + - WORKFLOW_HEADLESS_EXECUTION_REQUEST + WorkflowHeadlessExecutionResponse: + properties: + data: + $ref: '#/components/schemas/WorkflowHeadlessExecutionResponseData' + required: + - data + type: object + WorkflowHeadlessExecutionResponseAttributes: + properties: + instance_id: + description: The ID of the workflow instance that was created + example: instance-abc + format: uuid + type: string + required: + - instance_id + type: object + WorkflowHeadlessExecutionResponseData: + properties: + attributes: + $ref: '#/components/schemas/WorkflowHeadlessExecutionResponseAttributes' + id: + description: The ID of the parent workflow + example: '1234' + type: string + type: + $ref: '#/components/schemas/WorkflowHeadlessExecutionResponseType' + required: + - type + - id + - attributes + type: object + WorkflowHeadlessExecutionResponseType: + description: The type for workflow headless execution response + enum: + - workflow_headless_execution + example: workflow_headless_execution + type: string + x-enum-varnames: + - WORKFLOW_HEADLESS_EXECUTION WorkflowInstanceCreateMeta: description: Additional information for creating a workflow instance. properties: @@ -65713,6 +65876,52 @@ components: type: string x-enum-varnames: - USERS + WorkflowWebhookExecutionResponse: + properties: + data: + $ref: '#/components/schemas/WorkflowWebhookExecutionResponseData' + required: + - data + type: object + WorkflowWebhookExecutionResponseAttributes: + properties: + instance_id: + description: The ID of the workflow instance that was created + example: instance-456 + format: uuid + type: string + workflow_id: + description: The ID of the workflow that was executed + example: aa76b482-0c00-4f1c-9b63-7a20f7bf41f8 + format: uuid + type: string + required: + - workflow_id + - instance_id + type: object + WorkflowWebhookExecutionResponseData: + properties: + attributes: + $ref: '#/components/schemas/WorkflowWebhookExecutionResponseAttributes' + id: + description: The unique identifier of the execution + example: execution-123 + type: string + type: + $ref: '#/components/schemas/WorkflowWebhookExecutionResponseType' + required: + - type + - id + - attributes + type: object + WorkflowWebhookExecutionResponseType: + description: The type for workflow webhook execution response + enum: + - workflow_webhook_execution + example: workflow_webhook_execution + type: string + x-enum-varnames: + - WORKFLOW_WEBHOOK_EXECUTION WorklflowCancelInstanceResponse: description: Information about the canceled instance. properties: @@ -99642,6 +99851,72 @@ paths: operator: OR permissions: - teams_read + /api/v2/workflow_headless/{parent_id}/instances: + post: + description: 'Execute a headless workflow instance from a template. This endpoint + creates and executes + + a workflow instance based on a template configuration. + + + **Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: ExecuteWorkflowFromTemplate + parameters: + - $ref: '#/components/parameters/ParentId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowHeadlessExecutionRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowHeadlessExecutionResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Execute a workflow from a template + tags: + - Workflow Automation + x-permission: + operator: OR + permissions: + - connections_resolve + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/workflows: post: description: Create a new workflow, returning the workflow ID. This API requires @@ -99818,6 +100093,60 @@ paths: operator: OR permissions: - workflows_write + /api/v2/workflows/{workflow_id}/favorite: + put: + description: 'Mark a workflow as favorite or unfavorite for the authenticated + user. + + + **Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: UpdateWorkflowFavorite + parameters: + - $ref: '#/components/parameters/WorkflowId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowFavoriteRequest' + required: true + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update workflow favorite status + tags: + - Workflow Automation + x-permission: + operator: OR + permissions: + - workflows_read + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/workflows/{workflow_id}/instances: get: description: List all instances of a given workflow. This API requires a [registered @@ -99959,6 +100288,97 @@ paths: operator: OR permissions: - workflows_run + /api/v2/workflows/{workflow_id}/webhook: + post: + description: 'Execute a workflow triggered by a GitHub webhook. This endpoint + validates the GitHub webhook signature + + and the GitHub user agent before executing the workflow. + + + This endpoint requires: + + - Valid GitHub webhook signature in the X-Hub-Signature-256 header + + - GitHub user agent in the User-Agent header + + - Valid organization ID in the orgId query parameter + + - Valid workflow ID in the path + + + **Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + operationId: ExecuteWorkflowFromWebhook + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/OrgIdQuery' + - description: GitHub webhook signature for payload validation + in: header + name: X-Hub-Signature-256 + required: true + schema: + example: sha256=abcdef123456... + type: string + - description: Must start with "GitHub-Hookshot/" + in: header + name: User-Agent + required: true + schema: + example: GitHub-Hookshot/abc123 + type: string + requestBody: + content: + application/json: + schema: + additionalProperties: {} + description: GitHub webhook payload + type: object + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowWebhookExecutionResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Internal Server Error + summary: Execute a workflow from a webhook + tags: + - Workflow Automation + x-permission: + operator: OR + permissions: + - connections_resolve + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' security: - apiKeyAuth: [] appKeyAuth: [] diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 6fda36e8e2..c38fc509e4 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -28970,6 +28970,104 @@ datadog\_api\_client.v2.model.workflow\_data\_update\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.workflow\_favorite\_request module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_favorite_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_favorite\_request\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_favorite_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_favorite\_request\_data module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_favorite_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_favorite\_request\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_favorite_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_config module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_config + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_connection module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_connection + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_request module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_request\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_request\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_request\_type module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_response module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_response\_attributes module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_response\_data module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_headless\_execution\_response\_type module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_headless_execution_response_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.workflow\_instance\_create\_meta module --------------------------------------------------------------------- @@ -29054,6 +29152,34 @@ datadog\_api\_client.v2.model.workflow\_user\_relationship\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.workflow\_webhook\_execution\_response module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_webhook_execution_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_webhook\_execution\_response\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_webhook_execution_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_webhook\_execution\_response\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_webhook_execution_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.workflow\_webhook\_execution\_response\_type module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.workflow_webhook_execution_response_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.worklflow\_cancel\_instance\_response module -------------------------------------------------------------------------- diff --git a/examples/v2/workflow-automation/ExecuteWorkflowFromTemplate.py b/examples/v2/workflow-automation/ExecuteWorkflowFromTemplate.py new file mode 100644 index 0000000000..6f9292b253 --- /dev/null +++ b/examples/v2/workflow-automation/ExecuteWorkflowFromTemplate.py @@ -0,0 +1,42 @@ +""" +Execute a workflow from a template returns "OK" 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_headless_execution_config import WorkflowHeadlessExecutionConfig +from datadog_api_client.v2.model.workflow_headless_execution_connection import WorkflowHeadlessExecutionConnection +from datadog_api_client.v2.model.workflow_headless_execution_request import WorkflowHeadlessExecutionRequest +from datadog_api_client.v2.model.workflow_headless_execution_request_attributes import ( + WorkflowHeadlessExecutionRequestAttributes, +) +from datadog_api_client.v2.model.workflow_headless_execution_request_data import WorkflowHeadlessExecutionRequestData +from datadog_api_client.v2.model.workflow_headless_execution_request_type import WorkflowHeadlessExecutionRequestType +from uuid import UUID + +body = WorkflowHeadlessExecutionRequest( + data=WorkflowHeadlessExecutionRequestData( + attributes=WorkflowHeadlessExecutionRequestAttributes( + config=WorkflowHeadlessExecutionConfig( + connections=[ + WorkflowHeadlessExecutionConnection( + connection_id=UUID("11111111-1111-1111-1111-111111111111"), + label="INTEGRATION_DATADOG", + ), + ], + inputs=dict(), + ), + template_id="template-789", + ), + id="1234", + type=WorkflowHeadlessExecutionRequestType.WORKFLOW_HEADLESS_EXECUTION_REQUEST, + ), +) + +configuration = Configuration() +configuration.unstable_operations["execute_workflow_from_template"] = True +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.execute_workflow_from_template(parent_id="parent_id", body=body) + + print(response) diff --git a/examples/v2/workflow-automation/ExecuteWorkflowFromWebhook.py b/examples/v2/workflow-automation/ExecuteWorkflowFromWebhook.py new file mode 100644 index 0000000000..6bb340ecb5 --- /dev/null +++ b/examples/v2/workflow-automation/ExecuteWorkflowFromWebhook.py @@ -0,0 +1,20 @@ +""" +Execute a workflow from a webhook returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi +from uuid import UUID + +configuration = Configuration() +configuration.unstable_operations["execute_workflow_from_webhook"] = True +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + response = api_instance.execute_workflow_from_webhook( + workflow_id="workflow_id", + org_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + x_hub_signature_256="sha256=abcdef123456...", + user_agent="GitHub-Hookshot/abc123", + ) + + print(response) diff --git a/examples/v2/workflow-automation/UpdateWorkflowFavorite.py b/examples/v2/workflow-automation/UpdateWorkflowFavorite.py new file mode 100644 index 0000000000..ca524b1ee8 --- /dev/null +++ b/examples/v2/workflow-automation/UpdateWorkflowFavorite.py @@ -0,0 +1,25 @@ +""" +Update workflow favorite status returns "No Content" 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_favorite_request import WorkflowFavoriteRequest +from datadog_api_client.v2.model.workflow_favorite_request_attributes import WorkflowFavoriteRequestAttributes +from datadog_api_client.v2.model.workflow_favorite_request_data import WorkflowFavoriteRequestData +from datadog_api_client.v2.model.workflow_favorite_request_type import WorkflowFavoriteRequestType + +body = WorkflowFavoriteRequest( + data=WorkflowFavoriteRequestData( + attributes=WorkflowFavoriteRequestAttributes( + favorite=True, + ), + type=WorkflowFavoriteRequestType.WORKFLOW_FAVORITE_REQUEST, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_workflow_favorite"] = True +with ApiClient(configuration) as api_client: + api_instance = WorkflowAutomationApi(api_client) + api_instance.update_workflow_favorite(workflow_id="workflow_id", body=body) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index cf63f54a1c..39f50ca7d2 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -437,6 +437,9 @@ def __init__( "v2.update_incident_team": False, "v2.search_flaky_tests": False, "v2.update_flaky_tests": False, + "v2.execute_workflow_from_template": False, + "v2.execute_workflow_from_webhook": False, + "v2.update_workflow_favorite": False, } ) 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..5d3e73e8b3 100644 --- a/src/datadog_api_client/v2/api/workflow_automation_api.py +++ b/src/datadog_api_client/v2/api/workflow_automation_api.py @@ -8,19 +8,27 @@ 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 ( + date, + datetime, + none_type, UnsetType, unset, + UUID, ) +from datadog_api_client.v2.model.workflow_headless_execution_response import WorkflowHeadlessExecutionResponse +from datadog_api_client.v2.model.workflow_headless_execution_request import WorkflowHeadlessExecutionRequest 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 from datadog_api_client.v2.model.update_workflow_response import UpdateWorkflowResponse from datadog_api_client.v2.model.update_workflow_request import UpdateWorkflowRequest +from datadog_api_client.v2.model.workflow_favorite_request import WorkflowFavoriteRequest 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 +from datadog_api_client.v2.model.workflow_webhook_execution_response import WorkflowWebhookExecutionResponse class WorkflowAutomationApi: @@ -131,6 +139,91 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._execute_workflow_from_template_endpoint = _Endpoint( + settings={ + "response_type": (WorkflowHeadlessExecutionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflow_headless/{parent_id}/instances", + "operation_id": "execute_workflow_from_template", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "parent_id": { + "required": True, + "openapi_types": (str,), + "attribute": "parent_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WorkflowHeadlessExecutionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._execute_workflow_from_webhook_endpoint = _Endpoint( + settings={ + "response_type": (WorkflowWebhookExecutionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/webhook", + "operation_id": "execute_workflow_from_webhook", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "org_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "orgId", + "location": "query", + }, + "x_hub_signature_256": { + "required": True, + "openapi_types": (str,), + "attribute": "X-Hub-Signature-256", + "location": "header", + }, + "user_agent": { + "required": True, + "openapi_types": (str,), + "attribute": "User-Agent", + "location": "header", + }, + "body": { + "required": True, + "openapi_types": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._get_workflow_endpoint = _Endpoint( settings={ "response_type": (GetWorkflowResponse,), @@ -242,6 +335,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_workflow_favorite_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/workflows/{workflow_id}/favorite", + "operation_id": "update_workflow_favorite", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "workflow_id": { + "required": True, + "openapi_types": (str,), + "attribute": "workflow_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (WorkflowFavoriteRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def cancel_workflow_instance( self, workflow_id: str, @@ -318,6 +437,78 @@ def delete_workflow( return self._delete_workflow_endpoint.call_with_http_info(**kwargs) + def execute_workflow_from_template( + self, + parent_id: str, + body: WorkflowHeadlessExecutionRequest, + ) -> WorkflowHeadlessExecutionResponse: + """Execute a workflow from a template. + + Execute a headless workflow instance from a template. This endpoint creates and executes + a workflow instance based on a template configuration. + + **Note** : This endpoint is in public beta and is subject to change. + If you have any feedback, contact `Datadog support `_. + + :param parent_id: The ID of the parent workflow + :type parent_id: str + :type body: WorkflowHeadlessExecutionRequest + :rtype: WorkflowHeadlessExecutionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["parent_id"] = parent_id + + kwargs["body"] = body + + return self._execute_workflow_from_template_endpoint.call_with_http_info(**kwargs) + + def execute_workflow_from_webhook( + self, + workflow_id: str, + org_id: UUID, + x_hub_signature_256: str, + user_agent: str, + body: Dict[str, Any], + ) -> WorkflowWebhookExecutionResponse: + """Execute a workflow from a webhook. + + Execute a workflow triggered by a GitHub webhook. This endpoint validates the GitHub webhook signature + and the GitHub user agent before executing the workflow. + + This endpoint requires: + + * Valid GitHub webhook signature in the X-Hub-Signature-256 header + * GitHub user agent in the User-Agent header + * Valid organization ID in the orgId query parameter + * Valid workflow ID in the path + + **Note** : This endpoint is in public beta and is subject to change. + If you have any feedback, contact `Datadog support `_. + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :param org_id: The organization ID + :type org_id: UUID + :param x_hub_signature_256: GitHub webhook signature for payload validation + :type x_hub_signature_256: str + :param user_agent: Must start with "GitHub-Hookshot/" + :type user_agent: str + :type body: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + :rtype: WorkflowWebhookExecutionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + kwargs["org_id"] = org_id + + kwargs["x_hub_signature_256"] = x_hub_signature_256 + + kwargs["user_agent"] = user_agent + + kwargs["body"] = body + + return self._execute_workflow_from_webhook_endpoint.call_with_http_info(**kwargs) + def get_workflow( self, workflow_id: str, @@ -407,3 +598,27 @@ def update_workflow( kwargs["body"] = body return self._update_workflow_endpoint.call_with_http_info(**kwargs) + + def update_workflow_favorite( + self, + workflow_id: str, + body: WorkflowFavoriteRequest, + ) -> None: + """Update workflow favorite status. + + Mark a workflow as favorite or unfavorite for the authenticated user. + + **Note** : This endpoint is in public beta and is subject to change. + If you have any feedback, contact `Datadog support `_. + + :param workflow_id: The ID of the workflow. + :type workflow_id: str + :type body: WorkflowFavoriteRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["workflow_id"] = workflow_id + + kwargs["body"] = body + + return self._update_workflow_favorite_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/workflow_favorite_request.py b/src/datadog_api_client/v2/model/workflow_favorite_request.py new file mode 100644 index 0000000000..1639d95d51 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_favorite_request.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_favorite_request_data import WorkflowFavoriteRequestData + + +class WorkflowFavoriteRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_favorite_request_data import WorkflowFavoriteRequestData + + return { + "data": (WorkflowFavoriteRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WorkflowFavoriteRequestData, **kwargs): + """ + + + :param data: + :type data: WorkflowFavoriteRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/workflow_favorite_request_attributes.py b/src/datadog_api_client/v2/model/workflow_favorite_request_attributes.py new file mode 100644 index 0000000000..2755f66489 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_favorite_request_attributes.py @@ -0,0 +1,33 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class WorkflowFavoriteRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "favorite": (bool,), + } + + attribute_map = { + "favorite": "favorite", + } + + def __init__(self_, favorite: bool, **kwargs): + """ + + + :param favorite: Whether to mark the workflow as favorite (true) or unfavorite (false) + :type favorite: bool + """ + super().__init__(kwargs) + + self_.favorite = favorite diff --git a/src/datadog_api_client/v2/model/workflow_favorite_request_data.py b/src/datadog_api_client/v2/model/workflow_favorite_request_data.py new file mode 100644 index 0000000000..3397505386 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_favorite_request_data.py @@ -0,0 +1,48 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_favorite_request_attributes import WorkflowFavoriteRequestAttributes + from datadog_api_client.v2.model.workflow_favorite_request_type import WorkflowFavoriteRequestType + + +class WorkflowFavoriteRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_favorite_request_attributes import WorkflowFavoriteRequestAttributes + from datadog_api_client.v2.model.workflow_favorite_request_type import WorkflowFavoriteRequestType + + return { + "attributes": (WorkflowFavoriteRequestAttributes,), + "type": (WorkflowFavoriteRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: WorkflowFavoriteRequestAttributes, type: WorkflowFavoriteRequestType, **kwargs): + """ + + + :param attributes: + :type attributes: WorkflowFavoriteRequestAttributes + + :param type: The type for workflow favorite request + :type type: WorkflowFavoriteRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/workflow_favorite_request_type.py b/src/datadog_api_client/v2/model/workflow_favorite_request_type.py new file mode 100644 index 0000000000..092f4c5d17 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_favorite_request_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WorkflowFavoriteRequestType(ModelSimple): + """ + The type for workflow favorite request + + :param value: If omitted defaults to "workflow_favorite_request". Must be one of ["workflow_favorite_request"]. + :type value: str + """ + + allowed_values = { + "workflow_favorite_request", + } + WORKFLOW_FAVORITE_REQUEST: ClassVar["WorkflowFavoriteRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WorkflowFavoriteRequestType.WORKFLOW_FAVORITE_REQUEST = WorkflowFavoriteRequestType("workflow_favorite_request") diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_config.py b/src/datadog_api_client/v2/model/workflow_headless_execution_config.py new file mode 100644 index 0000000000..681c9065a0 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_config.py @@ -0,0 +1,67 @@ +# 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, List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_connection import WorkflowHeadlessExecutionConnection + + +class WorkflowHeadlessExecutionConfig(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_connection import ( + WorkflowHeadlessExecutionConnection, + ) + + return { + "connections": ([WorkflowHeadlessExecutionConnection],), + "inputs": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + } + + attribute_map = { + "connections": "connections", + "inputs": "inputs", + } + + def __init__(self_, connections: List[WorkflowHeadlessExecutionConnection], inputs: Dict[str, Any], **kwargs): + """ + + + :param connections: List of connections to use for the workflow execution + :type connections: [WorkflowHeadlessExecutionConnection] + + :param inputs: Input parameters for the workflow execution + :type inputs: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + """ + super().__init__(kwargs) + + self_.connections = connections + self_.inputs = inputs diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_connection.py b/src/datadog_api_client/v2/model/workflow_headless_execution_connection.py new file mode 100644 index 0000000000..0f8d41f328 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_connection.py @@ -0,0 +1,40 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +class WorkflowHeadlessExecutionConnection(ModelNormal): + @cached_property + def openapi_types(_): + return { + "connection_id": (UUID,), + "label": (str,), + } + + attribute_map = { + "connection_id": "connection_id", + "label": "label", + } + + def __init__(self_, connection_id: UUID, label: str, **kwargs): + """ + + + :param connection_id: The ID of the connection + :type connection_id: UUID + + :param label: The label for the connection + :type label: str + """ + super().__init__(kwargs) + + self_.connection_id = connection_id + self_.label = label diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_request.py b/src/datadog_api_client/v2/model/workflow_headless_execution_request.py new file mode 100644 index 0000000000..5c9d26ebfd --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_request.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_request_data import ( + WorkflowHeadlessExecutionRequestData, + ) + + +class WorkflowHeadlessExecutionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_request_data import ( + WorkflowHeadlessExecutionRequestData, + ) + + return { + "data": (WorkflowHeadlessExecutionRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WorkflowHeadlessExecutionRequestData, **kwargs): + """ + + + :param data: + :type data: WorkflowHeadlessExecutionRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_request_attributes.py b/src/datadog_api_client/v2/model/workflow_headless_execution_request_attributes.py new file mode 100644 index 0000000000..5ea0792852 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_request_attributes.py @@ -0,0 +1,46 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_config import WorkflowHeadlessExecutionConfig + + +class WorkflowHeadlessExecutionRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_config import WorkflowHeadlessExecutionConfig + + return { + "config": (WorkflowHeadlessExecutionConfig,), + "template_id": (str,), + } + + attribute_map = { + "config": "config", + "template_id": "template_id", + } + + def __init__(self_, config: WorkflowHeadlessExecutionConfig, template_id: str, **kwargs): + """ + + + :param config: + :type config: WorkflowHeadlessExecutionConfig + + :param template_id: The ID of the workflow template to execute + :type template_id: str + """ + super().__init__(kwargs) + + self_.config = config + self_.template_id = template_id diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_request_data.py b/src/datadog_api_client/v2/model/workflow_headless_execution_request_data.py new file mode 100644 index 0000000000..fdbe67b43c --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_request_data.py @@ -0,0 +1,68 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_request_attributes import ( + WorkflowHeadlessExecutionRequestAttributes, + ) + from datadog_api_client.v2.model.workflow_headless_execution_request_type import ( + WorkflowHeadlessExecutionRequestType, + ) + + +class WorkflowHeadlessExecutionRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_request_attributes import ( + WorkflowHeadlessExecutionRequestAttributes, + ) + from datadog_api_client.v2.model.workflow_headless_execution_request_type import ( + WorkflowHeadlessExecutionRequestType, + ) + + return { + "attributes": (WorkflowHeadlessExecutionRequestAttributes,), + "id": (str,), + "type": (WorkflowHeadlessExecutionRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: WorkflowHeadlessExecutionRequestAttributes, + id: str, + type: WorkflowHeadlessExecutionRequestType, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: WorkflowHeadlessExecutionRequestAttributes + + :param id: The ID of the parent workflow + :type id: str + + :param type: The type for workflow headless execution request + :type type: WorkflowHeadlessExecutionRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_request_type.py b/src/datadog_api_client/v2/model/workflow_headless_execution_request_type.py new file mode 100644 index 0000000000..f49c33e412 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_request_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WorkflowHeadlessExecutionRequestType(ModelSimple): + """ + The type for workflow headless execution request + + :param value: If omitted defaults to "workflow_headless_execution_request". Must be one of ["workflow_headless_execution_request"]. + :type value: str + """ + + allowed_values = { + "workflow_headless_execution_request", + } + WORKFLOW_HEADLESS_EXECUTION_REQUEST: ClassVar["WorkflowHeadlessExecutionRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WorkflowHeadlessExecutionRequestType.WORKFLOW_HEADLESS_EXECUTION_REQUEST = WorkflowHeadlessExecutionRequestType( + "workflow_headless_execution_request" +) diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_response.py b/src/datadog_api_client/v2/model/workflow_headless_execution_response.py new file mode 100644 index 0000000000..4e49974647 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_response_data import ( + WorkflowHeadlessExecutionResponseData, + ) + + +class WorkflowHeadlessExecutionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_response_data import ( + WorkflowHeadlessExecutionResponseData, + ) + + return { + "data": (WorkflowHeadlessExecutionResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WorkflowHeadlessExecutionResponseData, **kwargs): + """ + + + :param data: + :type data: WorkflowHeadlessExecutionResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_response_attributes.py b/src/datadog_api_client/v2/model/workflow_headless_execution_response_attributes.py new file mode 100644 index 0000000000..cce142b2a2 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_response_attributes.py @@ -0,0 +1,34 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +class WorkflowHeadlessExecutionResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "instance_id": (UUID,), + } + + attribute_map = { + "instance_id": "instance_id", + } + + def __init__(self_, instance_id: UUID, **kwargs): + """ + + + :param instance_id: The ID of the workflow instance that was created + :type instance_id: UUID + """ + super().__init__(kwargs) + + self_.instance_id = instance_id diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_response_data.py b/src/datadog_api_client/v2/model/workflow_headless_execution_response_data.py new file mode 100644 index 0000000000..c4ddaaf854 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_response_data.py @@ -0,0 +1,68 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_headless_execution_response_attributes import ( + WorkflowHeadlessExecutionResponseAttributes, + ) + from datadog_api_client.v2.model.workflow_headless_execution_response_type import ( + WorkflowHeadlessExecutionResponseType, + ) + + +class WorkflowHeadlessExecutionResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_headless_execution_response_attributes import ( + WorkflowHeadlessExecutionResponseAttributes, + ) + from datadog_api_client.v2.model.workflow_headless_execution_response_type import ( + WorkflowHeadlessExecutionResponseType, + ) + + return { + "attributes": (WorkflowHeadlessExecutionResponseAttributes,), + "id": (str,), + "type": (WorkflowHeadlessExecutionResponseType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: WorkflowHeadlessExecutionResponseAttributes, + id: str, + type: WorkflowHeadlessExecutionResponseType, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: WorkflowHeadlessExecutionResponseAttributes + + :param id: The ID of the parent workflow + :type id: str + + :param type: The type for workflow headless execution response + :type type: WorkflowHeadlessExecutionResponseType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/workflow_headless_execution_response_type.py b/src/datadog_api_client/v2/model/workflow_headless_execution_response_type.py new file mode 100644 index 0000000000..aa03fa6376 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_headless_execution_response_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WorkflowHeadlessExecutionResponseType(ModelSimple): + """ + The type for workflow headless execution response + + :param value: If omitted defaults to "workflow_headless_execution". Must be one of ["workflow_headless_execution"]. + :type value: str + """ + + allowed_values = { + "workflow_headless_execution", + } + WORKFLOW_HEADLESS_EXECUTION: ClassVar["WorkflowHeadlessExecutionResponseType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WorkflowHeadlessExecutionResponseType.WORKFLOW_HEADLESS_EXECUTION = WorkflowHeadlessExecutionResponseType( + "workflow_headless_execution" +) diff --git a/src/datadog_api_client/v2/model/workflow_webhook_execution_response.py b/src/datadog_api_client/v2/model/workflow_webhook_execution_response.py new file mode 100644 index 0000000000..38a10a1869 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_webhook_execution_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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_webhook_execution_response_data import ( + WorkflowWebhookExecutionResponseData, + ) + + +class WorkflowWebhookExecutionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_webhook_execution_response_data import ( + WorkflowWebhookExecutionResponseData, + ) + + return { + "data": (WorkflowWebhookExecutionResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: WorkflowWebhookExecutionResponseData, **kwargs): + """ + + + :param data: + :type data: WorkflowWebhookExecutionResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/workflow_webhook_execution_response_attributes.py b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_attributes.py new file mode 100644 index 0000000000..3e0ea7c7eb --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_attributes.py @@ -0,0 +1,40 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +class WorkflowWebhookExecutionResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "instance_id": (UUID,), + "workflow_id": (UUID,), + } + + attribute_map = { + "instance_id": "instance_id", + "workflow_id": "workflow_id", + } + + def __init__(self_, instance_id: UUID, workflow_id: UUID, **kwargs): + """ + + + :param instance_id: The ID of the workflow instance that was created + :type instance_id: UUID + + :param workflow_id: The ID of the workflow that was executed + :type workflow_id: UUID + """ + super().__init__(kwargs) + + self_.instance_id = instance_id + self_.workflow_id = workflow_id diff --git a/src/datadog_api_client/v2/model/workflow_webhook_execution_response_data.py b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_data.py new file mode 100644 index 0000000000..3b30858aef --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_data.py @@ -0,0 +1,68 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.workflow_webhook_execution_response_attributes import ( + WorkflowWebhookExecutionResponseAttributes, + ) + from datadog_api_client.v2.model.workflow_webhook_execution_response_type import ( + WorkflowWebhookExecutionResponseType, + ) + + +class WorkflowWebhookExecutionResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.workflow_webhook_execution_response_attributes import ( + WorkflowWebhookExecutionResponseAttributes, + ) + from datadog_api_client.v2.model.workflow_webhook_execution_response_type import ( + WorkflowWebhookExecutionResponseType, + ) + + return { + "attributes": (WorkflowWebhookExecutionResponseAttributes,), + "id": (str,), + "type": (WorkflowWebhookExecutionResponseType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: WorkflowWebhookExecutionResponseAttributes, + id: str, + type: WorkflowWebhookExecutionResponseType, + **kwargs, + ): + """ + + + :param attributes: + :type attributes: WorkflowWebhookExecutionResponseAttributes + + :param id: The unique identifier of the execution + :type id: str + + :param type: The type for workflow webhook execution response + :type type: WorkflowWebhookExecutionResponseType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/workflow_webhook_execution_response_type.py b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_type.py new file mode 100644 index 0000000000..7e0d9b7295 --- /dev/null +++ b/src/datadog_api_client/v2/model/workflow_webhook_execution_response_type.py @@ -0,0 +1,37 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class WorkflowWebhookExecutionResponseType(ModelSimple): + """ + The type for workflow webhook execution response + + :param value: If omitted defaults to "workflow_webhook_execution". Must be one of ["workflow_webhook_execution"]. + :type value: str + """ + + allowed_values = { + "workflow_webhook_execution", + } + WORKFLOW_WEBHOOK_EXECUTION: ClassVar["WorkflowWebhookExecutionResponseType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +WorkflowWebhookExecutionResponseType.WORKFLOW_WEBHOOK_EXECUTION = WorkflowWebhookExecutionResponseType( + "workflow_webhook_execution" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 4a34c20b16..d5e3adc2a3 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -5821,6 +5821,24 @@ from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType from datadog_api_client.v2.model.workflow_data_update import WorkflowDataUpdate from datadog_api_client.v2.model.workflow_data_update_attributes import WorkflowDataUpdateAttributes +from datadog_api_client.v2.model.workflow_favorite_request import WorkflowFavoriteRequest +from datadog_api_client.v2.model.workflow_favorite_request_attributes import WorkflowFavoriteRequestAttributes +from datadog_api_client.v2.model.workflow_favorite_request_data import WorkflowFavoriteRequestData +from datadog_api_client.v2.model.workflow_favorite_request_type import WorkflowFavoriteRequestType +from datadog_api_client.v2.model.workflow_headless_execution_config import WorkflowHeadlessExecutionConfig +from datadog_api_client.v2.model.workflow_headless_execution_connection import WorkflowHeadlessExecutionConnection +from datadog_api_client.v2.model.workflow_headless_execution_request import WorkflowHeadlessExecutionRequest +from datadog_api_client.v2.model.workflow_headless_execution_request_attributes import ( + WorkflowHeadlessExecutionRequestAttributes, +) +from datadog_api_client.v2.model.workflow_headless_execution_request_data import WorkflowHeadlessExecutionRequestData +from datadog_api_client.v2.model.workflow_headless_execution_request_type import WorkflowHeadlessExecutionRequestType +from datadog_api_client.v2.model.workflow_headless_execution_response import WorkflowHeadlessExecutionResponse +from datadog_api_client.v2.model.workflow_headless_execution_response_attributes import ( + WorkflowHeadlessExecutionResponseAttributes, +) +from datadog_api_client.v2.model.workflow_headless_execution_response_data import WorkflowHeadlessExecutionResponseData +from datadog_api_client.v2.model.workflow_headless_execution_response_type import WorkflowHeadlessExecutionResponseType 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 @@ -5833,6 +5851,12 @@ from datadog_api_client.v2.model.workflow_user_relationship import WorkflowUserRelationship from datadog_api_client.v2.model.workflow_user_relationship_data import WorkflowUserRelationshipData from datadog_api_client.v2.model.workflow_user_relationship_type import WorkflowUserRelationshipType +from datadog_api_client.v2.model.workflow_webhook_execution_response import WorkflowWebhookExecutionResponse +from datadog_api_client.v2.model.workflow_webhook_execution_response_attributes import ( + WorkflowWebhookExecutionResponseAttributes, +) +from datadog_api_client.v2.model.workflow_webhook_execution_response_data import WorkflowWebhookExecutionResponseData +from datadog_api_client.v2.model.workflow_webhook_execution_response_type import WorkflowWebhookExecutionResponseType 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 @@ -9996,6 +10020,20 @@ "WorkflowDataType", "WorkflowDataUpdate", "WorkflowDataUpdateAttributes", + "WorkflowFavoriteRequest", + "WorkflowFavoriteRequestAttributes", + "WorkflowFavoriteRequestData", + "WorkflowFavoriteRequestType", + "WorkflowHeadlessExecutionConfig", + "WorkflowHeadlessExecutionConnection", + "WorkflowHeadlessExecutionRequest", + "WorkflowHeadlessExecutionRequestAttributes", + "WorkflowHeadlessExecutionRequestData", + "WorkflowHeadlessExecutionRequestType", + "WorkflowHeadlessExecutionResponse", + "WorkflowHeadlessExecutionResponseAttributes", + "WorkflowHeadlessExecutionResponseData", + "WorkflowHeadlessExecutionResponseType", "WorkflowInstanceCreateMeta", "WorkflowInstanceCreateRequest", "WorkflowInstanceCreateResponse", @@ -10008,6 +10046,10 @@ "WorkflowUserRelationship", "WorkflowUserRelationshipData", "WorkflowUserRelationshipType", + "WorkflowWebhookExecutionResponse", + "WorkflowWebhookExecutionResponseAttributes", + "WorkflowWebhookExecutionResponseData", + "WorkflowWebhookExecutionResponseType", "WorklflowCancelInstanceResponse", "WorklflowCancelInstanceResponseData", "WorklflowGetInstanceResponse", diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index f77f242ff3..d8ac7affdc 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -5503,6 +5503,12 @@ "type": "safe" } }, + "ExecuteWorkflowFromTemplate": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, "CreateWorkflow": { "tag": "Workflow Automation", "undo": { @@ -5534,6 +5540,12 @@ "type": "idempotent" } }, + "UpdateWorkflowFavorite": { + "tag": "Workflow Automation", + "undo": { + "type": "idempotent" + } + }, "ListWorkflowInstances": { "tag": "Workflow Automation", "undo": { @@ -5557,5 +5569,11 @@ "undo": { "type": "safe" } + }, + "ExecuteWorkflowFromWebhook": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } } } diff --git a/tests/v2/features/workflow_automation.feature b/tests/v2/features/workflow_automation.feature index df51d50139..84f78187d4 100644 --- a/tests/v2/features/workflow_automation.feature +++ b/tests/v2/features/workflow_automation.feature @@ -66,6 +66,66 @@ Feature: Workflow Automation When the request is sent Then the response status is 204 Successfully deleted a workflow. + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a template returns "Bad Request" response + Given operation "ExecuteWorkflowFromTemplate" enabled + And new "ExecuteWorkflowFromTemplate" request + And request contains "parent_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"connections": [{"connection_id": "11111111-1111-1111-1111-111111111111", "label": "INTEGRATION_DATADOG"}], "inputs": {}}, "template_id": "template-789"}, "id": "1234", "type": "workflow_headless_execution_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a template returns "Not Found" response + Given operation "ExecuteWorkflowFromTemplate" enabled + And new "ExecuteWorkflowFromTemplate" request + And request contains "parent_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"connections": [{"connection_id": "11111111-1111-1111-1111-111111111111", "label": "INTEGRATION_DATADOG"}], "inputs": {}}, "template_id": "template-789"}, "id": "1234", "type": "workflow_headless_execution_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a template returns "OK" response + Given operation "ExecuteWorkflowFromTemplate" enabled + And new "ExecuteWorkflowFromTemplate" request + And request contains "parent_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"config": {"connections": [{"connection_id": "11111111-1111-1111-1111-111111111111", "label": "INTEGRATION_DATADOG"}], "inputs": {}}, "template_id": "template-789"}, "id": "1234", "type": "workflow_headless_execution_request"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a webhook returns "Bad Request" response + Given operation "ExecuteWorkflowFromWebhook" enabled + And new "ExecuteWorkflowFromWebhook" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And request contains "orgId" parameter from "REPLACE.ME" + And request contains "X-Hub-Signature-256" parameter from "REPLACE.ME" + And request contains "User-Agent" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a webhook returns "Not Found" response + Given operation "ExecuteWorkflowFromWebhook" enabled + And new "ExecuteWorkflowFromWebhook" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And request contains "orgId" parameter from "REPLACE.ME" + And request contains "X-Hub-Signature-256" parameter from "REPLACE.ME" + And request contains "User-Agent" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow from a webhook returns "OK" response + Given operation "ExecuteWorkflowFromWebhook" enabled + And new "ExecuteWorkflowFromWebhook" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And request contains "orgId" parameter from "REPLACE.ME" + And request contains "X-Hub-Signature-256" parameter from "REPLACE.ME" + And request contains "User-Agent" parameter from "REPLACE.ME" + 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 @@ -167,3 +227,30 @@ Feature: Workflow Automation And body with value {"data": {"attributes": {"description": "A sample workflow.", "name": "Example Workflow", "published": true, "spec": {"connectionEnvs": [{"connections": [{"connectionId": "11111111-1111-1111-1111-111111111111", "label": "INTEGRATION_DATADOG"}], "env": "default"}], "inputSchema": {"parameters": [{"defaultValue": "default", "name": "input", "type": "STRING"}]}, "outputSchema": {"parameters": [{"name": "output", "type": "ARRAY_OBJECT", "value": "outputValue"}]}, "steps": [{"actionId": "com.datadoghq.dd.monitor.listMonitors", "connectionLabel": "INTEGRATION_DATADOG", "name": "Step1", "outboundEdges": [{"branchName": "main", "nextStepName": "Step2"}], "parameters": [{"name": "tags", "value": "service:monitoring"}]}, {"actionId": "com.datadoghq.core.noop", "name": "Step2"}], "triggers": [{"monitorTrigger": {"rateLimit": {"count": 1, "interval": "3600s"}}, "startStepNames": ["Step1"]}, {"startStepNames": ["Step1"], "githubWebhookTrigger": {}}]}, "tags": ["team:infra", "service:monitoring", "foo:bar"]}, "id": "22222222-2222-2222-2222-222222222222", "type": "workflows"}} When the request is sent Then the response status is 200 Successfully updated a workflow. + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Update workflow favorite status returns "Bad Request" response + Given operation "UpdateWorkflowFavorite" enabled + And new "UpdateWorkflowFavorite" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"favorite": true}, "type": "workflow_favorite_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Update workflow favorite status returns "No Content" response + Given operation "UpdateWorkflowFavorite" enabled + And new "UpdateWorkflowFavorite" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"favorite": true}, "type": "workflow_favorite_request"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/workflow-automation-dev + Scenario: Update workflow favorite status returns "Not Found" response + Given operation "UpdateWorkflowFavorite" enabled + And new "UpdateWorkflowFavorite" request + And request contains "workflow_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"favorite": true}, "type": "workflow_favorite_request"}} + When the request is sent + Then the response status is 404 Not Found