From 3fd257302b16657577da43f9bca68161b185f525 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 10 Dec 2024 19:55:40 +0000 Subject: [PATCH] Regenerate client from commit 5da0cd35 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 279 ++++++++---- ...lity-pipelines_CreateCIAppPipelineEvent.rs | 43 +- ...nes_CreateCIAppPipelineEvent_2341150096.rs | 55 +++ src/datadogV2/model/mod.rs | 10 +- ...eline_event_request_attributes_resource.rs | 7 +- ...ci_app_pipeline_event_finished_pipeline.rs | 409 +++++++++++++++++ ...app_pipeline_event_in_progress_pipeline.rs | 398 +++++++++++++++++ .../model_ci_app_pipeline_event_pipeline.rs | 414 ++---------------- ...eline_event_pipeline_in_progress_status.rs | 48 ++ ...ipelines-events-returns-OK-response.frozen | 2 +- ...-pipelines-events-returns-OK-response.json | 4 +- ...ipelines-events-returns-OK-response.frozen | 2 +- ...-pipelines-events-returns-OK-response.json | 6 +- ...ipelines-events-returns-OK-response.frozen | 2 +- ...-pipelines-events-returns-OK-response.json | 4 +- ...st-accepted-for-processing-response.frozen | 2 +- ...uest-accepted-for-processing-response.json | 4 +- ...st-accepted-for-processing-response.frozen | 2 +- ...uest-accepted-for-processing-response.json | 4 +- ...st-accepted-for-processing-response.frozen | 1 + ...uest-accepted-for-processing-response.json | 39 ++ .../v2/ci_visibility_pipelines.feature | 13 +- 23 files changed, 1229 insertions(+), 527 deletions(-) create mode 100644 examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent_2341150096.rs create mode 100644 src/datadogV2/model/model_ci_app_pipeline_event_finished_pipeline.rs create mode 100644 src/datadogV2/model/model_ci_app_pipeline_event_in_progress_pipeline.rs create mode 100644 src/datadogV2/model/model_ci_app_pipeline_event_pipeline_in_progress_status.rs create mode 100644 tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen create mode 100644 tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.json diff --git a/.apigentools-info b/.apigentools-info index eeb348726..cc9effc82 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 17:29:03.197132", - "spec_repo_commit": "f35e3502" + "regenerated": "2024-12-10 19:50:05.006436", + "spec_repo_commit": "5da0cd35" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 17:29:03.223274", - "spec_repo_commit": "f35e3502" + "regenerated": "2024-12-10 19:50:05.025319", + "spec_repo_commit": "5da0cd35" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cb2fda6b0..a21342f7d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3259,6 +3259,183 @@ components: tags: $ref: '#/components/schemas/TagsEventAttribute' type: object + CIAppPipelineEventFinishedPipeline: + description: Details of a finished pipeline. + properties: + end: + description: Time when the pipeline run finished. It cannot be older than + 18 hours in the past from the current time. The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + error: + $ref: '#/components/schemas/CIAppCIError' + git: + $ref: '#/components/schemas/CIAppGitInfo' + is_manual: + description: Whether or not the pipeline was triggered manually by the user. + example: false + nullable: true + type: boolean + is_resumed: + description: Whether or not the pipeline was resumed after being blocked. + example: false + nullable: true + type: boolean + level: + $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' + metrics: + $ref: '#/components/schemas/CIAppPipelineEventMetrics' + name: + description: Name of the pipeline. All pipeline runs for the builds should + have the same name. + example: Deploy to AWS + type: string + node: + $ref: '#/components/schemas/CIAppHostInfo' + parameters: + $ref: '#/components/schemas/CIAppPipelineEventParameters' + parent_pipeline: + $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' + partial_retry: + description: 'Whether or not the pipeline was a partial retry of a previous + attempt. A partial retry is one + + which only runs a subset of the original jobs.' + example: false + type: boolean + pipeline_id: + description: 'Any ID used in the provider to identify the pipeline run even + if it is not unique across retries. + + If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` + can be set to the same value.' + example: '#023' + type: string + previous_attempt: + $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' + queue_time: + description: The queue time in milliseconds, if applicable. + example: 1004 + format: int64 + minimum: 0 + nullable: true + type: integer + start: + description: Time when the pipeline run started (it should not include any + queue time). The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + status: + $ref: '#/components/schemas/CIAppPipelineEventPipelineStatus' + tags: + $ref: '#/components/schemas/CIAppPipelineEventTags' + unique_id: + description: 'UUID of the pipeline run. The ID has to be unique across retries + and pipelines, + + including partial retries.' + example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + type: string + url: + description: The URL to look at the pipeline in the CI provider UI. + example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 + type: string + required: + - level + - unique_id + - name + - url + - start + - end + - status + - partial_retry + type: object + CIAppPipelineEventInProgressPipeline: + description: Details of a running pipeline. + properties: + error: + $ref: '#/components/schemas/CIAppCIError' + git: + $ref: '#/components/schemas/CIAppGitInfo' + is_manual: + description: Whether or not the pipeline was triggered manually by the user. + example: false + nullable: true + type: boolean + is_resumed: + description: Whether or not the pipeline was resumed after being blocked. + example: false + nullable: true + type: boolean + level: + $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' + metrics: + $ref: '#/components/schemas/CIAppPipelineEventMetrics' + name: + description: Name of the pipeline. All pipeline runs for the builds should + have the same name. + example: Deploy to AWS + type: string + node: + $ref: '#/components/schemas/CIAppHostInfo' + parameters: + $ref: '#/components/schemas/CIAppPipelineEventParameters' + parent_pipeline: + $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' + partial_retry: + description: 'Whether or not the pipeline was a partial retry of a previous + attempt. A partial retry is one + + which only runs a subset of the original jobs.' + example: false + type: boolean + pipeline_id: + description: 'Any ID used in the provider to identify the pipeline run even + if it is not unique across retries. + + If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` + can be set to the same value.' + example: '#023' + type: string + previous_attempt: + $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' + queue_time: + description: The queue time in milliseconds, if applicable. + example: 1004 + format: int64 + minimum: 0 + nullable: true + type: integer + start: + description: Time when the pipeline run started (it should not include any + queue time). The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + status: + $ref: '#/components/schemas/CIAppPipelineEventPipelineInProgressStatus' + tags: + $ref: '#/components/schemas/CIAppPipelineEventTags' + unique_id: + description: UUID of the pipeline run. The ID has to be the same as the + finished pipeline. + example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + type: string + url: + description: The URL to look at the pipeline in the CI provider UI. + example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 + type: string + required: + - level + - unique_id + - name + - url + - start + - status + - partial_retry + type: object CIAppPipelineEventJob: description: Details of a CI job. properties: @@ -3407,97 +3584,17 @@ components: type: object CIAppPipelineEventPipeline: description: Details of the top level pipeline, build, or workflow of your CI. - properties: - end: - description: Time when the pipeline run finished. It cannot be older than - 18 hours in the past from the current time. The time format must be RFC3339. - example: '2023-05-31T15:30:00Z' - format: date-time - type: string - error: - $ref: '#/components/schemas/CIAppCIError' - git: - $ref: '#/components/schemas/CIAppGitInfo' - is_manual: - description: Whether or not the pipeline was triggered manually by the user. - example: false - nullable: true - type: boolean - is_resumed: - description: Whether or not the pipeline was resumed after being blocked. - example: false - nullable: true - type: boolean - level: - $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' - metrics: - $ref: '#/components/schemas/CIAppPipelineEventMetrics' - name: - description: Name of the pipeline. All pipeline runs for the builds should - have the same name. - example: Deploy to AWS - type: string - node: - $ref: '#/components/schemas/CIAppHostInfo' - parameters: - $ref: '#/components/schemas/CIAppPipelineEventParameters' - parent_pipeline: - $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' - partial_retry: - description: 'Whether or not the pipeline was a partial retry of a previous - attempt. A partial retry is one - - which only runs a subset of the original jobs.' - example: false - type: boolean - pipeline_id: - description: 'Any ID used in the provider to identify the pipeline run even - if it is not unique across retries. - - If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` - can be set to the same value.' - example: '#023' - type: string - previous_attempt: - $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' - queue_time: - description: The queue time in milliseconds, if applicable. - example: 1004 - format: int64 - minimum: 0 - nullable: true - type: integer - start: - description: Time when the pipeline run started (it should not include any - queue time). The time format must be RFC3339. - example: '2023-05-31T15:30:00Z' - format: date-time - type: string - status: - $ref: '#/components/schemas/CIAppPipelineEventPipelineStatus' - tags: - $ref: '#/components/schemas/CIAppPipelineEventTags' - unique_id: - description: 'UUID of the pipeline run. The ID has to be unique across retries - and pipelines, - - including partial retries.' - example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a - type: string - url: - description: The URL to look at the pipeline in the CI provider UI. - example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 - type: string - required: - - level - - unique_id - - name - - url - - start - - end - - status - - partial_retry - type: object + oneOf: + - $ref: '#/components/schemas/CIAppPipelineEventFinishedPipeline' + - $ref: '#/components/schemas/CIAppPipelineEventInProgressPipeline' + CIAppPipelineEventPipelineInProgressStatus: + description: The in progress status of the pipeline. + enum: + - running + example: running + type: string + x-enum-varnames: + - RUNNING CIAppPipelineEventPipelineLevel: default: pipeline description: Used to distinguish between pipelines, stages, jobs, and steps. diff --git a/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent.rs b/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent.rs index 0f3c7e023..6ddb0e944 100644 --- a/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent.rs +++ b/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent.rs @@ -8,6 +8,7 @@ use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestAttribu use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestData; use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestDataType; use datadog_api_client::datadogV2::model::CIAppGitInfo; +use datadog_api_client::datadogV2::model::CIAppPipelineEventFinishedPipeline; use datadog_api_client::datadogV2::model::CIAppPipelineEventPipeline; use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineLevel; use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineStatus; @@ -19,26 +20,28 @@ async fn main() { .attributes(CIAppCreatePipelineEventRequestAttributes::new( CIAppCreatePipelineEventRequestAttributesResource::CIAppPipelineEventPipeline( Box::new( - CIAppPipelineEventPipeline::new( - DateTime::parse_from_rfc3339("2021-11-11T11:10:41+00:00") - .expect("Failed to parse datetime") - .with_timezone(&Utc), - CIAppPipelineEventPipelineLevel::PIPELINE, - "Deploy to AWS".to_string(), - false, - DateTime::parse_from_rfc3339("2021-11-11T11:09:11+00:00") - .expect("Failed to parse datetime") - .with_timezone(&Utc), - CIAppPipelineEventPipelineStatus::SUCCESS, - "3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(), - "https://my-ci-provider.example/pipelines/my-pipeline/run/1" - .to_string(), - ) - .git(Some(CIAppGitInfo::new( - "john.doe@email.com".to_string(), - "https://github.com/DataDog/datadog-agent".to_string(), - "7f263865994b76066c4612fd1965215e7dcb4cd2".to_string(), - ))), + CIAppPipelineEventPipeline::CIAppPipelineEventFinishedPipeline(Box::new( + CIAppPipelineEventFinishedPipeline::new( + DateTime::parse_from_rfc3339("2021-11-11T11:10:41+00:00") + .expect("Failed to parse datetime") + .with_timezone(&Utc), + CIAppPipelineEventPipelineLevel::PIPELINE, + "Deploy to AWS".to_string(), + false, + DateTime::parse_from_rfc3339("2021-11-11T11:09:11+00:00") + .expect("Failed to parse datetime") + .with_timezone(&Utc), + CIAppPipelineEventPipelineStatus::SUCCESS, + "3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(), + "https://my-ci-provider.example/pipelines/my-pipeline/run/1" + .to_string(), + ) + .git(Some(CIAppGitInfo::new( + "john.doe@email.com".to_string(), + "https://github.com/DataDog/datadog-agent".to_string(), + "7f263865994b76066c4612fd1965215e7dcb4cd2".to_string(), + ))), + )), ), ), )) diff --git a/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent_2341150096.rs b/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent_2341150096.rs new file mode 100644 index 000000000..24a2a8659 --- /dev/null +++ b/examples/v2_ci-visibility-pipelines_CreateCIAppPipelineEvent_2341150096.rs @@ -0,0 +1,55 @@ +// Send running pipeline event returns "Request accepted for processing" response +use chrono::{DateTime, Utc}; +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_ci_visibility_pipelines::CIVisibilityPipelinesAPI; +use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequest; +use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestAttributes; +use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestAttributesResource; +use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestData; +use datadog_api_client::datadogV2::model::CIAppCreatePipelineEventRequestDataType; +use datadog_api_client::datadogV2::model::CIAppGitInfo; +use datadog_api_client::datadogV2::model::CIAppPipelineEventInProgressPipeline; +use datadog_api_client::datadogV2::model::CIAppPipelineEventPipeline; +use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineInProgressStatus; +use datadog_api_client::datadogV2::model::CIAppPipelineEventPipelineLevel; + +#[tokio::main] +async fn main() { + let body = CIAppCreatePipelineEventRequest::new().data( + CIAppCreatePipelineEventRequestData::new() + .attributes(CIAppCreatePipelineEventRequestAttributes::new( + CIAppCreatePipelineEventRequestAttributesResource::CIAppPipelineEventPipeline( + Box::new( + CIAppPipelineEventPipeline::CIAppPipelineEventInProgressPipeline(Box::new( + CIAppPipelineEventInProgressPipeline::new( + CIAppPipelineEventPipelineLevel::PIPELINE, + "Deploy to AWS".to_string(), + false, + DateTime::parse_from_rfc3339("2021-11-11T11:09:11+00:00") + .expect("Failed to parse datetime") + .with_timezone(&Utc), + CIAppPipelineEventPipelineInProgressStatus::RUNNING, + "3eacb6f3-ff04-4e10-8a9c-46e6d054024a".to_string(), + "https://my-ci-provider.example/pipelines/my-pipeline/run/1" + .to_string(), + ) + .git(Some(CIAppGitInfo::new( + "john.doe@email.com".to_string(), + "https://github.com/DataDog/datadog-agent".to_string(), + "7f263865994b76066c4612fd1965215e7dcb4cd2".to_string(), + ))), + )), + ), + ), + )) + .type_(CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST), + ); + let configuration = datadog::Configuration::new(); + let api = CIVisibilityPipelinesAPI::with_config(configuration); + let resp = api.create_ci_app_pipeline_event(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index c73182957..714bbfb27 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -554,8 +554,8 @@ pub mod model_ci_app_create_pipeline_event_request_data; pub use self::model_ci_app_create_pipeline_event_request_data::CIAppCreatePipelineEventRequestData; pub mod model_ci_app_create_pipeline_event_request_attributes; pub use self::model_ci_app_create_pipeline_event_request_attributes::CIAppCreatePipelineEventRequestAttributes; -pub mod model_ci_app_pipeline_event_pipeline; -pub use self::model_ci_app_pipeline_event_pipeline::CIAppPipelineEventPipeline; +pub mod model_ci_app_pipeline_event_finished_pipeline; +pub use self::model_ci_app_pipeline_event_finished_pipeline::CIAppPipelineEventFinishedPipeline; pub mod model_ci_app_ci_error; pub use self::model_ci_app_ci_error::CIAppCIError; pub mod model_ci_app_ci_error_domain; @@ -572,6 +572,12 @@ pub mod model_ci_app_pipeline_event_previous_pipeline; pub use self::model_ci_app_pipeline_event_previous_pipeline::CIAppPipelineEventPreviousPipeline; pub mod model_ci_app_pipeline_event_pipeline_status; pub use self::model_ci_app_pipeline_event_pipeline_status::CIAppPipelineEventPipelineStatus; +pub mod model_ci_app_pipeline_event_in_progress_pipeline; +pub use self::model_ci_app_pipeline_event_in_progress_pipeline::CIAppPipelineEventInProgressPipeline; +pub mod model_ci_app_pipeline_event_pipeline_in_progress_status; +pub use self::model_ci_app_pipeline_event_pipeline_in_progress_status::CIAppPipelineEventPipelineInProgressStatus; +pub mod model_ci_app_pipeline_event_pipeline; +pub use self::model_ci_app_pipeline_event_pipeline::CIAppPipelineEventPipeline; pub mod model_ci_app_pipeline_event_stage; pub use self::model_ci_app_pipeline_event_stage::CIAppPipelineEventStage; pub mod model_ci_app_pipeline_event_stage_level; diff --git a/src/datadogV2/model/model_ci_app_create_pipeline_event_request_attributes_resource.rs b/src/datadogV2/model/model_ci_app_create_pipeline_event_request_attributes_resource.rs index 3af930924..b0adfc02b 100644 --- a/src/datadogV2/model/model_ci_app_create_pipeline_event_request_attributes_resource.rs +++ b/src/datadogV2/model/model_ci_app_create_pipeline_event_request_attributes_resource.rs @@ -25,12 +25,13 @@ impl<'de> Deserialize<'de> for CIAppCreatePipelineEventRequestAttributesResource Box, >(value.clone()) { - if !_v._unparsed { - return Ok( + match *_v { + crate::datadogV2::model::CIAppPipelineEventPipeline::UnparsedObject(_v) => {} + _ => return Ok( CIAppCreatePipelineEventRequestAttributesResource::CIAppPipelineEventPipeline( _v, ), - ); + ), } } if let Ok(_v) = serde_json::from_value::< diff --git a/src/datadogV2/model/model_ci_app_pipeline_event_finished_pipeline.rs b/src/datadogV2/model/model_ci_app_pipeline_event_finished_pipeline.rs new file mode 100644 index 000000000..733d2e2ef --- /dev/null +++ b/src/datadogV2/model/model_ci_app_pipeline_event_finished_pipeline.rs @@ -0,0 +1,409 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Details of a finished pipeline. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CIAppPipelineEventFinishedPipeline { + /// Time when the pipeline run finished. It cannot be older than 18 hours in the past from the current time. The time format must be RFC3339. + #[serde(rename = "end")] + pub end: chrono::DateTime, + /// Contains information of the CI error. + #[serde(rename = "error", default, with = "::serde_with::rust::double_option")] + pub error: Option>, + /// If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. + /// Note that either `tag` or `branch` has to be provided, but not both. + #[serde(rename = "git", default, with = "::serde_with::rust::double_option")] + pub git: Option>, + /// Whether or not the pipeline was triggered manually by the user. + #[serde( + rename = "is_manual", + default, + with = "::serde_with::rust::double_option" + )] + pub is_manual: Option>, + /// Whether or not the pipeline was resumed after being blocked. + #[serde( + rename = "is_resumed", + default, + with = "::serde_with::rust::double_option" + )] + pub is_resumed: Option>, + /// Used to distinguish between pipelines, stages, jobs, and steps. + #[serde(rename = "level")] + pub level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, + /// A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + #[serde( + rename = "metrics", + default, + with = "::serde_with::rust::double_option" + )] + pub metrics: Option>>, + /// Name of the pipeline. All pipeline runs for the builds should have the same name. + #[serde(rename = "name")] + pub name: String, + /// Contains information of the host running the pipeline, stage, job, or step. + #[serde(rename = "node", default, with = "::serde_with::rust::double_option")] + pub node: Option>, + /// A map of key-value parameters or environment variables that were defined for the pipeline. + #[serde( + rename = "parameters", + default, + with = "::serde_with::rust::double_option" + )] + pub parameters: Option>>, + /// If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. + #[serde( + rename = "parent_pipeline", + default, + with = "::serde_with::rust::double_option" + )] + pub parent_pipeline: Option>, + /// Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one + /// which only runs a subset of the original jobs. + #[serde(rename = "partial_retry")] + pub partial_retry: bool, + /// Any ID used in the provider to identify the pipeline run even if it is not unique across retries. + /// If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. + #[serde(rename = "pipeline_id")] + pub pipeline_id: Option, + /// If the pipeline is a retry, this should contain the details of the previous attempt. + #[serde( + rename = "previous_attempt", + default, + with = "::serde_with::rust::double_option" + )] + pub previous_attempt: + Option>, + /// The queue time in milliseconds, if applicable. + #[serde( + rename = "queue_time", + default, + with = "::serde_with::rust::double_option" + )] + pub queue_time: Option>, + /// Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. + #[serde(rename = "start")] + pub start: chrono::DateTime, + /// The final status of the pipeline. + #[serde(rename = "status")] + pub status: crate::datadogV2::model::CIAppPipelineEventPipelineStatus, + /// A list of user-defined tags. The tags must follow the `key:value` pattern. + #[serde(rename = "tags", default, with = "::serde_with::rust::double_option")] + pub tags: Option>>, + /// UUID of the pipeline run. The ID has to be unique across retries and pipelines, + /// including partial retries. + #[serde(rename = "unique_id")] + pub unique_id: String, + /// The URL to look at the pipeline in the CI provider UI. + #[serde(rename = "url")] + pub url: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CIAppPipelineEventFinishedPipeline { + pub fn new( + end: chrono::DateTime, + level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, + name: String, + partial_retry: bool, + start: chrono::DateTime, + status: crate::datadogV2::model::CIAppPipelineEventPipelineStatus, + unique_id: String, + url: String, + ) -> CIAppPipelineEventFinishedPipeline { + CIAppPipelineEventFinishedPipeline { + end, + error: None, + git: None, + is_manual: None, + is_resumed: None, + level, + metrics: None, + name, + node: None, + parameters: None, + parent_pipeline: None, + partial_retry, + pipeline_id: None, + previous_attempt: None, + queue_time: None, + start, + status, + tags: None, + unique_id, + url, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn error(mut self, value: Option) -> Self { + self.error = Some(value); + self + } + + pub fn git(mut self, value: Option) -> Self { + self.git = Some(value); + self + } + + pub fn is_manual(mut self, value: Option) -> Self { + self.is_manual = Some(value); + self + } + + pub fn is_resumed(mut self, value: Option) -> Self { + self.is_resumed = Some(value); + self + } + + pub fn metrics(mut self, value: Option>) -> Self { + self.metrics = Some(value); + self + } + + pub fn node(mut self, value: Option) -> Self { + self.node = Some(value); + self + } + + pub fn parameters(mut self, value: Option>) -> Self { + self.parameters = Some(value); + self + } + + pub fn parent_pipeline( + mut self, + value: Option, + ) -> Self { + self.parent_pipeline = Some(value); + self + } + + pub fn pipeline_id(mut self, value: String) -> Self { + self.pipeline_id = Some(value); + self + } + + pub fn previous_attempt( + mut self, + value: Option, + ) -> Self { + self.previous_attempt = Some(value); + self + } + + pub fn queue_time(mut self, value: Option) -> Self { + self.queue_time = Some(value); + self + } + + pub fn tags(mut self, value: Option>) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CIAppPipelineEventFinishedPipeline { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CIAppPipelineEventFinishedPipelineVisitor; + impl<'a> Visitor<'a> for CIAppPipelineEventFinishedPipelineVisitor { + type Value = CIAppPipelineEventFinishedPipeline; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut end: Option> = None; + let mut error: Option> = None; + let mut git: Option> = None; + let mut is_manual: Option> = None; + let mut is_resumed: Option> = None; + let mut level: Option = + None; + let mut metrics: Option>> = None; + let mut name: Option = None; + let mut node: Option> = None; + let mut parameters: Option>> = + None; + let mut parent_pipeline: Option< + Option, + > = None; + let mut partial_retry: Option = None; + let mut pipeline_id: Option = None; + let mut previous_attempt: Option< + Option, + > = None; + let mut queue_time: Option> = None; + let mut start: Option> = None; + let mut status: Option = + None; + let mut tags: Option>> = None; + let mut unique_id: Option = None; + let mut url: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "end" => { + end = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "error" => { + error = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "git" => { + git = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_manual" => { + is_manual = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_resumed" => { + is_resumed = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "level" => { + level = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _level) = level { + match _level { + crate::datadogV2::model::CIAppPipelineEventPipelineLevel::UnparsedObject(_level) => { + _unparsed = true; + }, + _ => {} + } + } + } + "metrics" => { + metrics = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "node" => { + node = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "parameters" => { + parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "parent_pipeline" => { + parent_pipeline = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "partial_retry" => { + partial_retry = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "pipeline_id" => { + if v.is_null() { + continue; + } + pipeline_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "previous_attempt" => { + previous_attempt = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "queue_time" => { + queue_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "start" => { + start = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "status" => { + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::CIAppPipelineEventPipelineStatus::UnparsedObject(_status) => { + _unparsed = true; + }, + _ => {} + } + } + } + "tags" => { + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "unique_id" => { + unique_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let end = end.ok_or_else(|| M::Error::missing_field("end"))?; + let level = level.ok_or_else(|| M::Error::missing_field("level"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let partial_retry = + partial_retry.ok_or_else(|| M::Error::missing_field("partial_retry"))?; + let start = start.ok_or_else(|| M::Error::missing_field("start"))?; + let status = status.ok_or_else(|| M::Error::missing_field("status"))?; + let unique_id = unique_id.ok_or_else(|| M::Error::missing_field("unique_id"))?; + let url = url.ok_or_else(|| M::Error::missing_field("url"))?; + + let content = CIAppPipelineEventFinishedPipeline { + end, + error, + git, + is_manual, + is_resumed, + level, + metrics, + name, + node, + parameters, + parent_pipeline, + partial_retry, + pipeline_id, + previous_attempt, + queue_time, + start, + status, + tags, + unique_id, + url, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CIAppPipelineEventFinishedPipelineVisitor) + } +} diff --git a/src/datadogV2/model/model_ci_app_pipeline_event_in_progress_pipeline.rs b/src/datadogV2/model/model_ci_app_pipeline_event_in_progress_pipeline.rs new file mode 100644 index 000000000..e05e7f815 --- /dev/null +++ b/src/datadogV2/model/model_ci_app_pipeline_event_in_progress_pipeline.rs @@ -0,0 +1,398 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Details of a running pipeline. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct CIAppPipelineEventInProgressPipeline { + /// Contains information of the CI error. + #[serde(rename = "error", default, with = "::serde_with::rust::double_option")] + pub error: Option>, + /// If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. + /// Note that either `tag` or `branch` has to be provided, but not both. + #[serde(rename = "git", default, with = "::serde_with::rust::double_option")] + pub git: Option>, + /// Whether or not the pipeline was triggered manually by the user. + #[serde( + rename = "is_manual", + default, + with = "::serde_with::rust::double_option" + )] + pub is_manual: Option>, + /// Whether or not the pipeline was resumed after being blocked. + #[serde( + rename = "is_resumed", + default, + with = "::serde_with::rust::double_option" + )] + pub is_resumed: Option>, + /// Used to distinguish between pipelines, stages, jobs, and steps. + #[serde(rename = "level")] + pub level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, + /// A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + #[serde( + rename = "metrics", + default, + with = "::serde_with::rust::double_option" + )] + pub metrics: Option>>, + /// Name of the pipeline. All pipeline runs for the builds should have the same name. + #[serde(rename = "name")] + pub name: String, + /// Contains information of the host running the pipeline, stage, job, or step. + #[serde(rename = "node", default, with = "::serde_with::rust::double_option")] + pub node: Option>, + /// A map of key-value parameters or environment variables that were defined for the pipeline. + #[serde( + rename = "parameters", + default, + with = "::serde_with::rust::double_option" + )] + pub parameters: Option>>, + /// If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. + #[serde( + rename = "parent_pipeline", + default, + with = "::serde_with::rust::double_option" + )] + pub parent_pipeline: Option>, + /// Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one + /// which only runs a subset of the original jobs. + #[serde(rename = "partial_retry")] + pub partial_retry: bool, + /// Any ID used in the provider to identify the pipeline run even if it is not unique across retries. + /// If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. + #[serde(rename = "pipeline_id")] + pub pipeline_id: Option, + /// If the pipeline is a retry, this should contain the details of the previous attempt. + #[serde( + rename = "previous_attempt", + default, + with = "::serde_with::rust::double_option" + )] + pub previous_attempt: + Option>, + /// The queue time in milliseconds, if applicable. + #[serde( + rename = "queue_time", + default, + with = "::serde_with::rust::double_option" + )] + pub queue_time: Option>, + /// Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. + #[serde(rename = "start")] + pub start: chrono::DateTime, + /// The in progress status of the pipeline. + #[serde(rename = "status")] + pub status: crate::datadogV2::model::CIAppPipelineEventPipelineInProgressStatus, + /// A list of user-defined tags. The tags must follow the `key:value` pattern. + #[serde(rename = "tags", default, with = "::serde_with::rust::double_option")] + pub tags: Option>>, + /// UUID of the pipeline run. The ID has to be the same as the finished pipeline. + #[serde(rename = "unique_id")] + pub unique_id: String, + /// The URL to look at the pipeline in the CI provider UI. + #[serde(rename = "url")] + pub url: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl CIAppPipelineEventInProgressPipeline { + pub fn new( + level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, + name: String, + partial_retry: bool, + start: chrono::DateTime, + status: crate::datadogV2::model::CIAppPipelineEventPipelineInProgressStatus, + unique_id: String, + url: String, + ) -> CIAppPipelineEventInProgressPipeline { + CIAppPipelineEventInProgressPipeline { + error: None, + git: None, + is_manual: None, + is_resumed: None, + level, + metrics: None, + name, + node: None, + parameters: None, + parent_pipeline: None, + partial_retry, + pipeline_id: None, + previous_attempt: None, + queue_time: None, + start, + status, + tags: None, + unique_id, + url, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn error(mut self, value: Option) -> Self { + self.error = Some(value); + self + } + + pub fn git(mut self, value: Option) -> Self { + self.git = Some(value); + self + } + + pub fn is_manual(mut self, value: Option) -> Self { + self.is_manual = Some(value); + self + } + + pub fn is_resumed(mut self, value: Option) -> Self { + self.is_resumed = Some(value); + self + } + + pub fn metrics(mut self, value: Option>) -> Self { + self.metrics = Some(value); + self + } + + pub fn node(mut self, value: Option) -> Self { + self.node = Some(value); + self + } + + pub fn parameters(mut self, value: Option>) -> Self { + self.parameters = Some(value); + self + } + + pub fn parent_pipeline( + mut self, + value: Option, + ) -> Self { + self.parent_pipeline = Some(value); + self + } + + pub fn pipeline_id(mut self, value: String) -> Self { + self.pipeline_id = Some(value); + self + } + + pub fn previous_attempt( + mut self, + value: Option, + ) -> Self { + self.previous_attempt = Some(value); + self + } + + pub fn queue_time(mut self, value: Option) -> Self { + self.queue_time = Some(value); + self + } + + pub fn tags(mut self, value: Option>) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for CIAppPipelineEventInProgressPipeline { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct CIAppPipelineEventInProgressPipelineVisitor; + impl<'a> Visitor<'a> for CIAppPipelineEventInProgressPipelineVisitor { + type Value = CIAppPipelineEventInProgressPipeline; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut error: Option> = None; + let mut git: Option> = None; + let mut is_manual: Option> = None; + let mut is_resumed: Option> = None; + let mut level: Option = + None; + let mut metrics: Option>> = None; + let mut name: Option = None; + let mut node: Option> = None; + let mut parameters: Option>> = + None; + let mut parent_pipeline: Option< + Option, + > = None; + let mut partial_retry: Option = None; + let mut pipeline_id: Option = None; + let mut previous_attempt: Option< + Option, + > = None; + let mut queue_time: Option> = None; + let mut start: Option> = None; + let mut status: Option< + crate::datadogV2::model::CIAppPipelineEventPipelineInProgressStatus, + > = None; + let mut tags: Option>> = None; + let mut unique_id: Option = None; + let mut url: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "error" => { + error = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "git" => { + git = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_manual" => { + is_manual = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "is_resumed" => { + is_resumed = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "level" => { + level = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _level) = level { + match _level { + crate::datadogV2::model::CIAppPipelineEventPipelineLevel::UnparsedObject(_level) => { + _unparsed = true; + }, + _ => {} + } + } + } + "metrics" => { + metrics = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "node" => { + node = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "parameters" => { + parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "parent_pipeline" => { + parent_pipeline = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "partial_retry" => { + partial_retry = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "pipeline_id" => { + if v.is_null() { + continue; + } + pipeline_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "previous_attempt" => { + previous_attempt = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "queue_time" => { + queue_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "start" => { + start = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "status" => { + status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _status) = status { + match _status { + crate::datadogV2::model::CIAppPipelineEventPipelineInProgressStatus::UnparsedObject(_status) => { + _unparsed = true; + }, + _ => {} + } + } + } + "tags" => { + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "unique_id" => { + unique_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "url" => { + url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let level = level.ok_or_else(|| M::Error::missing_field("level"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let partial_retry = + partial_retry.ok_or_else(|| M::Error::missing_field("partial_retry"))?; + let start = start.ok_or_else(|| M::Error::missing_field("start"))?; + let status = status.ok_or_else(|| M::Error::missing_field("status"))?; + let unique_id = unique_id.ok_or_else(|| M::Error::missing_field("unique_id"))?; + let url = url.ok_or_else(|| M::Error::missing_field("url"))?; + + let content = CIAppPipelineEventInProgressPipeline { + error, + git, + is_manual, + is_resumed, + level, + metrics, + name, + node, + parameters, + parent_pipeline, + partial_retry, + pipeline_id, + previous_attempt, + queue_time, + start, + status, + tags, + unique_id, + url, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(CIAppPipelineEventInProgressPipelineVisitor) + } +} diff --git a/src/datadogV2/model/model_ci_app_pipeline_event_pipeline.rs b/src/datadogV2/model/model_ci_app_pipeline_event_pipeline.rs index 755c42840..00f6b76f8 100644 --- a/src/datadogV2/model/model_ci_app_pipeline_event_pipeline.rs +++ b/src/datadogV2/model/model_ci_app_pipeline_event_pipeline.rs @@ -1,226 +1,20 @@ // 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. -use serde::de::{Error, MapAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; -use serde_with::skip_serializing_none; -use std::fmt::{self, Formatter}; /// Details of the top level pipeline, build, or workflow of your CI. #[non_exhaustive] -#[skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize)] -pub struct CIAppPipelineEventPipeline { - /// Time when the pipeline run finished. It cannot be older than 18 hours in the past from the current time. The time format must be RFC3339. - #[serde(rename = "end")] - pub end: chrono::DateTime, - /// Contains information of the CI error. - #[serde(rename = "error", default, with = "::serde_with::rust::double_option")] - pub error: Option>, - /// If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. - /// Note that either `tag` or `branch` has to be provided, but not both. - #[serde(rename = "git", default, with = "::serde_with::rust::double_option")] - pub git: Option>, - /// Whether or not the pipeline was triggered manually by the user. - #[serde( - rename = "is_manual", - default, - with = "::serde_with::rust::double_option" - )] - pub is_manual: Option>, - /// Whether or not the pipeline was resumed after being blocked. - #[serde( - rename = "is_resumed", - default, - with = "::serde_with::rust::double_option" - )] - pub is_resumed: Option>, - /// Used to distinguish between pipelines, stages, jobs, and steps. - #[serde(rename = "level")] - pub level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, - /// A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. - #[serde( - rename = "metrics", - default, - with = "::serde_with::rust::double_option" - )] - pub metrics: Option>>, - /// Name of the pipeline. All pipeline runs for the builds should have the same name. - #[serde(rename = "name")] - pub name: String, - /// Contains information of the host running the pipeline, stage, job, or step. - #[serde(rename = "node", default, with = "::serde_with::rust::double_option")] - pub node: Option>, - /// A map of key-value parameters or environment variables that were defined for the pipeline. - #[serde( - rename = "parameters", - default, - with = "::serde_with::rust::double_option" - )] - pub parameters: Option>>, - /// If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. - #[serde( - rename = "parent_pipeline", - default, - with = "::serde_with::rust::double_option" - )] - pub parent_pipeline: Option>, - /// Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one - /// which only runs a subset of the original jobs. - #[serde(rename = "partial_retry")] - pub partial_retry: bool, - /// Any ID used in the provider to identify the pipeline run even if it is not unique across retries. - /// If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. - #[serde(rename = "pipeline_id")] - pub pipeline_id: Option, - /// If the pipeline is a retry, this should contain the details of the previous attempt. - #[serde( - rename = "previous_attempt", - default, - with = "::serde_with::rust::double_option" - )] - pub previous_attempt: - Option>, - /// The queue time in milliseconds, if applicable. - #[serde( - rename = "queue_time", - default, - with = "::serde_with::rust::double_option" - )] - pub queue_time: Option>, - /// Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. - #[serde(rename = "start")] - pub start: chrono::DateTime, - /// The final status of the pipeline. - #[serde(rename = "status")] - pub status: crate::datadogV2::model::CIAppPipelineEventPipelineStatus, - /// A list of user-defined tags. The tags must follow the `key:value` pattern. - #[serde(rename = "tags", default, with = "::serde_with::rust::double_option")] - pub tags: Option>>, - /// UUID of the pipeline run. The ID has to be unique across retries and pipelines, - /// including partial retries. - #[serde(rename = "unique_id")] - pub unique_id: String, - /// The URL to look at the pipeline in the CI provider UI. - #[serde(rename = "url")] - pub url: String, - #[serde(flatten)] - pub additional_properties: std::collections::BTreeMap, - #[serde(skip)] - #[serde(default)] - pub(crate) _unparsed: bool, -} - -impl CIAppPipelineEventPipeline { - pub fn new( - end: chrono::DateTime, - level: crate::datadogV2::model::CIAppPipelineEventPipelineLevel, - name: String, - partial_retry: bool, - start: chrono::DateTime, - status: crate::datadogV2::model::CIAppPipelineEventPipelineStatus, - unique_id: String, - url: String, - ) -> CIAppPipelineEventPipeline { - CIAppPipelineEventPipeline { - end, - error: None, - git: None, - is_manual: None, - is_resumed: None, - level, - metrics: None, - name, - node: None, - parameters: None, - parent_pipeline: None, - partial_retry, - pipeline_id: None, - previous_attempt: None, - queue_time: None, - start, - status, - tags: None, - unique_id, - url, - additional_properties: std::collections::BTreeMap::new(), - _unparsed: false, - } - } - - pub fn error(mut self, value: Option) -> Self { - self.error = Some(value); - self - } - - pub fn git(mut self, value: Option) -> Self { - self.git = Some(value); - self - } - - pub fn is_manual(mut self, value: Option) -> Self { - self.is_manual = Some(value); - self - } - - pub fn is_resumed(mut self, value: Option) -> Self { - self.is_resumed = Some(value); - self - } - - pub fn metrics(mut self, value: Option>) -> Self { - self.metrics = Some(value); - self - } - - pub fn node(mut self, value: Option) -> Self { - self.node = Some(value); - self - } - - pub fn parameters(mut self, value: Option>) -> Self { - self.parameters = Some(value); - self - } - - pub fn parent_pipeline( - mut self, - value: Option, - ) -> Self { - self.parent_pipeline = Some(value); - self - } - - pub fn pipeline_id(mut self, value: String) -> Self { - self.pipeline_id = Some(value); - self - } - - pub fn previous_attempt( - mut self, - value: Option, - ) -> Self { - self.previous_attempt = Some(value); - self - } - - pub fn queue_time(mut self, value: Option) -> Self { - self.queue_time = Some(value); - self - } - - pub fn tags(mut self, value: Option>) -> Self { - self.tags = Some(value); - self - } - - pub fn additional_properties( - mut self, - value: std::collections::BTreeMap, - ) -> Self { - self.additional_properties = value; - self - } +#[serde(untagged)] +pub enum CIAppPipelineEventPipeline { + CIAppPipelineEventFinishedPipeline( + Box, + ), + CIAppPipelineEventInProgressPipeline( + Box, + ), + UnparsedObject(crate::datadog::UnparsedObject), } impl<'de> Deserialize<'de> for CIAppPipelineEventPipeline { @@ -228,182 +22,26 @@ impl<'de> Deserialize<'de> for CIAppPipelineEventPipeline { where D: Deserializer<'de>, { - struct CIAppPipelineEventPipelineVisitor; - impl<'a> Visitor<'a> for CIAppPipelineEventPipelineVisitor { - type Value = CIAppPipelineEventPipeline; - - fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { - f.write_str("a mapping") + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(CIAppPipelineEventPipeline::CIAppPipelineEventFinishedPipeline(_v)); } - - fn visit_map(self, mut map: M) -> Result - where - M: MapAccess<'a>, - { - let mut end: Option> = None; - let mut error: Option> = None; - let mut git: Option> = None; - let mut is_manual: Option> = None; - let mut is_resumed: Option> = None; - let mut level: Option = - None; - let mut metrics: Option>> = None; - let mut name: Option = None; - let mut node: Option> = None; - let mut parameters: Option>> = - None; - let mut parent_pipeline: Option< - Option, - > = None; - let mut partial_retry: Option = None; - let mut pipeline_id: Option = None; - let mut previous_attempt: Option< - Option, - > = None; - let mut queue_time: Option> = None; - let mut start: Option> = None; - let mut status: Option = - None; - let mut tags: Option>> = None; - let mut unique_id: Option = None; - let mut url: Option = None; - let mut additional_properties: std::collections::BTreeMap< - String, - serde_json::Value, - > = std::collections::BTreeMap::new(); - let mut _unparsed = false; - - while let Some((k, v)) = map.next_entry::()? { - match k.as_str() { - "end" => { - end = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "error" => { - error = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "git" => { - git = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "is_manual" => { - is_manual = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "is_resumed" => { - is_resumed = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "level" => { - level = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _level) = level { - match _level { - crate::datadogV2::model::CIAppPipelineEventPipelineLevel::UnparsedObject(_level) => { - _unparsed = true; - }, - _ => {} - } - } - } - "metrics" => { - metrics = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "name" => { - name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "node" => { - node = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "parameters" => { - parameters = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "parent_pipeline" => { - parent_pipeline = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "partial_retry" => { - partial_retry = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "pipeline_id" => { - if v.is_null() { - continue; - } - pipeline_id = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "previous_attempt" => { - previous_attempt = - Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "queue_time" => { - queue_time = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "start" => { - start = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "status" => { - status = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - if let Some(ref _status) = status { - match _status { - crate::datadogV2::model::CIAppPipelineEventPipelineStatus::UnparsedObject(_status) => { - _unparsed = true; - }, - _ => {} - } - } - } - "tags" => { - tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "unique_id" => { - unique_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - "url" => { - url = Some(serde_json::from_value(v).map_err(M::Error::custom)?); - } - &_ => { - if let Ok(value) = serde_json::from_value(v.clone()) { - additional_properties.insert(k, value); - } - } - } - } - let end = end.ok_or_else(|| M::Error::missing_field("end"))?; - let level = level.ok_or_else(|| M::Error::missing_field("level"))?; - let name = name.ok_or_else(|| M::Error::missing_field("name"))?; - let partial_retry = - partial_retry.ok_or_else(|| M::Error::missing_field("partial_retry"))?; - let start = start.ok_or_else(|| M::Error::missing_field("start"))?; - let status = status.ok_or_else(|| M::Error::missing_field("status"))?; - let unique_id = unique_id.ok_or_else(|| M::Error::missing_field("unique_id"))?; - let url = url.ok_or_else(|| M::Error::missing_field("url"))?; - - let content = CIAppPipelineEventPipeline { - end, - error, - git, - is_manual, - is_resumed, - level, - metrics, - name, - node, - parameters, - parent_pipeline, - partial_retry, - pipeline_id, - previous_attempt, - queue_time, - start, - status, - tags, - unique_id, - url, - additional_properties, - _unparsed, - }; - - Ok(content) + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(CIAppPipelineEventPipeline::CIAppPipelineEventInProgressPipeline(_v)); } } - deserializer.deserialize_any(CIAppPipelineEventPipelineVisitor) + return Ok(CIAppPipelineEventPipeline::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); } } diff --git a/src/datadogV2/model/model_ci_app_pipeline_event_pipeline_in_progress_status.rs b/src/datadogV2/model/model_ci_app_pipeline_event_pipeline_in_progress_status.rs new file mode 100644 index 000000000..6e679978c --- /dev/null +++ b/src/datadogV2/model/model_ci_app_pipeline_event_pipeline_in_progress_status.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CIAppPipelineEventPipelineInProgressStatus { + RUNNING, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for CIAppPipelineEventPipelineInProgressStatus { + fn to_string(&self) -> String { + match self { + Self::RUNNING => String::from("running"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for CIAppPipelineEventPipelineInProgressStatus { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for CIAppPipelineEventPipelineInProgressStatus { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "running" => Self::RUNNING, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen index de1ba14a5..2f1c06d3b 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-11-28T11:57:44.730Z \ No newline at end of file +2024-11-25T20:08:40.375Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.json index 52d94db83..339c89584 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.json +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.json @@ -19,7 +19,7 @@ }, "response": { "body": { - "string": "{\"meta\":{\"elapsed\":170,\"request_id\":\"pddv1ChYzYWhuN3VqLVR4ZTV4V0Q0LVFDYVB3IiwKHKG6G1xIn05fWwGRsD7MITrTmBASHDayL3wqgBcSDEOG5uEAxWRZVp8G4w\",\"status\":\"done\"},\"data\":{\"buckets\":[{\"computes\":{\"c0\":236880835985.0375},\"by\":{\"@ci.status\":\"error\"}},{\"computes\":{\"c0\":3026515237.0540113},\"by\":{\"@ci.status\":\"skipped\"}},{\"computes\":{\"c0\":146575581775.90088},\"by\":{\"@ci.status\":\"success\"}}]}}", + "string": "{\"meta\":{\"elapsed\":90,\"request_id\":\"pddv1ChZiVnBUVTltRVJocUlzSWlyYkdkRHFRIi0KHQLKXxzUXfzSm-D5KYypc61Y_NGGMKnRbrtODJpWEgwQ-7lds-czCpOBaB4\",\"status\":\"done\"},\"data\":{\"buckets\":[]}}\n", "encoding": null }, "headers": { @@ -32,7 +32,7 @@ "message": "OK" } }, - "recorded_at": "Mon, 28 Nov 2022 11:57:44 GMT" + "recorded_at": "Mon, 25 Nov 2024 20:08:40 GMT" } ], "recorded_with": "VCR 6.0.0" diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen index db490a74c..79cb47db8 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-11-28T11:57:44.947Z \ No newline at end of file +2024-11-25T20:08:40.699Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.json index ff1679951..197018553 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.json +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.json @@ -9,11 +9,11 @@ ] }, "method": "get", - "uri": "https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bfrom%5D=2022-11-28T11%3A27%3A44.947Z&filter%5Bto%5D=2022-11-28T11%3A57%3A44.947Z&page%5Blimit%5D=5" + "uri": "https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bfrom%5D=2024-11-25T19%3A38%3A40.699Z&filter%5Bto%5D=2024-11-25T20%3A08%3A40.699Z&page%5Blimit%5D=5" }, "response": { "body": { - "string": "{\"data\":[{\"id\":\"AgAAAYS-GYtIKjvAWQAAAAAAAAAYAAAAAEFZUy1HWXRJQUFDVGxWdU5hQ2MyOW5kYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":176127000000,\"git\":{\"commit\":{\"committer\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"author\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"message\":\"Directly send SIGPROF signals to thread holding Global VM Lock\",\"sha\":\"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a\"},\"repository_url\":\"https://github.com/DataDog/repo\",\"repository\":{\"path\":\"/DataDog/repo\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"johndoe/directly-signal-gvl-thread\"},\"ci\":{\"pipeline\":{\"name\":\"build-and-test\",\"id\":\"e67854de-34d7-4782-a62a-2231977026a6\",\"url\":\"https://app.circleci.com/pipelines/workflows/e67804de-0000-4782-a62a-2231977026a6\"},\"provider\":{\"instance\":\"circleci\",\"name\":\"circleci\"},\"job\":{\"name\":\"test-3.0\",\"id\":\"b2fd7e9c-be84-4ad7-9cc5-3796b0cdbede\",\"url\":\"https://app.circleci.com/jobs/gh/DataDog/repo/301777\"},\"status\":\"success\"},\"circleci\":{\"result\":\"success\"},\"start\":1669636479817000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYS-GWnbVbAEgQAAAAAAAAAYAAAAAEFZUy1HV25iQUFDWG5zSTV2dWM3dzNkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":226593000000,\"git\":{\"commit\":{\"committer\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"author\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"message\":\"Directly send SIGPROF signals to thread holding Global VM Lock\",\"sha\":\"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a\"},\"repository_url\":\"https://github.com/DataDog/repo\",\"repository\":{\"path\":\"/DataDog/drepo\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"johndoe/directly-signal-gvl-thread\"},\"ci\":{\"pipeline\":{\"name\":\"build-and-test\",\"id\":\"e67854de-0000-4782-a62a-2231977026a6\",\"url\":\"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6\"},\"provider\":{\"instance\":\"circleci\",\"name\":\"circleci\"},\"job\":{\"name\":\"build-jruby-9.3-latest-1\",\"id\":\"55c12323-bb52-48ad-8f66-42a65d50bad5\",\"url\":\"https://app.circleci.com/jobs/gh/DataDog/repo/301773\"},\"status\":\"success\"},\"circleci\":{\"result\":\"success\"},\"start\":1669636420794000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYS-GUIqP9PNOgAAAAAAAAAYAAAAAEFZUy1HVUlxQUFDekFXOHlOUHZTVVhkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":217224000000,\"git\":{\"commit\":{\"committer\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"author\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"message\":\"Directly send SIGPROF signals to thread holding Global VM Lock\",\"sha\":\"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a\"},\"repository_url\":\"https://github.com/DataDog/repo\",\"repository\":{\"path\":\"DataDog/repo\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"johndoe/directly-signal-gvl-thread\"},\"ci\":{\"pipeline\":{\"name\":\"build-and-test\",\"id\":\"e67854de-34d7-4782-a62a-2231977026a6\",\"url\":\"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6\"},\"provider\":{\"instance\":\"circleci\",\"name\":\"circleci\"},\"job\":{\"name\":\"build_and_test_integration-2.4\",\"id\":\"dfb0036b-f9b7-414b-a147-1991e4bf7611\",\"url\":\"https://app.circleci.com/jobs/gh/DataDog/repo/301772\"},\"status\":\"success\"},\"circleci\":{\"result\":\"success\"},\"start\":1669636420002000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYS-GPpigabGUAAAAAAAAAAYAAAAAEFZUy1HUHBpQUFBTEMyS0MwclNtTjNkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":200658000000,\"git\":{\"commit\":{\"committer\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"author\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"message\":\"Directly send SIGPROF signals to thread holding Global VM Lock\",\"sha\":\"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a\"},\"repository_url\":\"https://github.com/DataDog/repo\",\"repository\":{\"path\":\"/DataDog/repo\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"johndoe/directly-signal-gvl-thread\"},\"ci\":{\"pipeline\":{\"name\":\"build-and-test\",\"id\":\"e67854de-34d7-4782-a62a-2231977026a6\",\"url\":\"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6\"},\"provider\":{\"instance\":\"circleci\",\"name\":\"circleci\"},\"job\":{\"name\":\"build-jruby-9.2-latest-1\",\"id\":\"09df7769-9b36-40cd-af1c-e97a00e233a5\",\"url\":\"https://app.circleci.com/jobs/gh/DataDog/repo/301760\"},\"status\":\"success\"},\"circleci\":{\"result\":\"success\"},\"start\":1669636418192000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYS-GOd-VzPNOgAAAAAAAAAYAAAAAEFZUy1HT2QtQUFEUzFMbWdMNW4wTFhkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":195791000000,\"git\":{\"commit\":{\"committer\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"author\":{\"date\":\"2022-11-28T11:53:10Z\",\"name\":\"John Doe\",\"email\":\"john.doe@email.com\",\"date_timestamp\":1669636390000},\"message\":\"Directly send SIGPROF signals to thread holding Global VM Lock\",\"sha\":\"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a\"},\"repository_url\":\"https://github.com/DataDog/dd-trace-rb\",\"repository\":{\"path\":\"/DataDog/repo\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"johndoe/directly-signal-gvl-thread\"},\"ci\":{\"pipeline\":{\"name\":\"build-and-test\",\"id\":\"e67854de-34d7-4782-a62a-2231977026a6\",\"url\":\"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6\"},\"provider\":{\"instance\":\"circleci\",\"name\":\"circleci\"},\"job\":{\"name\":\"build_and_test_integration-2.3\",\"id\":\"64006f66-267a-47b7-8823-94833268546a\",\"url\":\"https://app.circleci.com/jobs/gh/DataDog/repo/301761\"},\"status\":\"success\"},\"circleci\":{\"result\":\"success\"},\"start\":1669636418223000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}}],\"meta\":{\"page\":{\"after\":\"eyJhZnRlciI6IkFnQUFBWVMtR09kLVZ6UE5PZ0FBQUFBQUFBQVlBQUFBQUVGWlV5MUhUMlF0UVVGRVV6Rk1iV2RNTlc0d1RGaGtZUUFBQUNRQUFBQUFNREU0TkdKbE1XSXRPRE0yT0MwMFlXTmtMVGcwWkdNdFpUWXpNRE16TWprNU1qZ3oifQ\"}},\"links\":{\"next\":\"https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bfrom%5D=2022-11-28T11%3A27%3A44.947Z&filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bto%5D=2022-11-28T11%3A57%3A44.947Z&page%5Bcursor%5D=eyJhZnRlciI6IkFnQUFBWVMtR09kLVZ6UE5PZ0FBQUFBQUFBQVlBQUFBQUVGWlV5MUhUMlF0UVVGRVV6Rk1iV2RNTlc0d1RGaGtZUUFBQUNRQUFBQUFNREU0TkdKbE1XSXRPRE0yT0MwMFlXTmtMVGcwWkdNdFpUWXpNRE16TWprNU1qZ3oifQ&page%5Blimit%5D=5\"}}", + "string": "{\"data\":[],\"meta\":{\"elapsed\":24,\"request_id\":\"pddv1ChZWQVB6eTZTZlNqbUZVNm52YmpoX3ZnIi0KHc-jI3NiRHtRq6GL8JBczM6emoOFupT0-5U_puB2EgwHRoVgx7kIsJDWMYA\",\"status\":\"done\"}}\n", "encoding": null }, "headers": { @@ -26,7 +26,7 @@ "message": "OK" } }, - "recorded_at": "Mon, 28 Nov 2022 11:57:44 GMT" + "recorded_at": "Mon, 25 Nov 2024 20:08:40 GMT" } ], "recorded_with": "VCR 6.0.0" diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen index 7fa758696..934c9992f 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-10-21T09:09:41.747Z \ No newline at end of file +2024-11-25T20:08:40.877Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.json index 96e8a2fd7..ab37cb113 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.json +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.json @@ -19,7 +19,7 @@ }, "response": { "body": { - "string": "{\"data\":[{\"id\":\"AgAAAYP5wIfA7N1YyAAAAAAAAAAYAAAAAEFZUDV3SWZBQUFBZGs5R2kyd25pbjdNMQAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":0,\"github\":{\"conclusion\":\"failure\",\"node_group\":\"\",\"html_url\":\"https://github.com/DataDog/repo\",\"run_attempt\":\"1\",\"app_id\":\"128890\"},\"git\":{\"commit\":{\"sha\":\"95094daa15b4281c41780073ab8b77bc7c8d63d6\"},\"default_branch\":\"prod\",\"repository_url\":\"https://github.com/DataDog/repo.git\",\"repository\":{\"path\":\"/DataDog/repo.git\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"erkang.zhang/SYM-390/cache-test-spec\"},\"ci\":{\"pipeline\":{\"name\":\"Request Schema diff\",\"id\":\"3296065344-1\"},\"node\":{\"labels\":[]},\"provider\":{\"instance\":\"github-actions\",\"name\":\"github\"},\"job\":{\"name\":\"Annotate PR\",\"id\":\"9025881221\",\"url\":\"https://github.com/DataDog/repo/runs/9025881221\"},\"status\":\"error\"},\"start\":1666342488000000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYP5wZVIw5--1wAAAAAAAAAYAAAAAEFZUDV3WlZJQUFCakl1V1FZUE1TdHlxYgAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":247000000000,\"github\":{\"conclusion\":\"failure\",\"node_group\":\"GitHub Actions\",\"html_url\":\"https://github.com/DataDog/repo\",\"run_attempt\":\"1\",\"app_id\":\"128890\"},\"git\":{\"commit\":{\"sha\":\"51aec3962c7b3be87b2d656b22042ee5e2c89a3f\"},\"repository_url\":\"https://github.com/DataDog/repo.git\",\"repository\":{\"path\":\"/DataDog/repo.git\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"master\"},\"ci\":{\"pipeline\":{\"name\":\"Staging Build Deploy and Test\",\"id\":\"3296065853-1\"},\"provider\":{\"instance\":\"github-actions\",\"name\":\"github\"},\"step\":{\"name\":\"Run Datadog Synthetic test\"},\"job\":{\"name\":\"test-checkouts\",\"id\":\"9025825907\"},\"status\":\"error\"},\"start\":1666342310000000000},\"ci_level\":\"step\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYP5wZkww5--2gAAAAAAAAAYAAAAAEFZUDV3Wmt3QUFBN1R2bTVRRkxzaENxYgAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":251000000000,\"github\":{\"conclusion\":\"failure\",\"node_group\":\"GitHub Actions\",\"html_url\":\"https://github.com/DataDog/repo\",\"run_attempt\":\"1\",\"app_id\":\"128890\"},\"git\":{\"commit\":{\"sha\":\"51aec3962c7b3be87b2d656b22042ee5e2c89a3f\"},\"default_branch\":\"master\",\"repository_url\":\"https://github.com/DataDog/repo.git\",\"repository\":{\"path\":\"/DataDog/repo.git\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"master\"},\"ci\":{\"pipeline\":{\"name\":\"Staging Build Deploy and Test\",\"id\":\"3296065853-1\"},\"node\":{\"labels\":[\"ubuntu-latest\"]},\"provider\":{\"instance\":\"github-actions\",\"name\":\"github\"},\"job\":{\"name\":\"test-checkouts\",\"id\":\"9025825907\",\"url\":\"https://github.com/DataDog/repo/actions/runs/3296065853/jobs/5435334930\"},\"status\":\"error\"},\"start\":1666342307000000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYP5wmg4dbfjZwAAAAAAAAAYAAAAAEFZUDV3bWc0QUFBX0RBNlJkS1RqWkNLSAAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":29000000000,\"github\":{\"conclusion\":\"failure\",\"node_group\":\"GitHub Actions\",\"html_url\":\"https://github.com/DataDog/repo\",\"run_attempt\":\"1\",\"app_id\":\"128890\"},\"git\":{\"commit\":{\"sha\":\"62bd7b957a4db5b6926ca570b087b3cfdb9f05a7\"},\"repository_url\":\"https://github.com/DataDog/repo.git\",\"repository\":{\"path\":\"/DataDog/repo.git\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"juanjux/APPSEC-6399-only-report-actorip-on-attack-part2\"},\"ci\":{\"pipeline\":{\"name\":\"Framework tests\",\"id\":\"3296098174-1\"},\"provider\":{\"instance\":\"github-actions\",\"name\":\"github\"},\"step\":{\"name\":\"Run tests\"},\"job\":{\"name\":\"starlette-testsuite-0_17_1\",\"id\":\"9025869107\"},\"status\":\"error\"},\"start\":1666342582000000000},\"ci_level\":\"step\",\"tags\":[\"source:apm\",\"source:apm\"]}},{\"id\":\"AgAAAYP5wnAIdbfjbAAAAAAAAAAYAAAAAEFZUDV3bkFJQUFENkpheXhlTXJfS3lLSAAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx\",\"type\":\"cipipeline\",\"attributes\":{\"attributes\":{\"duration\":164000000000,\"github\":{\"conclusion\":\"failure\",\"node_group\":\"GitHub Actions\",\"html_url\":\"https://github.com/DataDog/repo\",\"run_attempt\":\"1\",\"app_id\":\"128890\"},\"git\":{\"commit\":{\"sha\":\"62bd7b957a4db5b6926ca570b087b3cfdb9f05a7\"},\"default_branch\":\"1.x\",\"repository_url\":\"https://github.com/DataDog/repo.git\",\"repository\":{\"path\":\"/DataDog/repo.git\",\"scheme\":\"https\",\"name\":\"DataDog/repo\",\"host\":\"github.com\",\"id\":\"github.com/DataDog/repo\"},\"branch\":\"juanjux/APPSEC-6399-only-report-actorip-on-attack-part2\"},\"ci\":{\"pipeline\":{\"name\":\"Framework tests\",\"id\":\"3296098174-1\"},\"node\":{\"labels\":[\"ubuntu-latest\"]},\"provider\":{\"instance\":\"github-actions\",\"name\":\"github\"},\"job\":{\"name\":\"starlette-testsuite-0_17_1\",\"id\":\"9025869107\",\"url\":\"https://github.com/DataDog/repo/actions/runs/3296098174/jobs/5435368427\"},\"status\":\"error\"},\"start\":1666342449000000000},\"ci_level\":\"job\",\"tags\":[\"source:apm\",\"source:apm\"]}}],\"meta\":{\"page\":{\"after\":\"eyJhZnRlciI6IkFnQUFBWVA1d25BSWRiZmpiQUFBQUFBQUFBQVlBQUFBQUVGWlVEVjNia0ZKUVVGRU5rcGhlWGhsVFhKZlMzbExTQUFBQUNRQUFBQUFNREU0TTJZNVl6VXRZV1V3WmkwME16RmhMV0kwTVdJdE9HVTJNRGcxTkRNM016QXgifQ\"}},\"links\":{\"next\":\"https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bfrom%5D=now-15m&filter%5Bquery%5D=%40ci.provider.name%3Agithub+AND+%40ci.status%3Aerror&filter%5Bto%5D=now&page%5Bcursor%5D=eyJhZnRlciI6IkFnQUFBWVA1d25BSWRiZmpiQUFBQUFBQUFBQVlBQUFBQUVGWlVEVjNia0ZKUVVGRU5rcGhlWGhsVFhKZlMzbExTQUFBQUNRQUFBQUFNREU0TTJZNVl6VXRZV1V3WmkwME16RmhMV0kwTVdJdE9HVTJNRGcxTkRNM016QXgifQ&page%5Blimit%5D=5&sort=timestamp\"}}\n", + "string": "{\"data\":[],\"meta\":{\"elapsed\":20,\"request_id\":\"pddv1ChZSTVpjd2Q0MlI2LVVBNjVTYlhFUThBIi0KHQuJgBOuQyr2rULJokHKzwf2zKDYmaOmEm5TrJuvEgyvH4LB-7WWiTQznlw\",\"status\":\"done\"}}\n", "encoding": null }, "headers": { @@ -32,7 +32,7 @@ "message": "OK" } }, - "recorded_at": "Fri, 21 Oct 2022 09:09:41 GMT" + "recorded_at": "Mon, 25 Nov 2024 20:08:40 GMT" } ], "recorded_with": "VCR 6.0.0" diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen index f80fdc73b..9ea3b8ed0 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen @@ -1 +1 @@ -2023-06-22T08:08:28.046Z \ No newline at end of file +2024-11-25T20:08:41.018Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.json index 2480fd9cf..653c9a6a9 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.json +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.json @@ -3,7 +3,7 @@ { "request": { "body": { - "string": "{\"data\":{\"attributes\":{\"resource\":{\"end\":\"2023-06-22T08:07:58.046Z\",\"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\":\"2023-06-22T08:06:28.046Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}", + "string": "{\"data\":{\"attributes\":{\"resource\":{\"end\":\"2024-11-25T20:08:11.018Z\",\"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\":\"2024-11-25T20:06:41.018Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}", "encoding": null }, "headers": { @@ -32,7 +32,7 @@ "message": "Accepted" } }, - "recorded_at": "Thu, 22 Jun 2023 08:08:28 GMT" + "recorded_at": "Mon, 25 Nov 2024 20:08:41 GMT" } ], "recorded_with": "VCR 6.0.0" diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen index bdbb925c5..ad34df988 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen @@ -1 +1 @@ -2023-09-27T09:29:38.798Z \ No newline at end of file +2024-11-25T20:08:41.167Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.json index 48686b185..f1be4ea88 100644 --- a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.json +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.json @@ -3,7 +3,7 @@ { "request": { "body": { - "string": "{\"data\":{\"attributes\":{\"resource\":{\"end\":\"2023-09-27T09:29:08.798Z\",\"id\":\"cf9456de-8b9e-4c27-aa79-27b1e78c1a33\",\"level\":\"job\",\"name\":\"Build image\",\"pipeline_name\":\"Deploy to AWS\",\"pipeline_unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"start\":\"2023-09-27T09:27:38.798Z\",\"status\":\"error\",\"url\":\"https://my-ci-provider.example/jobs/my-jobs/run/1\"}},\"type\":\"cipipeline_resource_request\"}}", + "string": "{\"data\":{\"attributes\":{\"resource\":{\"end\":\"2024-11-25T20:08:11.167Z\",\"id\":\"cf9456de-8b9e-4c27-aa79-27b1e78c1a33\",\"level\":\"job\",\"name\":\"Build image\",\"pipeline_name\":\"Deploy to AWS\",\"pipeline_unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"start\":\"2024-11-25T20:06:41.167Z\",\"status\":\"error\",\"url\":\"https://my-ci-provider.example/jobs/my-jobs/run/1\"}},\"type\":\"cipipeline_resource_request\"}}", "encoding": null }, "headers": { @@ -32,7 +32,7 @@ "message": "Accepted" } }, - "recorded_at": "Wed, 27 Sep 2023 09:29:38 GMT" + "recorded_at": "Mon, 25 Nov 2024 20:08:41 GMT" } ], "recorded_with": "VCR 6.0.0" diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen new file mode 100644 index 000000000..229caddd7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen @@ -0,0 +1 @@ +2024-11-25T20:08:41.317Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.json b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.json new file mode 100644 index 000000000..31dce3fa9 --- /dev/null +++ b/tests/scenarios/cassettes/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"resource\":{\"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\":\"2024-11-25T20:06:41.317Z\",\"status\":\"running\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/ci/pipeline" + }, + "response": { + "body": { + "string": "{\"data\":null}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 202, + "message": "Accepted" + } + }, + "recorded_at": "Mon, 25 Nov 2024 20:08:41 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/ci_visibility_pipelines.feature b/tests/scenarios/features/v2/ci_visibility_pipelines.feature index 71dcea8c1..7f7079507 100644 --- a/tests/scenarios/features/v2/ci_visibility_pipelines.feature +++ b/tests/scenarios/features/v2/ci_visibility_pipelines.feature @@ -104,13 +104,20 @@ Feature: CI Visibility Pipelines @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": {"end": "{{ timeISO('now - 30s') }}", "level": "pipeline", "name": "Deploy to AWS", "partial_retry": false, "start": "{{ timeISO('now - 120s') }}", "status": "success", "unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","git":{"repository_url":"https://github.com/DataDog/datadog-agent","sha":"7f263865994b76066c4612fd1965215e7dcb4cd2","author_email":"john.doe@email.com"}}}, "type": "cipipeline_resource_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 @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": {"end": "{{ timeISO('now - 30s') }}", "level": "job", "name": "Build image", "start": "{{ timeISO('now - 120s') }}", "status": "error", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "url": "https://my-ci-provider.example/jobs/my-jobs/run/1"}}, "type": "cipipeline_resource_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 + 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