Skip to content

Commit 39b7d4e

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 9b78f561 of spec repo
1 parent c7b4bbf commit 39b7d4e

7 files changed

+139
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-01-08 14:02:28.490914",
8-
"spec_repo_commit": "1920836f"
7+
"regenerated": "2025-01-09 14:28:27.871332",
8+
"spec_repo_commit": "9b78f561"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-08 14:02:28.507147",
13-
"spec_repo_commit": "1920836f"
12+
"regenerated": "2025-01-09 14:28:27.886206",
13+
"spec_repo_commit": "9b78f561"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,9 @@ components:
33823382
env:
33833383
description: The Datadog environment.
33843384
type: string
3385+
provider_name:
3386+
description: The name of the CI provider. By default, this is "custom".
3387+
type: string
33853388
resource:
33863389
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestAttributesResource'
33873390
service:
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Send pipeline event with custom provider returns "Request accepted for
2+
// processing" response
3+
use chrono::{DateTime, Utc};
4+
use datadog_api_client::datadog;
5+
use datadog_api_client::datadogV2::api_ci_visibility_pipelines::CIVisibilityPipelinesAPI;
6+
use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequest;
7+
use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestAttributes;
8+
use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestAttributesResource;
9+
use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestData;
10+
use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestDataType;
11+
use datadog_api_client::datadogV2::model::CIAppGitInfo;
12+
use datadog_api_client::datadogV2::model::CIAppPipelineEventFinishedPipeline;
13+
use datadog_api_client::datadogV2::model::CIAppPipelineEventPipeline;
14+
use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineLevel;
15+
use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineStatus;
16+
17+
#[tokio::main]
18+
async fn main() {
19+
let body =
20+
CIAppCreatePipelineEventRequest
21+
::new().data(
22+
CIAppCreatePipelineEventRequestData::new()
23+
.attributes(
24+
CIAppCreatePipelineEventRequestAttributes::new(
25+
CIAppCreatePipelineEventRequestAttributesResource::CIAppPipelineEventPipeline(
26+
Box::new(
27+
CIAppPipelineEventPipeline::CIAppPipelineEventFinishedPipeline(
28+
Box::new(
29+
CIAppPipelineEventFinishedPipeline::new(
30+
DateTime::parse_from_rfc3339("2021-11-11T11:10:41+00:00")
31+
.expect("Failed to parse datetime")
32+
.with_timezone(&Utc),
33+
CIAppPipelineEventPipelineLevel::PIPELINE,
34+
"Deploy to AWS".to_string(),
35+
false,
36+
DateTime::parse_from_rfc3339("2021-11-11T11:09:11+00:00")
37+
.expect("Failed to parse datetime")
38+
.with_timezone(&Utc),
39+
CIAppPipelineEventPipelineStatus::SUCCESS,
40+
"3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(),
41+
"https://my-ci-provider.example/pipelines/my-pipeline/run/1".to_string(),
42+
).git(
43+
Some(
44+
CIAppGitInfo::new(
45+
"[email protected]".to_string(),
46+
"https://github.com/DataDog/datadog-agent".to_string(),
47+
"7f263865994b76066c4612fd1965215e7dcb4cd2".to_string(),
48+
),
49+
),
50+
),
51+
),
52+
),
53+
),
54+
),
55+
).provider_name("example-provider".to_string()),
56+
)
57+
.type_(CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST),
58+
);
59+
let configuration = datadog::Configuration::new();
60+
let api = CIVisibilityPipelinesAPI::with_config(configuration);
61+
let resp = api.create_ci_app_pipeline_event(body).await;
62+
if let Ok(value) = resp {
63+
println!("{:#?}", value);
64+
} else {
65+
println!("{:#?}", resp.unwrap_err());
66+
}
67+
}

src/datadogV2/model/model_ci_app_create_pipeline_event_request_attributes.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct CIAppCreatePipelineEventRequestAttributes {
1414
/// The Datadog environment.
1515
#[serde(rename = "env")]
1616
pub env: Option<String>,
17+
/// The name of the CI provider. By default, this is "custom".
18+
#[serde(rename = "provider_name")]
19+
pub provider_name: Option<String>,
1720
/// Details of the CI pipeline event.
1821
#[serde(rename = "resource")]
1922
pub resource: crate::datadogV2::model::CIAppCreatePipelineEventRequestAttributesResource,
@@ -33,6 +36,7 @@ impl CIAppCreatePipelineEventRequestAttributes {
3336
) -> CIAppCreatePipelineEventRequestAttributes {
3437
CIAppCreatePipelineEventRequestAttributes {
3538
env: None,
39+
provider_name: None,
3640
resource,
3741
service: None,
3842
additional_properties: std::collections::BTreeMap::new(),
@@ -45,6 +49,11 @@ impl CIAppCreatePipelineEventRequestAttributes {
4549
self
4650
}
4751

52+
pub fn provider_name(mut self, value: String) -> Self {
53+
self.provider_name = Some(value);
54+
self
55+
}
56+
4857
pub fn service(mut self, value: String) -> Self {
4958
self.service = Some(value);
5059
self
@@ -77,6 +86,7 @@ impl<'de> Deserialize<'de> for CIAppCreatePipelineEventRequestAttributes {
7786
M: MapAccess<'a>,
7887
{
7988
let mut env: Option<String> = None;
89+
let mut provider_name: Option<String> = None;
8090
let mut resource: Option<
8191
crate::datadogV2::model::CIAppCreatePipelineEventRequestAttributesResource,
8292
> = None;
@@ -95,6 +105,13 @@ impl<'de> Deserialize<'de> for CIAppCreatePipelineEventRequestAttributes {
95105
}
96106
env = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
97107
}
108+
"provider_name" => {
109+
if v.is_null() {
110+
continue;
111+
}
112+
provider_name =
113+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
114+
}
98115
"resource" => {
99116
resource = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
100117
if let Some(ref _resource) = resource {
@@ -123,6 +140,7 @@ impl<'de> Deserialize<'de> for CIAppCreatePipelineEventRequestAttributes {
123140

124141
let content = CIAppCreatePipelineEventRequestAttributes {
125142
env,
143+
provider_name,
126144
resource,
127145
service,
128146
additional_properties,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-01-08T08:57:29.599Z
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"request": {
5+
"body": {
6+
"string": "{\"data\":{\"attributes\":{\"provider_name\":\"example-provider\",\"resource\":{\"end\":\"2025-01-08T08:56:59.599Z\",\"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-01-08T08:55:29.599Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}",
7+
"encoding": null
8+
},
9+
"headers": {
10+
"Accept": [
11+
"application/json"
12+
],
13+
"Content-Type": [
14+
"application/json"
15+
]
16+
},
17+
"method": "post",
18+
"uri": "https://api.datadoghq.com/api/v2/ci/pipeline"
19+
},
20+
"response": {
21+
"body": {
22+
"string": "{\"data\":null}",
23+
"encoding": null
24+
},
25+
"headers": {
26+
"Content-Type": [
27+
"application/vnd.api+json"
28+
]
29+
},
30+
"status": {
31+
"code": 202,
32+
"message": "Accepted"
33+
}
34+
},
35+
"recorded_at": "Wed, 08 Jan 2025 08:57:29 GMT"
36+
}
37+
],
38+
"recorded_with": "VCR 6.0.0"
39+
}

tests/scenarios/features/v2/ci_visibility_pipelines.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ Feature: CI Visibility Pipelines
108108
When the request is sent
109109
Then the response status is 202 Request accepted for processing
110110

111+
@team:Datadog/ci-app-backend
112+
Scenario: Send pipeline event with custom provider returns "Request accepted for processing" response
113+
Given new "CreateCIAppPipelineEvent" request
114+
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"}}
115+
When the request is sent
116+
Then the response status is 202 Request accepted for processing
117+
111118
@skip @team:Datadog/ci-app-backend
112119
Scenario: Send pipeline job event returns "Request accepted for processing" response
113120
Given new "CreateCIAppPipelineEvent" request

0 commit comments

Comments
 (0)