Skip to content

Commit cef300d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1e79ef0 of spec repo
1 parent 3d8e135 commit cef300d

File tree

9 files changed

+168
-3
lines changed

9 files changed

+168
-3
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-02T15:10:26.479Z

cassettes/features/v2/ci_visibility_pipelines/Send-several-pipeline-events-returns-Request-accepted-for-processing-response.yml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Send several pipeline events returns "Request accepted for processing" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new
5+
6+
body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({
7+
data: [
8+
DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({
9+
attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({
10+
provider_name: "example-provider",
11+
resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({
12+
level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE,
13+
unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
14+
name: "Deploy to AWS",
15+
url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1",
16+
start: (Time.now + -120),
17+
_end: (Time.now + -30),
18+
status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS,
19+
partial_retry: false,
20+
git: DatadogAPIClient::V2::CIAppGitInfo.new({
21+
repository_url: "https://github.com/DataDog/datadog-agent",
22+
sha: "7f263865994b76066c4612fd1965215e7dcb4cd2",
23+
author_email: "john.doe@email.com",
24+
}),
25+
}),
26+
}),
27+
type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST,
28+
}),
29+
DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({
30+
attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({
31+
provider_name: "example-provider",
32+
resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({
33+
level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE,
34+
unique_id: "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b",
35+
name: "Deploy to Production",
36+
url: "https://my-ci-provider.example/pipelines/prod-pipeline/run/2",
37+
start: (Time.now + -180),
38+
_end: (Time.now + -45),
39+
status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS,
40+
partial_retry: false,
41+
git: DatadogAPIClient::V2::CIAppGitInfo.new({
42+
repository_url: "https://github.com/DataDog/datadog-agent",
43+
sha: "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e",
44+
author_email: "jane.smith@email.com",
45+
}),
46+
}),
47+
}),
48+
type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST,
49+
}),
50+
],
51+
})
52+
p api_instance.create_ci_app_pipeline_event(body)

features/v2/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": "john.doe@email.com"}}},"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": "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"}]}
136+
When the request is sent
137+
Then the response status is 202 Request accepted for processing

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,7 @@ def overrides
13191319
"v2.ci_app_create_pipeline_event_request_attributes" => "CIAppCreatePipelineEventRequestAttributes",
13201320
"v2.ci_app_create_pipeline_event_request_attributes_resource" => "CIAppCreatePipelineEventRequestAttributesResource",
13211321
"v2.ci_app_create_pipeline_event_request_data" => "CIAppCreatePipelineEventRequestData",
1322+
"v2.ci_app_create_pipeline_event_request_data_single_or_array" => "CIAppCreatePipelineEventRequestDataSingleOrArray",
13221323
"v2.ci_app_create_pipeline_event_request_data_type" => "CIAppCreatePipelineEventRequestDataType",
13231324
"v2.ci_app_event_attributes" => "CIAppEventAttributes",
13241325
"v2.ci_app_git_info" => "CIAppGitInfo",

lib/datadog_api_client/v2/api/ci_visibility_pipelines_api.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ def create_ci_app_pipeline_event(body, opts = {})
102102
#
103103
# 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/).
104104
#
105+
# Multiple events can be sent in an array (up to 1000).
106+
#
105107
# Pipeline events can be submitted with a timestamp that is up to 18 hours in the past.
106108
#
107109
# @param body [CIAppCreatePipelineEventRequest]

lib/datadog_api_client/v2/models/ci_app_create_pipeline_event_request.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module DatadogAPIClient::V2
2121
class CIAppCreatePipelineEventRequest
2222
include BaseGenericModel
2323

24-
# Data of the pipeline event to create.
24+
# Data of the pipeline events to create.
2525
attr_accessor :data
2626

2727
attr_accessor :additional_properties
@@ -38,7 +38,7 @@ def self.attribute_map
3838
# @!visibility private
3939
def self.openapi_types
4040
{
41-
:'data' => :'CIAppCreatePipelineEventRequestData'
41+
:'data' => :'CIAppCreatePipelineEventRequestDataSingleOrArray'
4242
}
4343
end
4444

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Data of the pipeline events to create.
21+
module CIAppCreatePipelineEventRequestDataSingleOrArray
22+
class << self
23+
include BaseOneOfModel
24+
include BaseOneOfModelNoDiscriminator
25+
26+
# List of class defined in oneOf (OpenAPI v3)
27+
def openapi_one_of
28+
[
29+
:'CIAppCreatePipelineEventRequestData',
30+
:'Array<CIAppCreatePipelineEventRequestData>'
31+
]
32+
end
33+
# Builds the object
34+
# @param data [Mixed] Data to be matched against the list of oneOf items
35+
# @return [Object] Returns the model or the data itself
36+
def build(data)
37+
# Go through the list of oneOf items and attempt to identify the appropriate one.
38+
# Note:
39+
# - We do not attempt to check whether exactly one item matches.
40+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
41+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
42+
# - TODO: scalar values are de facto behaving as if they were nullable.
43+
# - TODO: logging when debugging is set.
44+
openapi_one_of.each do |klass|
45+
begin
46+
next if klass == :AnyType # "nullable: true"
47+
typed_data = find_and_cast_into_type(klass, data)
48+
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
49+
return typed_data if typed_data
50+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
51+
end
52+
end
53+
54+
if openapi_one_of.include?(:AnyType)
55+
data
56+
else
57+
self._unparsed = true
58+
DatadogAPIClient::UnparsedObject.new(data)
59+
end
60+
end
61+
end
62+
end
63+
end

0 commit comments

Comments
 (0)