diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac87f..1779c0ae0914 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13851,11 +13851,19 @@ components: tags: $ref: "#/components/schemas/TagsEventAttribute" type: object - CIAppPipelineEventFinishedPipeline: - description: Details of a finished pipeline. + CIAppPipelineEventFinishedJob: + description: Details of a finished CI job. properties: + dependencies: + description: A list of job IDs that this job depends on. + example: ["f7e6a006-a029-46c3-b0cc-742c9d7d363b", "c8a69849-3c3b-4721-8b33-3e8ec2df1ebe"] + items: + description: A list of job IDs. + type: string + nullable: true + type: array 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. + description: Time when the job run finished. The time format must be RFC3339. example: "2023-05-31T15:30:00Z" format: date-time type: string @@ -13863,44 +13871,30 @@ components: $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 + id: + description: The UUID for the job. It has to be unique within each pipeline execution. + example: c865bad4-de82-44b8-ade7-2c987528eb54 + type: string level: - $ref: "#/components/schemas/CIAppPipelineEventPipelineLevel" + $ref: "#/components/schemas/CIAppPipelineEventJobLevel" 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 + description: The name for the job. + example: test 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" + pipeline_name: + description: The parent pipeline name. + example: Build + type: string + pipeline_unique_id: + description: The parent pipeline UUID. + example: "76b572af-a078-42b2-a08a-cc28f98b944f" type: string - previous_attempt: - $ref: "#/components/schemas/CIAppPipelineEventPreviousPipeline" queue_time: description: The queue time in milliseconds, if applicable. example: 1004 @@ -13908,38 +13902,48 @@ components: minimum: 0 nullable: true type: integer + stage_id: + description: The parent stage UUID (if applicable). + nullable: true + type: string + stage_name: + description: The parent stage name (if applicable). + nullable: true + type: string start: - description: Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. + description: |- + Time when the job run instance 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" + $ref: "#/components/schemas/CIAppPipelineEventJobStatus" 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 + description: The URL to look at the job in the CI provider UI. + example: https://ci-platform.com/job/your-job-name/build/123 type: string required: - level - - unique_id + - id - name - - url + - pipeline_unique_id + - pipeline_name - start - end - status - - partial_retry + - url type: object - CIAppPipelineEventInProgressPipeline: - description: Details of a running pipeline. + 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: @@ -13995,12 +13999,13 @@ components: format: date-time type: string status: - $ref: "#/components/schemas/CIAppPipelineEventPipelineInProgressStatus" + $ref: "#/components/schemas/CIAppPipelineEventPipelineStatus" tags: $ref: "#/components/schemas/CIAppPipelineEventTags" unique_id: description: |- - UUID of the pipeline run. The ID has to be the same as the finished pipeline. + 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: @@ -14013,11 +14018,12 @@ components: - name - url - start + - end - status - partial_retry type: object - CIAppPipelineEventJob: - description: Details of a CI job. + CIAppPipelineEventInProgressJob: + description: Details of a running CI job. properties: dependencies: description: A list of job IDs that this job depends on. @@ -14027,17 +14033,12 @@ components: type: string nullable: true type: array - end: - description: Time when the job run finished. 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" id: - description: The UUID for the job. It has to be unique within each pipeline execution. + description: The UUID for the job. It must match the ID of the corresponding finished job. example: c865bad4-de82-44b8-ade7-2c987528eb54 type: string level: @@ -14076,12 +14077,14 @@ components: nullable: true type: string start: - description: Time when the job run instance started (it should not include any queue time). The time format must be RFC3339. + description: |- + Time when the job run instance 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/CIAppPipelineEventJobStatus" + $ref: "#/components/schemas/CIAppPipelineEventJobInProgressStatus" tags: $ref: "#/components/schemas/CIAppPipelineEventTags" url: @@ -14095,10 +14098,99 @@ components: - pipeline_unique_id - pipeline_name - start - - end - status - url 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. + oneOf: + - $ref: "#/components/schemas/CIAppPipelineEventFinishedJob" + - $ref: "#/components/schemas/CIAppPipelineEventInProgressJob" + CIAppPipelineEventJobInProgressStatus: + description: The in-progress status of the job. + enum: ["running"] + example: running + type: string + x-enum-varnames: ["RUNNING"] CIAppPipelineEventJobLevel: default: job description: Used to distinguish between pipelines, stages, jobs, and steps. diff --git a/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/frozen.json b/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/frozen.json new file mode 100644 index 000000000000..2015922622a6 --- /dev/null +++ b/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/frozen.json @@ -0,0 +1 @@ +"2026-06-23T12:16:50.217Z" diff --git a/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/recording.har b/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/recording.har new file mode 100644 index 000000000000..f7dca46d9f5b --- /dev/null +++ b/cassettes/v2/CI-Visibility-Pipelines_2492627744/Send-running-job-event-returns-Request-accepted-for-processing-response_1347005147/recording.har @@ -0,0 +1,67 @@ +{ + "log": { + "_recordingName": "CI Visibility Pipelines/Send running job event returns \"Request accepted for processing\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "76fcf06dcd10c086ca48dc2cc137e937", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 358, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 507, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"resource\":{\"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\":\"2026-06-23T12:14:50.217Z\",\"status\":\"running\",\"url\":\"https://my-ci-provider.example/jobs/my-jobs/run/1\"}},\"type\":\"cipipeline_resource_request\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/ci/pipeline" + }, + "response": { + "bodySize": 13, + "content": { + "mimeType": "application/vnd.api+json", + "size": 13, + "text": "{\"data\":null}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 676, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 202, + "statusText": "Accepted" + }, + "startedDateTime": "2026-06-23T12:16:50.595Z", + "time": 354 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.ts b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.ts new file mode 100644 index 000000000000..1ffad756f0a7 --- /dev/null +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.ts @@ -0,0 +1,37 @@ +/** + * Send running job event returns "Request accepted for processing" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.CIVisibilityPipelinesApi(configuration); + +const params: v2.CIVisibilityPipelinesApiCreateCIAppPipelineEventRequest = { + body: { + data: { + attributes: { + resource: { + level: "job", + id: "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", + name: "Build image", + pipelineUniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + pipelineName: "Deploy to AWS", + start: new Date(new Date().getTime() + -120 * 1000), + status: "running", + url: "https://my-ci-provider.example/jobs/my-jobs/run/1", + }, + }, + type: "cipipeline_resource_request", + }, + }, +}; + +apiInstance + .createCIAppPipelineEvent(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/v2/ci_visibility_pipelines.feature b/features/v2/ci_visibility_pipelines.feature index 3c52a30f4b70..c81cb9ec82e8 100644 --- a/features/v2/ci_visibility_pipelines.feature +++ b/features/v2/ci_visibility_pipelines.feature @@ -122,6 +122,13 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 202 Request accepted for processing + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend + Scenario: Send running job event returns "Request accepted for processing" response + Given new "CreateCIAppPipelineEvent" 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') }}", "status": "running", "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 + @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend Scenario: Send running pipeline event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 2bf02f2dcb51..cc06716be41b 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -2648,9 +2648,12 @@ export { CIAppGroupByTotal } from "./models/CIAppGroupByTotal"; export { CIAppHostInfo } from "./models/CIAppHostInfo"; export { CIAppPipelineEvent } from "./models/CIAppPipelineEvent"; export { CIAppPipelineEventAttributes } from "./models/CIAppPipelineEventAttributes"; +export { CIAppPipelineEventFinishedJob } from "./models/CIAppPipelineEventFinishedJob"; export { CIAppPipelineEventFinishedPipeline } from "./models/CIAppPipelineEventFinishedPipeline"; +export { CIAppPipelineEventInProgressJob } from "./models/CIAppPipelineEventInProgressJob"; export { CIAppPipelineEventInProgressPipeline } from "./models/CIAppPipelineEventInProgressPipeline"; export { CIAppPipelineEventJob } from "./models/CIAppPipelineEventJob"; +export { CIAppPipelineEventJobInProgressStatus } from "./models/CIAppPipelineEventJobInProgressStatus"; export { CIAppPipelineEventJobLevel } from "./models/CIAppPipelineEventJobLevel"; export { CIAppPipelineEventJobStatus } from "./models/CIAppPipelineEventJobStatus"; export { CIAppPipelineEventParentPipeline } from "./models/CIAppPipelineEventParentPipeline"; diff --git a/packages/datadog-api-client-v2/models/CIAppPipelineEventFinishedJob.ts b/packages/datadog-api-client-v2/models/CIAppPipelineEventFinishedJob.ts new file mode 100644 index 000000000000..91207f8e532c --- /dev/null +++ b/packages/datadog-api-client-v2/models/CIAppPipelineEventFinishedJob.ts @@ -0,0 +1,215 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CIAppCIError } from "./CIAppCIError"; +import { CIAppGitInfo } from "./CIAppGitInfo"; +import { CIAppHostInfo } from "./CIAppHostInfo"; +import { CIAppPipelineEventJobLevel } from "./CIAppPipelineEventJobLevel"; +import { CIAppPipelineEventJobStatus } from "./CIAppPipelineEventJobStatus"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Details of a finished CI job. + */ +export class CIAppPipelineEventFinishedJob { + /** + * A list of job IDs that this job depends on. + */ + "dependencies"?: Array; + /** + * Time when the job run finished. The time format must be RFC3339. + */ + "end": Date; + /** + * Contains information of the CI error. + */ + "error"?: CIAppCIError; + /** + * 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. + */ + "git"?: CIAppGitInfo; + /** + * The UUID for the job. It has to be unique within each pipeline execution. + */ + "id": string; + /** + * Used to distinguish between pipelines, stages, jobs, and steps. + */ + "level": CIAppPipelineEventJobLevel; + /** + * A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + */ + "metrics"?: Array; + /** + * The name for the job. + */ + "name": string; + /** + * Contains information of the host running the pipeline, stage, job, or step. + */ + "node"?: CIAppHostInfo; + /** + * A map of key-value parameters or environment variables that were defined for the pipeline. + */ + "parameters"?: { [key: string]: string }; + /** + * The parent pipeline name. + */ + "pipelineName": string; + /** + * The parent pipeline UUID. + */ + "pipelineUniqueId": string; + /** + * The queue time in milliseconds, if applicable. + */ + "queueTime"?: number; + /** + * The parent stage UUID (if applicable). + */ + "stageId"?: string; + /** + * The parent stage name (if applicable). + */ + "stageName"?: string; + /** + * Time when the job run instance started (it should not include any queue time). + * The time format must be RFC3339. + */ + "start": Date; + /** + * The final status of the job. + */ + "status": CIAppPipelineEventJobStatus; + /** + * A list of user-defined tags. The tags must follow the `key:value` pattern. + */ + "tags"?: Array; + /** + * The URL to look at the job in the CI provider UI. + */ + "url": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + dependencies: { + baseName: "dependencies", + type: "Array", + }, + end: { + baseName: "end", + type: "Date", + required: true, + format: "date-time", + }, + error: { + baseName: "error", + type: "CIAppCIError", + }, + git: { + baseName: "git", + type: "CIAppGitInfo", + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + level: { + baseName: "level", + type: "CIAppPipelineEventJobLevel", + required: true, + }, + metrics: { + baseName: "metrics", + type: "Array", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + node: { + baseName: "node", + type: "CIAppHostInfo", + }, + parameters: { + baseName: "parameters", + type: "{ [key: string]: string; }", + }, + pipelineName: { + baseName: "pipeline_name", + type: "string", + required: true, + }, + pipelineUniqueId: { + baseName: "pipeline_unique_id", + type: "string", + required: true, + }, + queueTime: { + baseName: "queue_time", + type: "number", + format: "int64", + }, + stageId: { + baseName: "stage_id", + type: "string", + }, + stageName: { + baseName: "stage_name", + type: "string", + }, + start: { + baseName: "start", + type: "Date", + required: true, + format: "date-time", + }, + status: { + baseName: "status", + type: "CIAppPipelineEventJobStatus", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + }, + url: { + baseName: "url", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CIAppPipelineEventFinishedJob.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CIAppPipelineEventInProgressJob.ts b/packages/datadog-api-client-v2/models/CIAppPipelineEventInProgressJob.ts new file mode 100644 index 000000000000..7976bec963c8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CIAppPipelineEventInProgressJob.ts @@ -0,0 +1,205 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CIAppCIError } from "./CIAppCIError"; +import { CIAppGitInfo } from "./CIAppGitInfo"; +import { CIAppHostInfo } from "./CIAppHostInfo"; +import { CIAppPipelineEventJobInProgressStatus } from "./CIAppPipelineEventJobInProgressStatus"; +import { CIAppPipelineEventJobLevel } from "./CIAppPipelineEventJobLevel"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Details of a running CI job. + */ +export class CIAppPipelineEventInProgressJob { + /** + * A list of job IDs that this job depends on. + */ + "dependencies"?: Array; + /** + * Contains information of the CI error. + */ + "error"?: CIAppCIError; + /** + * 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. + */ + "git"?: CIAppGitInfo; + /** + * The UUID for the job. It must match the ID of the corresponding finished job. + */ + "id": string; + /** + * Used to distinguish between pipelines, stages, jobs, and steps. + */ + "level": CIAppPipelineEventJobLevel; + /** + * A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + */ + "metrics"?: Array; + /** + * The name for the job. + */ + "name": string; + /** + * Contains information of the host running the pipeline, stage, job, or step. + */ + "node"?: CIAppHostInfo; + /** + * A map of key-value parameters or environment variables that were defined for the pipeline. + */ + "parameters"?: { [key: string]: string }; + /** + * The parent pipeline name. + */ + "pipelineName": string; + /** + * The parent pipeline UUID. + */ + "pipelineUniqueId": string; + /** + * The queue time in milliseconds, if applicable. + */ + "queueTime"?: number; + /** + * The parent stage UUID (if applicable). + */ + "stageId"?: string; + /** + * The parent stage name (if applicable). + */ + "stageName"?: string; + /** + * Time when the job run instance started (it should not include any queue time). + * The time format must be RFC3339. + */ + "start": Date; + /** + * The in-progress status of the job. + */ + "status": CIAppPipelineEventJobInProgressStatus; + /** + * A list of user-defined tags. The tags must follow the `key:value` pattern. + */ + "tags"?: Array; + /** + * The URL to look at the job in the CI provider UI. + */ + "url": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + dependencies: { + baseName: "dependencies", + type: "Array", + }, + error: { + baseName: "error", + type: "CIAppCIError", + }, + git: { + baseName: "git", + type: "CIAppGitInfo", + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + level: { + baseName: "level", + type: "CIAppPipelineEventJobLevel", + required: true, + }, + metrics: { + baseName: "metrics", + type: "Array", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + node: { + baseName: "node", + type: "CIAppHostInfo", + }, + parameters: { + baseName: "parameters", + type: "{ [key: string]: string; }", + }, + pipelineName: { + baseName: "pipeline_name", + type: "string", + required: true, + }, + pipelineUniqueId: { + baseName: "pipeline_unique_id", + type: "string", + required: true, + }, + queueTime: { + baseName: "queue_time", + type: "number", + format: "int64", + }, + stageId: { + baseName: "stage_id", + type: "string", + }, + stageName: { + baseName: "stage_name", + type: "string", + }, + start: { + baseName: "start", + type: "Date", + required: true, + format: "date-time", + }, + status: { + baseName: "status", + type: "CIAppPipelineEventJobInProgressStatus", + required: true, + }, + tags: { + baseName: "tags", + type: "Array", + }, + url: { + baseName: "url", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CIAppPipelineEventInProgressJob.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CIAppPipelineEventJob.ts b/packages/datadog-api-client-v2/models/CIAppPipelineEventJob.ts index cdf0dc1b476f..8eee65e32042 100644 --- a/packages/datadog-api-client-v2/models/CIAppPipelineEventJob.ts +++ b/packages/datadog-api-client-v2/models/CIAppPipelineEventJob.ts @@ -3,212 +3,16 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ -import { CIAppCIError } from "./CIAppCIError"; -import { CIAppGitInfo } from "./CIAppGitInfo"; -import { CIAppHostInfo } from "./CIAppHostInfo"; -import { CIAppPipelineEventJobLevel } from "./CIAppPipelineEventJobLevel"; -import { CIAppPipelineEventJobStatus } from "./CIAppPipelineEventJobStatus"; +import { CIAppPipelineEventFinishedJob } from "./CIAppPipelineEventFinishedJob"; +import { CIAppPipelineEventInProgressJob } from "./CIAppPipelineEventInProgressJob"; -import { AttributeTypeMap } from "../../datadog-api-client-common/util"; +import { UnparsedObject } from "../../datadog-api-client-common/util"; /** * Details of a CI job. */ -export class CIAppPipelineEventJob { - /** - * A list of job IDs that this job depends on. - */ - "dependencies"?: Array; - /** - * Time when the job run finished. The time format must be RFC3339. - */ - "end": Date; - /** - * Contains information of the CI error. - */ - "error"?: CIAppCIError; - /** - * 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. - */ - "git"?: CIAppGitInfo; - /** - * The UUID for the job. It has to be unique within each pipeline execution. - */ - "id": string; - /** - * Used to distinguish between pipelines, stages, jobs, and steps. - */ - "level": CIAppPipelineEventJobLevel; - /** - * A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. - */ - "metrics"?: Array; - /** - * The name for the job. - */ - "name": string; - /** - * Contains information of the host running the pipeline, stage, job, or step. - */ - "node"?: CIAppHostInfo; - /** - * A map of key-value parameters or environment variables that were defined for the pipeline. - */ - "parameters"?: { [key: string]: string }; - /** - * The parent pipeline name. - */ - "pipelineName": string; - /** - * The parent pipeline UUID. - */ - "pipelineUniqueId": string; - /** - * The queue time in milliseconds, if applicable. - */ - "queueTime"?: number; - /** - * The parent stage UUID (if applicable). - */ - "stageId"?: string; - /** - * The parent stage name (if applicable). - */ - "stageName"?: string; - /** - * Time when the job run instance started (it should not include any queue time). The time format must be RFC3339. - */ - "start": Date; - /** - * The final status of the job. - */ - "status": CIAppPipelineEventJobStatus; - /** - * A list of user-defined tags. The tags must follow the `key:value` pattern. - */ - "tags"?: Array; - /** - * The URL to look at the job in the CI provider UI. - */ - "url": string; - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - "additionalProperties"?: { [key: string]: any }; - - /** - * @ignore - */ - "_unparsed"?: boolean; - - /** - * @ignore - */ - static readonly attributeTypeMap: AttributeTypeMap = { - dependencies: { - baseName: "dependencies", - type: "Array", - }, - end: { - baseName: "end", - type: "Date", - required: true, - format: "date-time", - }, - error: { - baseName: "error", - type: "CIAppCIError", - }, - git: { - baseName: "git", - type: "CIAppGitInfo", - }, - id: { - baseName: "id", - type: "string", - required: true, - }, - level: { - baseName: "level", - type: "CIAppPipelineEventJobLevel", - required: true, - }, - metrics: { - baseName: "metrics", - type: "Array", - }, - name: { - baseName: "name", - type: "string", - required: true, - }, - node: { - baseName: "node", - type: "CIAppHostInfo", - }, - parameters: { - baseName: "parameters", - type: "{ [key: string]: string; }", - }, - pipelineName: { - baseName: "pipeline_name", - type: "string", - required: true, - }, - pipelineUniqueId: { - baseName: "pipeline_unique_id", - type: "string", - required: true, - }, - queueTime: { - baseName: "queue_time", - type: "number", - format: "int64", - }, - stageId: { - baseName: "stage_id", - type: "string", - }, - stageName: { - baseName: "stage_name", - type: "string", - }, - start: { - baseName: "start", - type: "Date", - required: true, - format: "date-time", - }, - status: { - baseName: "status", - type: "CIAppPipelineEventJobStatus", - required: true, - }, - tags: { - baseName: "tags", - type: "Array", - }, - url: { - baseName: "url", - type: "string", - required: true, - }, - additionalProperties: { - baseName: "additionalProperties", - type: "{ [key: string]: any; }", - }, - }; - - /** - * @ignore - */ - static getAttributeTypeMap(): AttributeTypeMap { - return CIAppPipelineEventJob.attributeTypeMap; - } - - public constructor() {} -} +export type CIAppPipelineEventJob = + | CIAppPipelineEventFinishedJob + | CIAppPipelineEventInProgressJob + | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/CIAppPipelineEventJobInProgressStatus.ts b/packages/datadog-api-client-v2/models/CIAppPipelineEventJobInProgressStatus.ts new file mode 100644 index 000000000000..cd50c532c9ea --- /dev/null +++ b/packages/datadog-api-client-v2/models/CIAppPipelineEventJobInProgressStatus.ts @@ -0,0 +1,16 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The in-progress status of the job. + */ + +export type CIAppPipelineEventJobInProgressStatus = + | typeof RUNNING + | UnparsedObject; +export const RUNNING = "running"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index f9d1153f8abb..3bb3501497cf 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -510,9 +510,10 @@ import { CIAppGroupByHistogram } from "./CIAppGroupByHistogram"; import { CIAppHostInfo } from "./CIAppHostInfo"; import { CIAppPipelineEvent } from "./CIAppPipelineEvent"; import { CIAppPipelineEventAttributes } from "./CIAppPipelineEventAttributes"; +import { CIAppPipelineEventFinishedJob } from "./CIAppPipelineEventFinishedJob"; import { CIAppPipelineEventFinishedPipeline } from "./CIAppPipelineEventFinishedPipeline"; +import { CIAppPipelineEventInProgressJob } from "./CIAppPipelineEventInProgressJob"; import { CIAppPipelineEventInProgressPipeline } from "./CIAppPipelineEventInProgressPipeline"; -import { CIAppPipelineEventJob } from "./CIAppPipelineEventJob"; import { CIAppPipelineEventParentPipeline } from "./CIAppPipelineEventParentPipeline"; import { CIAppPipelineEventPreviousPipeline } from "./CIAppPipelineEventPreviousPipeline"; import { CIAppPipelineEventStage } from "./CIAppPipelineEventStage"; @@ -5498,6 +5499,7 @@ const enumsMap: { [key: string]: any[] } = { CIAppCIErrorDomain: ["provider", "user", "unknown"], CIAppComputeType: ["timeseries", "total"], CIAppCreatePipelineEventRequestDataType: ["cipipeline_resource_request"], + CIAppPipelineEventJobInProgressStatus: ["running"], CIAppPipelineEventJobLevel: ["job"], CIAppPipelineEventJobStatus: ["success", "error", "canceled", "skipped"], CIAppPipelineEventPipelineInProgressStatus: ["running"], @@ -8610,9 +8612,10 @@ const typeMap: { [index: string]: any } = { CIAppHostInfo: CIAppHostInfo, CIAppPipelineEvent: CIAppPipelineEvent, CIAppPipelineEventAttributes: CIAppPipelineEventAttributes, + CIAppPipelineEventFinishedJob: CIAppPipelineEventFinishedJob, CIAppPipelineEventFinishedPipeline: CIAppPipelineEventFinishedPipeline, + CIAppPipelineEventInProgressJob: CIAppPipelineEventInProgressJob, CIAppPipelineEventInProgressPipeline: CIAppPipelineEventInProgressPipeline, - CIAppPipelineEventJob: CIAppPipelineEventJob, CIAppPipelineEventParentPipeline: CIAppPipelineEventParentPipeline, CIAppPipelineEventPreviousPipeline: CIAppPipelineEventPreviousPipeline, CIAppPipelineEventStage: CIAppPipelineEventStage, @@ -14277,6 +14280,10 @@ const oneOfMap: { [index: string]: string[] } = { ], CIAppGroupByMissing: ["string", "number"], CIAppGroupByTotal: ["boolean", "string", "number"], + CIAppPipelineEventJob: [ + "CIAppPipelineEventFinishedJob", + "CIAppPipelineEventInProgressJob", + ], CIAppPipelineEventPipeline: [ "CIAppPipelineEventFinishedPipeline", "CIAppPipelineEventInProgressPipeline",