From b26ac4bc7ea966d52535246dc4970509efa03620 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 12 Sep 2025 09:18:38 +0000 Subject: [PATCH] Regenerate client from commit ed6e2be of spec repo --- .generator/schemas/v2/openapi.yaml | 15 +++- docs/datadog_api_client.v2.model.rst | 7 ++ .../CreateCIAppPipelineEvent_2836340212.py | 74 +++++++++++++++++++ .../v2/api/ci_visibility_pipelines_api.py | 2 + .../ci_app_create_pipeline_event_request.py | 26 +++++-- ...line_event_request_data_single_or_array.py | 47 ++++++++++++ src/datadog_api_client/v2/models/__init__.py | 4 + ...st_accepted_for_processing_response.frozen | 1 + ...uest_accepted_for_processing_response.yaml | 22 ++++++ .../features/ci_visibility_pipelines.feature | 25 ++++--- 10 files changed, 206 insertions(+), 17 deletions(-) create mode 100644 examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2836340212.py create mode 100644 src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request_data_single_or_array.py create mode 100644 tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.yaml diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 011c51ec12..b915e9a885 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5994,7 +5994,7 @@ components: description: Request object. properties: data: - $ref: '#/components/schemas/CIAppCreatePipelineEventRequestData' + $ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataSingleOrArray' type: object CIAppCreatePipelineEventRequestAttributes: description: Attributes of the pipeline event to create. @@ -6030,6 +6030,16 @@ components: type: $ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataType' type: object + CIAppCreatePipelineEventRequestDataArray: + description: Array of pipeline events to create in batch. + items: + $ref: '#/components/schemas/CIAppCreatePipelineEventRequestData' + type: array + CIAppCreatePipelineEventRequestDataSingleOrArray: + description: Data of the pipeline events to create. + oneOf: + - $ref: '#/components/schemas/CIAppCreatePipelineEventRequestData' + - $ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataArray' CIAppCreatePipelineEventRequestDataType: default: cipipeline_resource_request description: Type of the event. @@ -51718,6 +51728,9 @@ paths: we support, see [Pipeline Data Model And Execution Types](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/). + Multiple events can be sent in an array (up to 1000). + + Pipeline events can be submitted with a timestamp that is up to 18 hours in the past.' operationId: CreateCIAppPipelineEvent diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 4f30717b4f..1c4562c8ec 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -2692,6 +2692,13 @@ datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data mo :members: :show-inheritance: +datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data\_single\_or\_array module +------------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array + :members: + :show-inheritance: + datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data\_type module ------------------------------------------------------------------------------------------ diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2836340212.py b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2836340212.py new file mode 100644 index 0000000000..d27358426b --- /dev/null +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2836340212.py @@ -0,0 +1,74 @@ +""" +Send several pipeline events returns "Request accepted for processing" response +""" + +from datetime import datetime +from dateutil.relativedelta import relativedelta +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.ci_visibility_pipelines_api import CIVisibilityPipelinesApi +from datadog_api_client.v2.model.ci_app_create_pipeline_event_request import CIAppCreatePipelineEventRequest +from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_attributes import ( + CIAppCreatePipelineEventRequestAttributes, +) +from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import CIAppCreatePipelineEventRequestData +from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_type import ( + CIAppCreatePipelineEventRequestDataType, +) +from datadog_api_client.v2.model.ci_app_git_info import CIAppGitInfo +from datadog_api_client.v2.model.ci_app_pipeline_event_finished_pipeline import CIAppPipelineEventFinishedPipeline +from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_level import CIAppPipelineEventPipelineLevel +from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_status import CIAppPipelineEventPipelineStatus + +body = CIAppCreatePipelineEventRequest( + data=[ + CIAppCreatePipelineEventRequestData( + attributes=CIAppCreatePipelineEventRequestAttributes( + provider_name="example-provider", + resource=CIAppPipelineEventFinishedPipeline( + level=CIAppPipelineEventPipelineLevel.PIPELINE, + unique_id="3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + name="Deploy to AWS", + url="https://my-ci-provider.example/pipelines/my-pipeline/run/1", + start=(datetime.now() + relativedelta(seconds=-120)), + end=(datetime.now() + relativedelta(seconds=-30)), + status=CIAppPipelineEventPipelineStatus.SUCCESS, + partial_retry=False, + git=CIAppGitInfo( + repository_url="https://github.com/DataDog/datadog-agent", + sha="7f263865994b76066c4612fd1965215e7dcb4cd2", + author_email="john.doe@email.com", + ), + ), + ), + type=CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST, + ), + CIAppCreatePipelineEventRequestData( + attributes=CIAppCreatePipelineEventRequestAttributes( + provider_name="example-provider", + resource=CIAppPipelineEventFinishedPipeline( + level=CIAppPipelineEventPipelineLevel.PIPELINE, + unique_id="7b2c8f9e-aa15-4d22-9c7d-83f4e065138b", + name="Deploy to Production", + url="https://my-ci-provider.example/pipelines/prod-pipeline/run/2", + start=(datetime.now() + relativedelta(seconds=-180)), + end=(datetime.now() + relativedelta(seconds=-45)), + status=CIAppPipelineEventPipelineStatus.SUCCESS, + partial_retry=False, + git=CIAppGitInfo( + repository_url="https://github.com/DataDog/datadog-agent", + sha="9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e", + author_email="jane.smith@email.com", + ), + ), + ), + type=CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST, + ), + ], +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CIVisibilityPipelinesApi(api_client) + response = api_instance.create_ci_app_pipeline_event(body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/ci_visibility_pipelines_api.py b/src/datadog_api_client/v2/api/ci_visibility_pipelines_api.py index 60bc5ee1ad..e83dadf1e6 100644 --- a/src/datadog_api_client/v2/api/ci_visibility_pipelines_api.py +++ b/src/datadog_api_client/v2/api/ci_visibility_pipelines_api.py @@ -169,6 +169,8 @@ def create_ci_app_pipeline_event( Send your pipeline event to your Datadog platform over HTTP. For details about how pipeline executions are modeled and what execution types we support, see `Pipeline Data Model And Execution Types `_. + Multiple events can be sent in an array (up to 1000). + Pipeline events can be submitted with a timestamp that is up to 18 hours in the past. :type body: CIAppCreatePipelineEventRequest diff --git a/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request.py b/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request.py index 006953fa9b..e0ac57ca34 100644 --- a/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request.py +++ b/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -14,6 +14,9 @@ if TYPE_CHECKING: + from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import ( + CIAppCreatePipelineEventRequestDataSingleOrArray, + ) from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import ( CIAppCreatePipelineEventRequestData, ) @@ -22,24 +25,33 @@ class CIAppCreatePipelineEventRequest(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import ( - CIAppCreatePipelineEventRequestData, + from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import ( + CIAppCreatePipelineEventRequestDataSingleOrArray, ) return { - "data": (CIAppCreatePipelineEventRequestData,), + "data": (CIAppCreatePipelineEventRequestDataSingleOrArray,), } attribute_map = { "data": "data", } - def __init__(self_, data: Union[CIAppCreatePipelineEventRequestData, UnsetType] = unset, **kwargs): + def __init__( + self_, + data: Union[ + CIAppCreatePipelineEventRequestDataSingleOrArray, + CIAppCreatePipelineEventRequestData, + List[CIAppCreatePipelineEventRequestData], + UnsetType, + ] = unset, + **kwargs, + ): """ Request object. - :param data: Data of the pipeline event to create. - :type data: CIAppCreatePipelineEventRequestData, optional + :param data: Data of the pipeline events to create. + :type data: CIAppCreatePipelineEventRequestDataSingleOrArray, optional """ if data is not unset: kwargs["data"] = data diff --git a/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request_data_single_or_array.py b/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request_data_single_or_array.py new file mode 100644 index 0000000000..b3f928db1e --- /dev/null +++ b/src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request_data_single_or_array.py @@ -0,0 +1,47 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class CIAppCreatePipelineEventRequestDataSingleOrArray(ModelComposed): + def __init__(self, **kwargs): + """ + Data of the pipeline events to create. + + :param attributes: Attributes of the pipeline event to create. + :type attributes: CIAppCreatePipelineEventRequestAttributes, optional + + :param type: Type of the event. + :type type: CIAppCreatePipelineEventRequestDataType, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import ( + CIAppCreatePipelineEventRequestData, + ) + from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import ( + CIAppCreatePipelineEventRequestData, + ) + + return { + "oneOf": [ + CIAppCreatePipelineEventRequestData, + [CIAppCreatePipelineEventRequestData], + ], + } diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index e5ba828e5c..2804329b11 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -427,6 +427,9 @@ CIAppCreatePipelineEventRequestAttributesResource, ) from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import CIAppCreatePipelineEventRequestData +from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import ( + CIAppCreatePipelineEventRequestDataSingleOrArray, +) from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_type import ( CIAppCreatePipelineEventRequestDataType, ) @@ -4506,6 +4509,7 @@ "CIAppCreatePipelineEventRequestAttributes", "CIAppCreatePipelineEventRequestAttributesResource", "CIAppCreatePipelineEventRequestData", + "CIAppCreatePipelineEventRequestDataSingleOrArray", "CIAppCreatePipelineEventRequestDataType", "CIAppEventAttributes", "CIAppGitInfo", diff --git a/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.frozen b/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.frozen new file mode 100644 index 0000000000..8404e45ce4 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.frozen @@ -0,0 +1 @@ +2025-09-02T15:10:26.479Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.yaml b/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.yaml new file mode 100644 index 0000000000..b5173ef307 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_send_several_pipeline_events_returns_request_accepted_for_processing_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"data":[{"attributes":{"provider_name":"example-provider","resource":{"end":"2025-09-02T15:09:56.479Z","git":{"author_email":"john.doe@email.com","repository_url":"https://github.com/DataDog/datadog-agent","sha":"7f263865994b76066c4612fd1965215e7dcb4cd2"},"level":"pipeline","name":"Deploy + to AWS","partial_retry":false,"start":"2025-09-02T15:08:26.479Z","status":"success","unique_id":"3eacb6f3-ff04-4e10-8a9c-46e6d054024a","url":"https://my-ci-provider.example/pipelines/my-pipeline/run/1"}},"type":"cipipeline_resource_request"},{"attributes":{"provider_name":"example-provider","resource":{"end":"2025-09-02T15:09:41.479Z","git":{"author_email":"jane.smith@email.com","repository_url":"https://github.com/DataDog/datadog-agent","sha":"9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e"},"level":"pipeline","name":"Deploy + to Production","partial_retry":false,"start":"2025-09-02T15:07:26.479Z","status":"success","unique_id":"7b2c8f9e-aa15-4d22-9c7d-83f4e065138b","url":"https://my-ci-provider.example/pipelines/prod-pipeline/run/2"}},"type":"cipipeline_resource_request"}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/ci/pipeline + response: + body: + string: '{"data":null}' + headers: + content-type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +version: 1 diff --git a/tests/v2/features/ci_visibility_pipelines.feature b/tests/v2/features/ci_visibility_pipelines.feature index fa0a20d1d5..3c52a30f4b 100644 --- a/tests/v2/features/ci_visibility_pipelines.feature +++ b/tests/v2/features/ci_visibility_pipelines.feature @@ -17,7 +17,7 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 400 Bad Request - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Aggregate pipelines events returns "OK" response Given a valid "appKeyAuth" key in the system And new "AggregateCIAppPipelineEvents" request @@ -33,7 +33,7 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 400 Bad Request - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Get a list of pipelines events returns "OK" response Given a valid "appKeyAuth" key in the system And new "ListCIAppPipelineEvents" request @@ -44,7 +44,7 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 200 OK - @replay-only @skip-validation @team:DataDog/ci-app-backend @with-pagination + @replay-only @skip-java @skip-python @skip-typescript @skip-validation @team:DataDog/ci-app-backend @with-pagination Scenario: Get a list of pipelines events returns "OK" response with pagination Given a valid "appKeyAuth" key in the system And new "ListCIAppPipelineEvents" request @@ -63,7 +63,7 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 400 Bad Request - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Search pipelines events returns "OK" response Given a valid "appKeyAuth" key in the system And new "SearchCIAppPipelineEvents" request @@ -71,7 +71,7 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 200 OK - @replay-only @skip-validation @team:DataDog/ci-app-backend @with-pagination + @replay-only @skip-java @skip-python @skip-typescript @skip-validation @team:DataDog/ci-app-backend @with-pagination Scenario: Search pipelines events returns "OK" response with pagination Given a valid "appKeyAuth" key in the system And new "SearchCIAppPipelineEvents" request @@ -101,30 +101,37 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 408 Request Timeout - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Send pipeline event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request And body with value {"data": {"attributes": {"resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}} When the request is sent Then the response status is 202 Request accepted for processing - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Send pipeline event with custom provider returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request And body with value {"data": {"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}} When the request is sent Then the response status is 202 Request accepted for processing - @skip @team:DataDog/ci-app-backend + @skip @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Send pipeline job event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request And body with value {"data": {"attributes": {"resource": {"level": "job", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "name": "Build image", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "start": "{{ timeISO('now - 120s') }}", "end": "{{ timeISO('now - 30s') }}", "status": "error", "url": "https://my-ci-provider.example/jobs/my-jobs/run/1"}}, "type": "cipipeline_resource_request"}} When the request is sent Then the response status is 202 Request accepted for processing - @team:DataDog/ci-app-backend + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Send running pipeline event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request And body with value {"data": {"attributes": {"resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","status": "running","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}} When the request is sent Then the response status is 202 Request accepted for processing + + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend + Scenario: Send several pipeline events returns "Request accepted for processing" response + Given new "CreateCIAppPipelineEvent" request + And body with value {"data": [{"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"},{"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b","name": "Deploy to Production","url": "https://my-ci-provider.example/pipelines/prod-pipeline/run/2","start": "{{ timeISO('now - 180s') }}","end": "{{ timeISO('now - 45s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e","author_email": "jane.smith@email.com"}}},"type": "cipipeline_resource_request"}]} + When the request is sent + Then the response status is 202 Request accepted for processing