Skip to content

Commit e3307b8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1e79ef0 of spec repo
1 parent 6a881df commit e3307b8

10 files changed

+197
-8
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5847,7 +5847,7 @@ components:
58475847
description: Request object.
58485848
properties:
58495849
data:
5850-
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
5850+
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataSingleOrArray'
58515851
type: object
58525852
CIAppCreatePipelineEventRequestAttributes:
58535853
description: Attributes of the pipeline event to create.
@@ -5883,6 +5883,16 @@ components:
58835883
type:
58845884
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataType'
58855885
type: object
5886+
CIAppCreatePipelineEventRequestDataArray:
5887+
description: Array of pipeline events to create in batch.
5888+
items:
5889+
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
5890+
type: array
5891+
CIAppCreatePipelineEventRequestDataSingleOrArray:
5892+
description: Data of the pipeline events to create.
5893+
oneOf:
5894+
- $ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
5895+
- $ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataArray'
58865896
CIAppCreatePipelineEventRequestDataType:
58875897
default: cipipeline_resource_request
58885898
description: Type of the event.
@@ -49695,6 +49705,9 @@ paths:
4969549705
we support, see [Pipeline Data Model And Execution Types](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/).
4969649706

4969749707

49708+
Multiple events can be sent in an array (up to 1000).
49709+
49710+
4969849711
Pipeline events can be submitted with a timestamp that is up to 18 hours in
4969949712
the past.'
4970049713
operationId: CreateCIAppPipelineEvent

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,6 +2671,13 @@ datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data mo
26712671
:members:
26722672
:show-inheritance:
26732673

2674+
datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data\_single\_or\_array module
2675+
-------------------------------------------------------------------------------------------------------
2676+
2677+
.. automodule:: datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array
2678+
:members:
2679+
:show-inheritance:
2680+
26742681
datadog\_api\_client.v2.model.ci\_app\_create\_pipeline\_event\_request\_data\_type module
26752682
------------------------------------------------------------------------------------------
26762683

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"""
2+
Send several pipeline events returns "Request accepted for processing" response
3+
"""
4+
5+
from datetime import datetime
6+
from dateutil.relativedelta import relativedelta
7+
from datadog_api_client import ApiClient, Configuration
8+
from datadog_api_client.v2.api.ci_visibility_pipelines_api import CIVisibilityPipelinesApi
9+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request import CIAppCreatePipelineEventRequest
10+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_attributes import (
11+
CIAppCreatePipelineEventRequestAttributes,
12+
)
13+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import CIAppCreatePipelineEventRequestData
14+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_type import (
15+
CIAppCreatePipelineEventRequestDataType,
16+
)
17+
from datadog_api_client.v2.model.ci_app_git_info import CIAppGitInfo
18+
from datadog_api_client.v2.model.ci_app_pipeline_event_finished_pipeline import CIAppPipelineEventFinishedPipeline
19+
from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_level import CIAppPipelineEventPipelineLevel
20+
from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_status import CIAppPipelineEventPipelineStatus
21+
22+
body = CIAppCreatePipelineEventRequest(
23+
data=[
24+
CIAppCreatePipelineEventRequestData(
25+
attributes=CIAppCreatePipelineEventRequestAttributes(
26+
provider_name="example-provider",
27+
resource=CIAppPipelineEventFinishedPipeline(
28+
level=CIAppPipelineEventPipelineLevel.PIPELINE,
29+
unique_id="3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
30+
name="Deploy to AWS",
31+
url="https://my-ci-provider.example/pipelines/my-pipeline/run/1",
32+
start=(datetime.now() + relativedelta(seconds=-120)),
33+
end=(datetime.now() + relativedelta(seconds=-30)),
34+
status=CIAppPipelineEventPipelineStatus.SUCCESS,
35+
partial_retry=False,
36+
git=CIAppGitInfo(
37+
repository_url="https://github.com/DataDog/datadog-agent",
38+
sha="7f263865994b76066c4612fd1965215e7dcb4cd2",
39+
author_email="[email protected]",
40+
),
41+
),
42+
),
43+
type=CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST,
44+
),
45+
CIAppCreatePipelineEventRequestData(
46+
attributes=CIAppCreatePipelineEventRequestAttributes(
47+
provider_name="example-provider",
48+
resource=CIAppPipelineEventFinishedPipeline(
49+
level=CIAppPipelineEventPipelineLevel.PIPELINE,
50+
unique_id="7b2c8f9e-aa15-4d22-9c7d-83f4e065138b",
51+
name="Deploy to Production",
52+
url="https://my-ci-provider.example/pipelines/prod-pipeline/run/2",
53+
start=(datetime.now() + relativedelta(seconds=-180)),
54+
end=(datetime.now() + relativedelta(seconds=-45)),
55+
status=CIAppPipelineEventPipelineStatus.SUCCESS,
56+
partial_retry=False,
57+
git=CIAppGitInfo(
58+
repository_url="https://github.com/DataDog/datadog-agent",
59+
sha="9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e",
60+
author_email="[email protected]",
61+
),
62+
),
63+
),
64+
type=CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST,
65+
),
66+
],
67+
)
68+
69+
configuration = Configuration()
70+
with ApiClient(configuration) as api_client:
71+
api_instance = CIVisibilityPipelinesApi(api_client)
72+
response = api_instance.create_ci_app_pipeline_event(body=body)
73+
74+
print(response)

src/datadog_api_client/v2/api/ci_visibility_pipelines_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def create_ci_app_pipeline_event(
169169
170170
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/>`_.
171171
172+
Multiple events can be sent in an array (up to 1000).
173+
172174
Pipeline events can be submitted with a timestamp that is up to 18 hours in the past.
173175
174176
:type body: CIAppCreatePipelineEventRequest

src/datadog_api_client/v2/model/ci_app_create_pipeline_event_request.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Union, TYPE_CHECKING
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
@@ -14,6 +14,9 @@
1414

1515

1616
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import (
18+
CIAppCreatePipelineEventRequestDataSingleOrArray,
19+
)
1720
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import (
1821
CIAppCreatePipelineEventRequestData,
1922
)
@@ -22,24 +25,33 @@
2225
class CIAppCreatePipelineEventRequest(ModelNormal):
2326
@cached_property
2427
def openapi_types(_):
25-
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import (
26-
CIAppCreatePipelineEventRequestData,
28+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import (
29+
CIAppCreatePipelineEventRequestDataSingleOrArray,
2730
)
2831

2932
return {
30-
"data": (CIAppCreatePipelineEventRequestData,),
33+
"data": (CIAppCreatePipelineEventRequestDataSingleOrArray,),
3134
}
3235

3336
attribute_map = {
3437
"data": "data",
3538
}
3639

37-
def __init__(self_, data: Union[CIAppCreatePipelineEventRequestData, UnsetType] = unset, **kwargs):
40+
def __init__(
41+
self_,
42+
data: Union[
43+
CIAppCreatePipelineEventRequestDataSingleOrArray,
44+
CIAppCreatePipelineEventRequestData,
45+
List[CIAppCreatePipelineEventRequestData],
46+
UnsetType,
47+
] = unset,
48+
**kwargs,
49+
):
3850
"""
3951
Request object.
4052
41-
:param data: Data of the pipeline event to create.
42-
:type data: CIAppCreatePipelineEventRequestData, optional
53+
:param data: Data of the pipeline events to create.
54+
:type data: CIAppCreatePipelineEventRequestDataSingleOrArray, optional
4355
"""
4456
if data is not unset:
4557
kwargs["data"] = data
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelComposed,
9+
cached_property,
10+
)
11+
12+
13+
class CIAppCreatePipelineEventRequestDataSingleOrArray(ModelComposed):
14+
def __init__(self, **kwargs):
15+
"""
16+
Data of the pipeline events to create.
17+
18+
:param attributes: Attributes of the pipeline event to create.
19+
:type attributes: CIAppCreatePipelineEventRequestAttributes, optional
20+
21+
:param type: Type of the event.
22+
:type type: CIAppCreatePipelineEventRequestDataType, optional
23+
"""
24+
super().__init__(kwargs)
25+
26+
@cached_property
27+
def _composed_schemas(_):
28+
# we need this here to make our import statements work
29+
# we must store _composed_schemas in here so the code is only run
30+
# when we invoke this method. If we kept this at the class
31+
# level we would get an error because the class level
32+
# code would be run when this module is imported, and these composed
33+
# classes don't exist yet because their module has not finished
34+
# loading
35+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import (
36+
CIAppCreatePipelineEventRequestData,
37+
)
38+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import (
39+
CIAppCreatePipelineEventRequestData,
40+
)
41+
42+
return {
43+
"oneOf": [
44+
CIAppCreatePipelineEventRequestData,
45+
[CIAppCreatePipelineEventRequestData],
46+
],
47+
}

src/datadog_api_client/v2/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@
422422
CIAppCreatePipelineEventRequestAttributesResource,
423423
)
424424
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import CIAppCreatePipelineEventRequestData
425+
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_single_or_array import (
426+
CIAppCreatePipelineEventRequestDataSingleOrArray,
427+
)
425428
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_type import (
426429
CIAppCreatePipelineEventRequestDataType,
427430
)
@@ -4338,6 +4341,7 @@
43384341
"CIAppCreatePipelineEventRequestAttributes",
43394342
"CIAppCreatePipelineEventRequestAttributesResource",
43404343
"CIAppCreatePipelineEventRequestData",
4344+
"CIAppCreatePipelineEventRequestDataSingleOrArray",
43414345
"CIAppCreatePipelineEventRequestDataType",
43424346
"CIAppEventAttributes",
43434347
"CIAppGitInfo",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-02T15:10:26.479Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
interactions:
2+
- request:
3+
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
4+
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
5+
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"}]}'
6+
headers:
7+
accept:
8+
- application/json
9+
content-type:
10+
- application/json
11+
method: POST
12+
uri: https://api.datadoghq.com/api/v2/ci/pipeline
13+
response:
14+
body:
15+
string: '{"data":null}'
16+
headers:
17+
content-type:
18+
- application/vnd.api+json
19+
status:
20+
code: 202
21+
message: Accepted
22+
version: 1

tests/v2/features/ci_visibility_pipelines.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ Feature: CI Visibility Pipelines
128128
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"}}
129129
When the request is sent
130130
Then the response status is 202 Request accepted for processing
131+
132+
@team:DataDog/ci-app-backend
133+
Scenario: Send several pipeline events returns "Request accepted for processing" response
134+
Given new "CreateCIAppPipelineEvent" request
135+
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"}]}
136+
When the request is sent
137+
Then the response status is 202 Request accepted for processing

0 commit comments

Comments
 (0)