Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5847,7 +5847,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.
Expand Down Expand Up @@ -5883,6 +5883,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.
Expand Down Expand Up @@ -49695,6 +49705,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
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,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
------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
),
),
),
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="[email protected]",
),
),
),
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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.
:type body: CIAppCreatePipelineEventRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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],
],
}
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,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,
)
Expand Down Expand Up @@ -4338,6 +4341,7 @@
"CIAppCreatePipelineEventRequestAttributes",
"CIAppCreatePipelineEventRequestAttributesResource",
"CIAppCreatePipelineEventRequestData",
"CIAppCreatePipelineEventRequestDataSingleOrArray",
"CIAppCreatePipelineEventRequestDataType",
"CIAppEventAttributes",
"CIAppGitInfo",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-09-02T15:10:26.479Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
interactions:
- request:
body: '{"data":[{"attributes":{"provider_name":"example-provider","resource":{"end":"2025-09-02T15:09:56.479Z","git":{"author_email":"[email protected]","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":"[email protected]","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
7 changes: 7 additions & 0 deletions tests/v2/features/ci_visibility_pipelines.feature
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,10 @@ Feature: CI Visibility Pipelines
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": "[email protected]"}}},"type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@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": "[email protected]"}}},"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": "[email protected]"}}},"type": "cipipeline_resource_request"}]}
When the request is sent
Then the response status is 202 Request accepted for processing
Loading