From 7d822a9124403f40c734676517fc4f53685cc208 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 23 Jun 2026 12:34:23 +0000 Subject: [PATCH] Regenerate client from commit af12d35 of spec repo --- .generator/schemas/v2/openapi.yaml | 210 ++-- .../CreateCIAppPipelineEvent_129899466.java | 26 +- .../CreateCIAppPipelineEvent_4007074677.java | 58 + .../model/CIAppPipelineEventFinishedJob.java | 829 +++++++++++++++ .../CIAppPipelineEventInProgressJob.java | 801 ++++++++++++++ .../v2/model/CIAppPipelineEventJob.java | 989 ++++-------------- ...CIAppPipelineEventJobInProgressStatus.java | 61 ++ ...st_accepted_for_processing_response.freeze | 1 + ...uest_accepted_for_processing_response.json | 32 + .../v2/api/ci_visibility_pipelines.feature | 7 + 10 files changed, 2178 insertions(+), 836 deletions(-) create mode 100644 examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventFinishedJob.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventInProgressJob.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJobInProgressStatus.java create mode 100644 src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac87..1779c0ae091 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/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.java b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.java index cab553182f1..d3a3f969941 100644 --- a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.java +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.java @@ -8,6 +8,7 @@ import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestData; import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestDataSingleOrArray; import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestDataType; +import com.datadog.api.client.v2.model.CIAppPipelineEventFinishedJob; import com.datadog.api.client.v2.model.CIAppPipelineEventJob; import com.datadog.api.client.v2.model.CIAppPipelineEventJobLevel; import com.datadog.api.client.v2.model.CIAppPipelineEventJobStatus; @@ -27,18 +28,19 @@ public static void main(String[] args) { new CIAppCreatePipelineEventRequestAttributes() .resource( new CIAppCreatePipelineEventRequestAttributesResource( - new CIAppPipelineEventJob() - .level(CIAppPipelineEventJobLevel.JOB) - .id("cf9456de-8b9e-4c27-aa79-27b1e78c1a33") - .name("Build image") - .pipelineUniqueId( - "3eacb6f3-ff04-4e10-8a9c-46e6d054024a") - .pipelineName("Deploy to AWS") - .start(OffsetDateTime.now().plusSeconds(-120)) - .end(OffsetDateTime.now().plusSeconds(-30)) - .status(CIAppPipelineEventJobStatus.ERROR) - .url( - "https://my-ci-provider.example/jobs/my-jobs/run/1")))) + new CIAppPipelineEventJob( + new CIAppPipelineEventFinishedJob() + .level(CIAppPipelineEventJobLevel.JOB) + .id("cf9456de-8b9e-4c27-aa79-27b1e78c1a33") + .name("Build image") + .pipelineUniqueId( + "3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .pipelineName("Deploy to AWS") + .start(OffsetDateTime.now().plusSeconds(-120)) + .end(OffsetDateTime.now().plusSeconds(-30)) + .status(CIAppPipelineEventJobStatus.ERROR) + .url( + "https://my-ci-provider.example/jobs/my-jobs/run/1"))))) .type( CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST))); diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.java b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.java new file mode 100644 index 00000000000..7b26f94baf0 --- /dev/null +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_4007074677.java @@ -0,0 +1,58 @@ +// Send running job event returns "Request accepted for processing" response +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.CiVisibilityPipelinesApi; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequest; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestAttributes; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestAttributesResource; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestData; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestDataSingleOrArray; +import com.datadog.api.client.v2.model.CIAppCreatePipelineEventRequestDataType; +import com.datadog.api.client.v2.model.CIAppPipelineEventInProgressJob; +import com.datadog.api.client.v2.model.CIAppPipelineEventJob; +import com.datadog.api.client.v2.model.CIAppPipelineEventJobInProgressStatus; +import com.datadog.api.client.v2.model.CIAppPipelineEventJobLevel; +import java.time.OffsetDateTime; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityPipelinesApi apiInstance = new CiVisibilityPipelinesApi(defaultClient); + + CIAppCreatePipelineEventRequest body = + new CIAppCreatePipelineEventRequest() + .data( + new CIAppCreatePipelineEventRequestDataSingleOrArray( + new CIAppCreatePipelineEventRequestData() + .attributes( + new CIAppCreatePipelineEventRequestAttributes() + .resource( + new CIAppCreatePipelineEventRequestAttributesResource( + new CIAppPipelineEventJob( + new CIAppPipelineEventInProgressJob() + .level(CIAppPipelineEventJobLevel.JOB) + .id("cf9456de-8b9e-4c27-aa79-27b1e78c1a33") + .name("Build image") + .pipelineUniqueId( + "3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .pipelineName("Deploy to AWS") + .start(OffsetDateTime.now().plusSeconds(-120)) + .status( + CIAppPipelineEventJobInProgressStatus.RUNNING) + .url( + "https://my-ci-provider.example/jobs/my-jobs/run/1"))))) + .type( + CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST))); + + try { + apiInstance.createCIAppPipelineEvent(body); + } catch (ApiException e) { + System.err.println( + "Exception when calling CiVisibilityPipelinesApi#createCIAppPipelineEvent"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventFinishedJob.java b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventFinishedJob.java new file mode 100644 index 00000000000..e0346aad720 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventFinishedJob.java @@ -0,0 +1,829 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Details of a finished CI job. */ +@JsonPropertyOrder({ + CIAppPipelineEventFinishedJob.JSON_PROPERTY_DEPENDENCIES, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_END, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_ERROR, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_GIT, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_ID, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_LEVEL, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_METRICS, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_NAME, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_NODE, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_PARAMETERS, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_PIPELINE_NAME, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_PIPELINE_UNIQUE_ID, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_QUEUE_TIME, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_STAGE_ID, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_STAGE_NAME, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_START, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_STATUS, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_TAGS, + CIAppPipelineEventFinishedJob.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppPipelineEventFinishedJob { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEPENDENCIES = "dependencies"; + private JsonNullable> dependencies = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_END = "end"; + private OffsetDateTime end; + + public static final String JSON_PROPERTY_ERROR = "error"; + private JsonNullable error = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_GIT = "git"; + private JsonNullable git = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_LEVEL = "level"; + private CIAppPipelineEventJobLevel level = CIAppPipelineEventJobLevel.JOB; + + public static final String JSON_PROPERTY_METRICS = "metrics"; + private JsonNullable> metrics = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_NODE = "node"; + private JsonNullable node = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PARAMETERS = "parameters"; + private JsonNullable> parameters = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PIPELINE_NAME = "pipeline_name"; + private String pipelineName; + + public static final String JSON_PROPERTY_PIPELINE_UNIQUE_ID = "pipeline_unique_id"; + private String pipelineUniqueId; + + public static final String JSON_PROPERTY_QUEUE_TIME = "queue_time"; + private JsonNullable queueTime = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STAGE_ID = "stage_id"; + private JsonNullable stageId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STAGE_NAME = "stage_name"; + private JsonNullable stageName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_START = "start"; + private OffsetDateTime start; + + public static final String JSON_PROPERTY_STATUS = "status"; + private CIAppPipelineEventJobStatus status; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CIAppPipelineEventFinishedJob() {} + + @JsonCreator + public CIAppPipelineEventFinishedJob( + @JsonProperty(required = true, value = JSON_PROPERTY_END) OffsetDateTime end, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_LEVEL) CIAppPipelineEventJobLevel level, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_NAME) String pipelineName, + @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_UNIQUE_ID) + String pipelineUniqueId, + @JsonProperty(required = true, value = JSON_PROPERTY_START) OffsetDateTime start, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + CIAppPipelineEventJobStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { + this.end = end; + this.id = id; + this.level = level; + this.unparsed |= !level.isValid(); + this.name = name; + this.pipelineName = pipelineName; + this.pipelineUniqueId = pipelineUniqueId; + this.start = start; + this.status = status; + this.unparsed |= !status.isValid(); + this.url = url; + } + + public CIAppPipelineEventFinishedJob dependencies(List dependencies) { + this.dependencies = JsonNullable.>of(dependencies); + return this; + } + + public CIAppPipelineEventFinishedJob addDependenciesItem(String dependenciesItem) { + if (this.dependencies == null || !this.dependencies.isPresent()) { + this.dependencies = JsonNullable.>of(new ArrayList<>()); + } + try { + this.dependencies.get().add(dependenciesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of job IDs that this job depends on. + * + * @return dependencies + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getDependencies() { + return dependencies.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEPENDENCIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getDependencies_JsonNullable() { + return dependencies; + } + + @JsonProperty(JSON_PROPERTY_DEPENDENCIES) + public void setDependencies_JsonNullable(JsonNullable> dependencies) { + this.dependencies = dependencies; + } + + public void setDependencies(List dependencies) { + this.dependencies = JsonNullable.>of(dependencies); + } + + public CIAppPipelineEventFinishedJob end(OffsetDateTime end) { + this.end = end; + return this; + } + + /** + * Time when the job run finished. The time format must be RFC3339. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getEnd() { + return end; + } + + public void setEnd(OffsetDateTime end) { + this.end = end; + } + + public CIAppPipelineEventFinishedJob error(CIAppCIError error) { + this.error = JsonNullable.of(error); + return this; + } + + /** + * Contains information of the CI error. + * + * @return error + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppCIError getError() { + return error.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getError_JsonNullable() { + return error; + } + + @JsonProperty(JSON_PROPERTY_ERROR) + public void setError_JsonNullable(JsonNullable error) { + this.error = error; + } + + public void setError(CIAppCIError error) { + this.error = JsonNullable.of(error); + } + + public CIAppPipelineEventFinishedJob git(CIAppGitInfo git) { + this.git = JsonNullable.of(git); + return this; + } + + /** + * 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. + * + * @return git + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppGitInfo getGit() { + return git.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getGit_JsonNullable() { + return git; + } + + @JsonProperty(JSON_PROPERTY_GIT) + public void setGit_JsonNullable(JsonNullable git) { + this.git = git; + } + + public void setGit(CIAppGitInfo git) { + this.git = JsonNullable.of(git); + } + + public CIAppPipelineEventFinishedJob id(String id) { + this.id = id; + return this; + } + + /** + * The UUID for the job. It has to be unique within each pipeline execution. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CIAppPipelineEventFinishedJob level(CIAppPipelineEventJobLevel level) { + this.level = level; + this.unparsed |= !level.isValid(); + return this; + } + + /** + * Used to distinguish between pipelines, stages, jobs, and steps. + * + * @return level + */ + @JsonProperty(JSON_PROPERTY_LEVEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppPipelineEventJobLevel getLevel() { + return level; + } + + public void setLevel(CIAppPipelineEventJobLevel level) { + if (!level.isValid()) { + this.unparsed = true; + } + this.level = level; + } + + public CIAppPipelineEventFinishedJob metrics(List metrics) { + this.metrics = JsonNullable.>of(metrics); + return this; + } + + public CIAppPipelineEventFinishedJob addMetricsItem(String metricsItem) { + if (this.metrics == null || !this.metrics.isPresent()) { + this.metrics = JsonNullable.>of(new ArrayList<>()); + } + try { + this.metrics.get().add(metricsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of user-defined metrics. The metrics must follow the key:value pattern and + * the value must be numeric. + * + * @return metrics + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getMetrics() { + return metrics.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getMetrics_JsonNullable() { + return metrics; + } + + @JsonProperty(JSON_PROPERTY_METRICS) + public void setMetrics_JsonNullable(JsonNullable> metrics) { + this.metrics = metrics; + } + + public void setMetrics(List metrics) { + this.metrics = JsonNullable.>of(metrics); + } + + public CIAppPipelineEventFinishedJob name(String name) { + this.name = name; + return this; + } + + /** + * The name for the job. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CIAppPipelineEventFinishedJob node(CIAppHostInfo node) { + this.node = JsonNullable.of(node); + return this; + } + + /** + * Contains information of the host running the pipeline, stage, job, or step. + * + * @return node + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppHostInfo getNode() { + return node.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNode_JsonNullable() { + return node; + } + + @JsonProperty(JSON_PROPERTY_NODE) + public void setNode_JsonNullable(JsonNullable node) { + this.node = node; + } + + public void setNode(CIAppHostInfo node) { + this.node = JsonNullable.of(node); + } + + public CIAppPipelineEventFinishedJob parameters(Map parameters) { + this.parameters = JsonNullable.>of(parameters); + return this; + } + + public CIAppPipelineEventFinishedJob putParametersItem(String key, String parametersItem) { + if (this.parameters == null || !this.parameters.isPresent()) { + this.parameters = JsonNullable.>of(new HashMap<>()); + } + try { + this.parameters.get().put(key, parametersItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A map of key-value parameters or environment variables that were defined for the pipeline. + * + * @return parameters + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getParameters() { + return parameters.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getParameters_JsonNullable() { + return parameters; + } + + @JsonProperty(JSON_PROPERTY_PARAMETERS) + public void setParameters_JsonNullable(JsonNullable> parameters) { + this.parameters = parameters; + } + + public void setParameters(Map parameters) { + this.parameters = JsonNullable.>of(parameters); + } + + public CIAppPipelineEventFinishedJob pipelineName(String pipelineName) { + this.pipelineName = pipelineName; + return this; + } + + /** + * The parent pipeline name. + * + * @return pipelineName + */ + @JsonProperty(JSON_PROPERTY_PIPELINE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPipelineName() { + return pipelineName; + } + + public void setPipelineName(String pipelineName) { + this.pipelineName = pipelineName; + } + + public CIAppPipelineEventFinishedJob pipelineUniqueId(String pipelineUniqueId) { + this.pipelineUniqueId = pipelineUniqueId; + return this; + } + + /** + * The parent pipeline UUID. + * + * @return pipelineUniqueId + */ + @JsonProperty(JSON_PROPERTY_PIPELINE_UNIQUE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPipelineUniqueId() { + return pipelineUniqueId; + } + + public void setPipelineUniqueId(String pipelineUniqueId) { + this.pipelineUniqueId = pipelineUniqueId; + } + + public CIAppPipelineEventFinishedJob queueTime(Long queueTime) { + this.queueTime = JsonNullable.of(queueTime); + return this; + } + + /** + * The queue time in milliseconds, if applicable. minimum: 0 + * + * @return queueTime + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getQueueTime() { + return queueTime.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_QUEUE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getQueueTime_JsonNullable() { + return queueTime; + } + + @JsonProperty(JSON_PROPERTY_QUEUE_TIME) + public void setQueueTime_JsonNullable(JsonNullable queueTime) { + this.queueTime = queueTime; + } + + public void setQueueTime(Long queueTime) { + this.queueTime = JsonNullable.of(queueTime); + } + + public CIAppPipelineEventFinishedJob stageId(String stageId) { + this.stageId = JsonNullable.of(stageId); + return this; + } + + /** + * The parent stage UUID (if applicable). + * + * @return stageId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getStageId() { + return stageId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STAGE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getStageId_JsonNullable() { + return stageId; + } + + @JsonProperty(JSON_PROPERTY_STAGE_ID) + public void setStageId_JsonNullable(JsonNullable stageId) { + this.stageId = stageId; + } + + public void setStageId(String stageId) { + this.stageId = JsonNullable.of(stageId); + } + + public CIAppPipelineEventFinishedJob stageName(String stageName) { + this.stageName = JsonNullable.of(stageName); + return this; + } + + /** + * The parent stage name (if applicable). + * + * @return stageName + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getStageName() { + return stageName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STAGE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getStageName_JsonNullable() { + return stageName; + } + + @JsonProperty(JSON_PROPERTY_STAGE_NAME) + public void setStageName_JsonNullable(JsonNullable stageName) { + this.stageName = stageName; + } + + public void setStageName(String stageName) { + this.stageName = JsonNullable.of(stageName); + } + + public CIAppPipelineEventFinishedJob start(OffsetDateTime start) { + this.start = start; + return this; + } + + /** + * Time when the job run instance started (it should not include any queue time). The time format + * must be RFC3339. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStart() { + return start; + } + + public void setStart(OffsetDateTime start) { + this.start = start; + } + + public CIAppPipelineEventFinishedJob status(CIAppPipelineEventJobStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The final status of the job. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppPipelineEventJobStatus getStatus() { + return status; + } + + public void setStatus(CIAppPipelineEventJobStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public CIAppPipelineEventFinishedJob tags(List tags) { + this.tags = JsonNullable.>of(tags); + return this; + } + + public CIAppPipelineEventFinishedJob addTagsItem(String tagsItem) { + if (this.tags == null || !this.tags.isPresent()) { + this.tags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tags.get().add(tagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of user-defined tags. The tags must follow the key:value pattern. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + public void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + public void setTags(List tags) { + this.tags = JsonNullable.>of(tags); + } + + public CIAppPipelineEventFinishedJob url(String url) { + this.url = url; + return this; + } + + /** + * The URL to look at the job in the CI provider UI. + * + * @return url + */ + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppPipelineEventFinishedJob + */ + @JsonAnySetter + public CIAppPipelineEventFinishedJob putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppPipelineEventFinishedJob object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppPipelineEventFinishedJob ciAppPipelineEventFinishedJob = (CIAppPipelineEventFinishedJob) o; + return Objects.equals(this.dependencies, ciAppPipelineEventFinishedJob.dependencies) + && Objects.equals(this.end, ciAppPipelineEventFinishedJob.end) + && Objects.equals(this.error, ciAppPipelineEventFinishedJob.error) + && Objects.equals(this.git, ciAppPipelineEventFinishedJob.git) + && Objects.equals(this.id, ciAppPipelineEventFinishedJob.id) + && Objects.equals(this.level, ciAppPipelineEventFinishedJob.level) + && Objects.equals(this.metrics, ciAppPipelineEventFinishedJob.metrics) + && Objects.equals(this.name, ciAppPipelineEventFinishedJob.name) + && Objects.equals(this.node, ciAppPipelineEventFinishedJob.node) + && Objects.equals(this.parameters, ciAppPipelineEventFinishedJob.parameters) + && Objects.equals(this.pipelineName, ciAppPipelineEventFinishedJob.pipelineName) + && Objects.equals(this.pipelineUniqueId, ciAppPipelineEventFinishedJob.pipelineUniqueId) + && Objects.equals(this.queueTime, ciAppPipelineEventFinishedJob.queueTime) + && Objects.equals(this.stageId, ciAppPipelineEventFinishedJob.stageId) + && Objects.equals(this.stageName, ciAppPipelineEventFinishedJob.stageName) + && Objects.equals(this.start, ciAppPipelineEventFinishedJob.start) + && Objects.equals(this.status, ciAppPipelineEventFinishedJob.status) + && Objects.equals(this.tags, ciAppPipelineEventFinishedJob.tags) + && Objects.equals(this.url, ciAppPipelineEventFinishedJob.url) + && Objects.equals( + this.additionalProperties, ciAppPipelineEventFinishedJob.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dependencies, + end, + error, + git, + id, + level, + metrics, + name, + node, + parameters, + pipelineName, + pipelineUniqueId, + queueTime, + stageId, + stageName, + start, + status, + tags, + url, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppPipelineEventFinishedJob {\n"); + sb.append(" dependencies: ").append(toIndentedString(dependencies)).append("\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" git: ").append(toIndentedString(git)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" node: ").append(toIndentedString(node)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" pipelineName: ").append(toIndentedString(pipelineName)).append("\n"); + sb.append(" pipelineUniqueId: ").append(toIndentedString(pipelineUniqueId)).append("\n"); + sb.append(" queueTime: ").append(toIndentedString(queueTime)).append("\n"); + sb.append(" stageId: ").append(toIndentedString(stageId)).append("\n"); + sb.append(" stageName: ").append(toIndentedString(stageName)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventInProgressJob.java b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventInProgressJob.java new file mode 100644 index 00000000000..e28ee5db459 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventInProgressJob.java @@ -0,0 +1,801 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Details of a running CI job. */ +@JsonPropertyOrder({ + CIAppPipelineEventInProgressJob.JSON_PROPERTY_DEPENDENCIES, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_ERROR, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_GIT, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_ID, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_LEVEL, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_METRICS, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_NAME, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_NODE, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_PARAMETERS, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_PIPELINE_NAME, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_PIPELINE_UNIQUE_ID, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_QUEUE_TIME, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_STAGE_ID, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_STAGE_NAME, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_START, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_STATUS, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_TAGS, + CIAppPipelineEventInProgressJob.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CIAppPipelineEventInProgressJob { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEPENDENCIES = "dependencies"; + private JsonNullable> dependencies = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ERROR = "error"; + private JsonNullable error = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_GIT = "git"; + private JsonNullable git = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_LEVEL = "level"; + private CIAppPipelineEventJobLevel level = CIAppPipelineEventJobLevel.JOB; + + public static final String JSON_PROPERTY_METRICS = "metrics"; + private JsonNullable> metrics = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_NODE = "node"; + private JsonNullable node = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PARAMETERS = "parameters"; + private JsonNullable> parameters = + JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PIPELINE_NAME = "pipeline_name"; + private String pipelineName; + + public static final String JSON_PROPERTY_PIPELINE_UNIQUE_ID = "pipeline_unique_id"; + private String pipelineUniqueId; + + public static final String JSON_PROPERTY_QUEUE_TIME = "queue_time"; + private JsonNullable queueTime = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STAGE_ID = "stage_id"; + private JsonNullable stageId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STAGE_NAME = "stage_name"; + private JsonNullable stageName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_START = "start"; + private OffsetDateTime start; + + public static final String JSON_PROPERTY_STATUS = "status"; + private CIAppPipelineEventJobInProgressStatus status; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public CIAppPipelineEventInProgressJob() {} + + @JsonCreator + public CIAppPipelineEventInProgressJob( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_LEVEL) CIAppPipelineEventJobLevel level, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_NAME) String pipelineName, + @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_UNIQUE_ID) + String pipelineUniqueId, + @JsonProperty(required = true, value = JSON_PROPERTY_START) OffsetDateTime start, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + CIAppPipelineEventJobInProgressStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { + this.id = id; + this.level = level; + this.unparsed |= !level.isValid(); + this.name = name; + this.pipelineName = pipelineName; + this.pipelineUniqueId = pipelineUniqueId; + this.start = start; + this.status = status; + this.unparsed |= !status.isValid(); + this.url = url; + } + + public CIAppPipelineEventInProgressJob dependencies(List dependencies) { + this.dependencies = JsonNullable.>of(dependencies); + return this; + } + + public CIAppPipelineEventInProgressJob addDependenciesItem(String dependenciesItem) { + if (this.dependencies == null || !this.dependencies.isPresent()) { + this.dependencies = JsonNullable.>of(new ArrayList<>()); + } + try { + this.dependencies.get().add(dependenciesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of job IDs that this job depends on. + * + * @return dependencies + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getDependencies() { + return dependencies.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEPENDENCIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getDependencies_JsonNullable() { + return dependencies; + } + + @JsonProperty(JSON_PROPERTY_DEPENDENCIES) + public void setDependencies_JsonNullable(JsonNullable> dependencies) { + this.dependencies = dependencies; + } + + public void setDependencies(List dependencies) { + this.dependencies = JsonNullable.>of(dependencies); + } + + public CIAppPipelineEventInProgressJob error(CIAppCIError error) { + this.error = JsonNullable.of(error); + return this; + } + + /** + * Contains information of the CI error. + * + * @return error + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppCIError getError() { + return error.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getError_JsonNullable() { + return error; + } + + @JsonProperty(JSON_PROPERTY_ERROR) + public void setError_JsonNullable(JsonNullable error) { + this.error = error; + } + + public void setError(CIAppCIError error) { + this.error = JsonNullable.of(error); + } + + public CIAppPipelineEventInProgressJob git(CIAppGitInfo git) { + this.git = JsonNullable.of(git); + return this; + } + + /** + * 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. + * + * @return git + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppGitInfo getGit() { + return git.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getGit_JsonNullable() { + return git; + } + + @JsonProperty(JSON_PROPERTY_GIT) + public void setGit_JsonNullable(JsonNullable git) { + this.git = git; + } + + public void setGit(CIAppGitInfo git) { + this.git = JsonNullable.of(git); + } + + public CIAppPipelineEventInProgressJob id(String id) { + this.id = id; + return this; + } + + /** + * The UUID for the job. It must match the ID of the corresponding finished job. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CIAppPipelineEventInProgressJob level(CIAppPipelineEventJobLevel level) { + this.level = level; + this.unparsed |= !level.isValid(); + return this; + } + + /** + * Used to distinguish between pipelines, stages, jobs, and steps. + * + * @return level + */ + @JsonProperty(JSON_PROPERTY_LEVEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppPipelineEventJobLevel getLevel() { + return level; + } + + public void setLevel(CIAppPipelineEventJobLevel level) { + if (!level.isValid()) { + this.unparsed = true; + } + this.level = level; + } + + public CIAppPipelineEventInProgressJob metrics(List metrics) { + this.metrics = JsonNullable.>of(metrics); + return this; + } + + public CIAppPipelineEventInProgressJob addMetricsItem(String metricsItem) { + if (this.metrics == null || !this.metrics.isPresent()) { + this.metrics = JsonNullable.>of(new ArrayList<>()); + } + try { + this.metrics.get().add(metricsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of user-defined metrics. The metrics must follow the key:value pattern and + * the value must be numeric. + * + * @return metrics + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getMetrics() { + return metrics.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getMetrics_JsonNullable() { + return metrics; + } + + @JsonProperty(JSON_PROPERTY_METRICS) + public void setMetrics_JsonNullable(JsonNullable> metrics) { + this.metrics = metrics; + } + + public void setMetrics(List metrics) { + this.metrics = JsonNullable.>of(metrics); + } + + public CIAppPipelineEventInProgressJob name(String name) { + this.name = name; + return this; + } + + /** + * The name for the job. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CIAppPipelineEventInProgressJob node(CIAppHostInfo node) { + this.node = JsonNullable.of(node); + return this; + } + + /** + * Contains information of the host running the pipeline, stage, job, or step. + * + * @return node + */ + @jakarta.annotation.Nullable + @JsonIgnore + public CIAppHostInfo getNode() { + return node.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getNode_JsonNullable() { + return node; + } + + @JsonProperty(JSON_PROPERTY_NODE) + public void setNode_JsonNullable(JsonNullable node) { + this.node = node; + } + + public void setNode(CIAppHostInfo node) { + this.node = JsonNullable.of(node); + } + + public CIAppPipelineEventInProgressJob parameters(Map parameters) { + this.parameters = JsonNullable.>of(parameters); + return this; + } + + public CIAppPipelineEventInProgressJob putParametersItem(String key, String parametersItem) { + if (this.parameters == null || !this.parameters.isPresent()) { + this.parameters = JsonNullable.>of(new HashMap<>()); + } + try { + this.parameters.get().put(key, parametersItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A map of key-value parameters or environment variables that were defined for the pipeline. + * + * @return parameters + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getParameters() { + return parameters.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PARAMETERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getParameters_JsonNullable() { + return parameters; + } + + @JsonProperty(JSON_PROPERTY_PARAMETERS) + public void setParameters_JsonNullable(JsonNullable> parameters) { + this.parameters = parameters; + } + + public void setParameters(Map parameters) { + this.parameters = JsonNullable.>of(parameters); + } + + public CIAppPipelineEventInProgressJob pipelineName(String pipelineName) { + this.pipelineName = pipelineName; + return this; + } + + /** + * The parent pipeline name. + * + * @return pipelineName + */ + @JsonProperty(JSON_PROPERTY_PIPELINE_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPipelineName() { + return pipelineName; + } + + public void setPipelineName(String pipelineName) { + this.pipelineName = pipelineName; + } + + public CIAppPipelineEventInProgressJob pipelineUniqueId(String pipelineUniqueId) { + this.pipelineUniqueId = pipelineUniqueId; + return this; + } + + /** + * The parent pipeline UUID. + * + * @return pipelineUniqueId + */ + @JsonProperty(JSON_PROPERTY_PIPELINE_UNIQUE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPipelineUniqueId() { + return pipelineUniqueId; + } + + public void setPipelineUniqueId(String pipelineUniqueId) { + this.pipelineUniqueId = pipelineUniqueId; + } + + public CIAppPipelineEventInProgressJob queueTime(Long queueTime) { + this.queueTime = JsonNullable.of(queueTime); + return this; + } + + /** + * The queue time in milliseconds, if applicable. minimum: 0 + * + * @return queueTime + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getQueueTime() { + return queueTime.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_QUEUE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getQueueTime_JsonNullable() { + return queueTime; + } + + @JsonProperty(JSON_PROPERTY_QUEUE_TIME) + public void setQueueTime_JsonNullable(JsonNullable queueTime) { + this.queueTime = queueTime; + } + + public void setQueueTime(Long queueTime) { + this.queueTime = JsonNullable.of(queueTime); + } + + public CIAppPipelineEventInProgressJob stageId(String stageId) { + this.stageId = JsonNullable.of(stageId); + return this; + } + + /** + * The parent stage UUID (if applicable). + * + * @return stageId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getStageId() { + return stageId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STAGE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getStageId_JsonNullable() { + return stageId; + } + + @JsonProperty(JSON_PROPERTY_STAGE_ID) + public void setStageId_JsonNullable(JsonNullable stageId) { + this.stageId = stageId; + } + + public void setStageId(String stageId) { + this.stageId = JsonNullable.of(stageId); + } + + public CIAppPipelineEventInProgressJob stageName(String stageName) { + this.stageName = JsonNullable.of(stageName); + return this; + } + + /** + * The parent stage name (if applicable). + * + * @return stageName + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getStageName() { + return stageName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STAGE_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getStageName_JsonNullable() { + return stageName; + } + + @JsonProperty(JSON_PROPERTY_STAGE_NAME) + public void setStageName_JsonNullable(JsonNullable stageName) { + this.stageName = stageName; + } + + public void setStageName(String stageName) { + this.stageName = JsonNullable.of(stageName); + } + + public CIAppPipelineEventInProgressJob start(OffsetDateTime start) { + this.start = start; + return this; + } + + /** + * Time when the job run instance started (it should not include any queue time). The time format + * must be RFC3339. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStart() { + return start; + } + + public void setStart(OffsetDateTime start) { + this.start = start; + } + + public CIAppPipelineEventInProgressJob status(CIAppPipelineEventJobInProgressStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The in-progress status of the job. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CIAppPipelineEventJobInProgressStatus getStatus() { + return status; + } + + public void setStatus(CIAppPipelineEventJobInProgressStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public CIAppPipelineEventInProgressJob tags(List tags) { + this.tags = JsonNullable.>of(tags); + return this; + } + + public CIAppPipelineEventInProgressJob addTagsItem(String tagsItem) { + if (this.tags == null || !this.tags.isPresent()) { + this.tags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tags.get().add(tagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of user-defined tags. The tags must follow the key:value pattern. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + public void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + public void setTags(List tags) { + this.tags = JsonNullable.>of(tags); + } + + public CIAppPipelineEventInProgressJob url(String url) { + this.url = url; + return this; + } + + /** + * The URL to look at the job in the CI provider UI. + * + * @return url + */ + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CIAppPipelineEventInProgressJob + */ + @JsonAnySetter + public CIAppPipelineEventInProgressJob putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CIAppPipelineEventInProgressJob object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CIAppPipelineEventInProgressJob ciAppPipelineEventInProgressJob = + (CIAppPipelineEventInProgressJob) o; + return Objects.equals(this.dependencies, ciAppPipelineEventInProgressJob.dependencies) + && Objects.equals(this.error, ciAppPipelineEventInProgressJob.error) + && Objects.equals(this.git, ciAppPipelineEventInProgressJob.git) + && Objects.equals(this.id, ciAppPipelineEventInProgressJob.id) + && Objects.equals(this.level, ciAppPipelineEventInProgressJob.level) + && Objects.equals(this.metrics, ciAppPipelineEventInProgressJob.metrics) + && Objects.equals(this.name, ciAppPipelineEventInProgressJob.name) + && Objects.equals(this.node, ciAppPipelineEventInProgressJob.node) + && Objects.equals(this.parameters, ciAppPipelineEventInProgressJob.parameters) + && Objects.equals(this.pipelineName, ciAppPipelineEventInProgressJob.pipelineName) + && Objects.equals(this.pipelineUniqueId, ciAppPipelineEventInProgressJob.pipelineUniqueId) + && Objects.equals(this.queueTime, ciAppPipelineEventInProgressJob.queueTime) + && Objects.equals(this.stageId, ciAppPipelineEventInProgressJob.stageId) + && Objects.equals(this.stageName, ciAppPipelineEventInProgressJob.stageName) + && Objects.equals(this.start, ciAppPipelineEventInProgressJob.start) + && Objects.equals(this.status, ciAppPipelineEventInProgressJob.status) + && Objects.equals(this.tags, ciAppPipelineEventInProgressJob.tags) + && Objects.equals(this.url, ciAppPipelineEventInProgressJob.url) + && Objects.equals( + this.additionalProperties, ciAppPipelineEventInProgressJob.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dependencies, + error, + git, + id, + level, + metrics, + name, + node, + parameters, + pipelineName, + pipelineUniqueId, + queueTime, + stageId, + stageName, + start, + status, + tags, + url, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CIAppPipelineEventInProgressJob {\n"); + sb.append(" dependencies: ").append(toIndentedString(dependencies)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" git: ").append(toIndentedString(git)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" node: ").append(toIndentedString(node)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" pipelineName: ").append(toIndentedString(pipelineName)).append("\n"); + sb.append(" pipelineUniqueId: ").append(toIndentedString(pipelineUniqueId)).append("\n"); + sb.append(" queueTime: ").append(toIndentedString(queueTime)).append("\n"); + sb.append(" stageId: ").append(toIndentedString(stageId)).append("\n"); + sb.append(" stageName: ").append(toIndentedString(stageName)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJob.java b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJob.java index 8bba47d30b0..948625f3806 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJob.java +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJob.java @@ -6,823 +6,282 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.time.OffsetDateTime; -import java.util.ArrayList; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; import java.util.HashMap; -import java.util.List; +import java.util.HashSet; import java.util.Map; -import java.util.Objects; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.logging.Level; +import java.util.logging.Logger; -/** Details of a CI job. */ -@JsonPropertyOrder({ - CIAppPipelineEventJob.JSON_PROPERTY_DEPENDENCIES, - CIAppPipelineEventJob.JSON_PROPERTY_END, - CIAppPipelineEventJob.JSON_PROPERTY_ERROR, - CIAppPipelineEventJob.JSON_PROPERTY_GIT, - CIAppPipelineEventJob.JSON_PROPERTY_ID, - CIAppPipelineEventJob.JSON_PROPERTY_LEVEL, - CIAppPipelineEventJob.JSON_PROPERTY_METRICS, - CIAppPipelineEventJob.JSON_PROPERTY_NAME, - CIAppPipelineEventJob.JSON_PROPERTY_NODE, - CIAppPipelineEventJob.JSON_PROPERTY_PARAMETERS, - CIAppPipelineEventJob.JSON_PROPERTY_PIPELINE_NAME, - CIAppPipelineEventJob.JSON_PROPERTY_PIPELINE_UNIQUE_ID, - CIAppPipelineEventJob.JSON_PROPERTY_QUEUE_TIME, - CIAppPipelineEventJob.JSON_PROPERTY_STAGE_ID, - CIAppPipelineEventJob.JSON_PROPERTY_STAGE_NAME, - CIAppPipelineEventJob.JSON_PROPERTY_START, - CIAppPipelineEventJob.JSON_PROPERTY_STATUS, - CIAppPipelineEventJob.JSON_PROPERTY_TAGS, - CIAppPipelineEventJob.JSON_PROPERTY_URL -}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class CIAppPipelineEventJob { - @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_DEPENDENCIES = "dependencies"; - private JsonNullable> dependencies = JsonNullable.>undefined(); - - public static final String JSON_PROPERTY_END = "end"; - private OffsetDateTime end; - - public static final String JSON_PROPERTY_ERROR = "error"; - private JsonNullable error = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_GIT = "git"; - private JsonNullable git = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - - public static final String JSON_PROPERTY_LEVEL = "level"; - private CIAppPipelineEventJobLevel level = CIAppPipelineEventJobLevel.JOB; - - public static final String JSON_PROPERTY_METRICS = "metrics"; - private JsonNullable> metrics = JsonNullable.>undefined(); - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - public static final String JSON_PROPERTY_NODE = "node"; - private JsonNullable node = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_PARAMETERS = "parameters"; - private JsonNullable> parameters = - JsonNullable.>undefined(); - - public static final String JSON_PROPERTY_PIPELINE_NAME = "pipeline_name"; - private String pipelineName; - - public static final String JSON_PROPERTY_PIPELINE_UNIQUE_ID = "pipeline_unique_id"; - private String pipelineUniqueId; - - public static final String JSON_PROPERTY_QUEUE_TIME = "queue_time"; - private JsonNullable queueTime = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_STAGE_ID = "stage_id"; - private JsonNullable stageId = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_STAGE_NAME = "stage_name"; - private JsonNullable stageName = JsonNullable.undefined(); - - public static final String JSON_PROPERTY_START = "start"; - private OffsetDateTime start; +@JsonDeserialize(using = CIAppPipelineEventJob.CIAppPipelineEventJobDeserializer.class) +@JsonSerialize(using = CIAppPipelineEventJob.CIAppPipelineEventJobSerializer.class) +public class CIAppPipelineEventJob extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CIAppPipelineEventJob.class.getName()); - public static final String JSON_PROPERTY_STATUS = "status"; - private CIAppPipelineEventJobStatus status; - - public static final String JSON_PROPERTY_TAGS = "tags"; - private JsonNullable> tags = JsonNullable.>undefined(); - - public static final String JSON_PROPERTY_URL = "url"; - private String url; - - public CIAppPipelineEventJob() {} - - @JsonCreator - public CIAppPipelineEventJob( - @JsonProperty(required = true, value = JSON_PROPERTY_END) OffsetDateTime end, - @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_LEVEL) CIAppPipelineEventJobLevel level, - @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, - @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_NAME) String pipelineName, - @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_UNIQUE_ID) - String pipelineUniqueId, - @JsonProperty(required = true, value = JSON_PROPERTY_START) OffsetDateTime start, - @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) - CIAppPipelineEventJobStatus status, - @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { - this.end = end; - this.id = id; - this.level = level; - this.unparsed |= !level.isValid(); - this.name = name; - this.pipelineName = pipelineName; - this.pipelineUniqueId = pipelineUniqueId; - this.start = start; - this.status = status; - this.unparsed |= !status.isValid(); - this.url = url; - } - - public CIAppPipelineEventJob dependencies(List dependencies) { - this.dependencies = JsonNullable.>of(dependencies); - return this; - } + @JsonIgnore public boolean unparsed = false; - public CIAppPipelineEventJob addDependenciesItem(String dependenciesItem) { - if (this.dependencies == null || !this.dependencies.isPresent()) { - this.dependencies = JsonNullable.>of(new ArrayList<>()); + public static class CIAppPipelineEventJobSerializer extends StdSerializer { + public CIAppPipelineEventJobSerializer(Class t) { + super(t); } - try { - this.dependencies.get().add(dependenciesItem); - } catch (java.util.NoSuchElementException e) { - // this can never happen, as we make sure above that the value is present - } - return this; - } - - /** - * A list of job IDs that this job depends on. - * - * @return dependencies - */ - @jakarta.annotation.Nullable - @JsonIgnore - public List getDependencies() { - return dependencies.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_DEPENDENCIES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable> getDependencies_JsonNullable() { - return dependencies; - } - - @JsonProperty(JSON_PROPERTY_DEPENDENCIES) - public void setDependencies_JsonNullable(JsonNullable> dependencies) { - this.dependencies = dependencies; - } - - public void setDependencies(List dependencies) { - this.dependencies = JsonNullable.>of(dependencies); - } - - public CIAppPipelineEventJob end(OffsetDateTime end) { - this.end = end; - return this; - } - - /** - * Time when the job run finished. The time format must be RFC3339. - * - * @return end - */ - @JsonProperty(JSON_PROPERTY_END) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OffsetDateTime getEnd() { - return end; - } - - public void setEnd(OffsetDateTime end) { - this.end = end; - } - - public CIAppPipelineEventJob error(CIAppCIError error) { - this.error = JsonNullable.of(error); - return this; - } - - /** - * Contains information of the CI error. - * - * @return error - */ - @jakarta.annotation.Nullable - @JsonIgnore - public CIAppCIError getError() { - return error.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_ERROR) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getError_JsonNullable() { - return error; - } - - @JsonProperty(JSON_PROPERTY_ERROR) - public void setError_JsonNullable(JsonNullable error) { - this.error = error; - } - - public void setError(CIAppCIError error) { - this.error = JsonNullable.of(error); - } - - public CIAppPipelineEventJob git(CIAppGitInfo git) { - this.git = JsonNullable.of(git); - return this; - } - - /** - * 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. - * - * @return git - */ - @jakarta.annotation.Nullable - @JsonIgnore - public CIAppGitInfo getGit() { - return git.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_GIT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getGit_JsonNullable() { - return git; - } - - @JsonProperty(JSON_PROPERTY_GIT) - public void setGit_JsonNullable(JsonNullable git) { - this.git = git; - } - public void setGit(CIAppGitInfo git) { - this.git = JsonNullable.of(git); - } - - public CIAppPipelineEventJob id(String id) { - this.id = id; - return this; - } - - /** - * The UUID for the job. It has to be unique within each pipeline execution. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public CIAppPipelineEventJob level(CIAppPipelineEventJobLevel level) { - this.level = level; - this.unparsed |= !level.isValid(); - return this; - } - - /** - * Used to distinguish between pipelines, stages, jobs, and steps. - * - * @return level - */ - @JsonProperty(JSON_PROPERTY_LEVEL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public CIAppPipelineEventJobLevel getLevel() { - return level; - } - - public void setLevel(CIAppPipelineEventJobLevel level) { - if (!level.isValid()) { - this.unparsed = true; + public CIAppPipelineEventJobSerializer() { + this(null); } - this.level = level; - } - public CIAppPipelineEventJob metrics(List metrics) { - this.metrics = JsonNullable.>of(metrics); - return this; - } - - public CIAppPipelineEventJob addMetricsItem(String metricsItem) { - if (this.metrics == null || !this.metrics.isPresent()) { - this.metrics = JsonNullable.>of(new ArrayList<>()); - } - try { - this.metrics.get().add(metricsItem); - } catch (java.util.NoSuchElementException e) { - // this can never happen, as we make sure above that the value is present + @Override + public void serialize( + CIAppPipelineEventJob value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); } - return this; - } - - /** - * A list of user-defined metrics. The metrics must follow the key:value pattern and - * the value must be numeric. - * - * @return metrics - */ - @jakarta.annotation.Nullable - @JsonIgnore - public List getMetrics() { - return metrics.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_METRICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable> getMetrics_JsonNullable() { - return metrics; - } - - @JsonProperty(JSON_PROPERTY_METRICS) - public void setMetrics_JsonNullable(JsonNullable> metrics) { - this.metrics = metrics; } - public void setMetrics(List metrics) { - this.metrics = JsonNullable.>of(metrics); - } - - public CIAppPipelineEventJob name(String name) { - this.name = name; - return this; - } - - /** - * The name for the job. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CIAppPipelineEventJob node(CIAppHostInfo node) { - this.node = JsonNullable.of(node); - return this; - } - - /** - * Contains information of the host running the pipeline, stage, job, or step. - * - * @return node - */ - @jakarta.annotation.Nullable - @JsonIgnore - public CIAppHostInfo getNode() { - return node.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_NODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getNode_JsonNullable() { - return node; - } - - @JsonProperty(JSON_PROPERTY_NODE) - public void setNode_JsonNullable(JsonNullable node) { - this.node = node; - } - - public void setNode(CIAppHostInfo node) { - this.node = JsonNullable.of(node); - } - - public CIAppPipelineEventJob parameters(Map parameters) { - this.parameters = JsonNullable.>of(parameters); - return this; - } - - public CIAppPipelineEventJob putParametersItem(String key, String parametersItem) { - if (this.parameters == null || !this.parameters.isPresent()) { - this.parameters = JsonNullable.>of(new HashMap<>()); - } - try { - this.parameters.get().put(key, parametersItem); - } catch (java.util.NoSuchElementException e) { - // this can never happen, as we make sure above that the value is present + public static class CIAppPipelineEventJobDeserializer + extends StdDeserializer { + public CIAppPipelineEventJobDeserializer() { + this(CIAppPipelineEventJob.class); } - return this; - } - - /** - * A map of key-value parameters or environment variables that were defined for the pipeline. - * - * @return parameters - */ - @jakarta.annotation.Nullable - @JsonIgnore - public Map getParameters() { - return parameters.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable> getParameters_JsonNullable() { - return parameters; - } - - @JsonProperty(JSON_PROPERTY_PARAMETERS) - public void setParameters_JsonNullable(JsonNullable> parameters) { - this.parameters = parameters; - } - - public void setParameters(Map parameters) { - this.parameters = JsonNullable.>of(parameters); - } - - public CIAppPipelineEventJob pipelineName(String pipelineName) { - this.pipelineName = pipelineName; - return this; - } - - /** - * The parent pipeline name. - * - * @return pipelineName - */ - @JsonProperty(JSON_PROPERTY_PIPELINE_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getPipelineName() { - return pipelineName; - } - - public void setPipelineName(String pipelineName) { - this.pipelineName = pipelineName; - } - - public CIAppPipelineEventJob pipelineUniqueId(String pipelineUniqueId) { - this.pipelineUniqueId = pipelineUniqueId; - return this; - } - - /** - * The parent pipeline UUID. - * - * @return pipelineUniqueId - */ - @JsonProperty(JSON_PROPERTY_PIPELINE_UNIQUE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getPipelineUniqueId() { - return pipelineUniqueId; - } - - public void setPipelineUniqueId(String pipelineUniqueId) { - this.pipelineUniqueId = pipelineUniqueId; - } - - public CIAppPipelineEventJob queueTime(Long queueTime) { - this.queueTime = JsonNullable.of(queueTime); - return this; - } - - /** - * The queue time in milliseconds, if applicable. minimum: 0 - * - * @return queueTime - */ - @jakarta.annotation.Nullable - @JsonIgnore - public Long getQueueTime() { - return queueTime.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_QUEUE_TIME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getQueueTime_JsonNullable() { - return queueTime; - } - - @JsonProperty(JSON_PROPERTY_QUEUE_TIME) - public void setQueueTime_JsonNullable(JsonNullable queueTime) { - this.queueTime = queueTime; - } - - public void setQueueTime(Long queueTime) { - this.queueTime = JsonNullable.of(queueTime); - } - public CIAppPipelineEventJob stageId(String stageId) { - this.stageId = JsonNullable.of(stageId); - return this; - } - - /** - * The parent stage UUID (if applicable). - * - * @return stageId - */ - @jakarta.annotation.Nullable - @JsonIgnore - public String getStageId() { - return stageId.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_STAGE_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getStageId_JsonNullable() { - return stageId; - } - - @JsonProperty(JSON_PROPERTY_STAGE_ID) - public void setStageId_JsonNullable(JsonNullable stageId) { - this.stageId = stageId; - } - - public void setStageId(String stageId) { - this.stageId = JsonNullable.of(stageId); - } - - public CIAppPipelineEventJob stageName(String stageName) { - this.stageName = JsonNullable.of(stageName); - return this; - } + public CIAppPipelineEventJobDeserializer(Class vc) { + super(vc); + } - /** - * The parent stage name (if applicable). - * - * @return stageName - */ - @jakarta.annotation.Nullable - @JsonIgnore - public String getStageName() { - return stageName.orElse(null); - } + @Override + public CIAppPipelineEventJob deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CIAppPipelineEventFinishedJob + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CIAppPipelineEventFinishedJob.class.equals(Integer.class) + || CIAppPipelineEventFinishedJob.class.equals(Long.class) + || CIAppPipelineEventFinishedJob.class.equals(Float.class) + || CIAppPipelineEventFinishedJob.class.equals(Double.class) + || CIAppPipelineEventFinishedJob.class.equals(Boolean.class) + || CIAppPipelineEventFinishedJob.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CIAppPipelineEventFinishedJob.class.equals(Integer.class) + || CIAppPipelineEventFinishedJob.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CIAppPipelineEventFinishedJob.class.equals(Float.class) + || CIAppPipelineEventFinishedJob.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CIAppPipelineEventFinishedJob.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CIAppPipelineEventFinishedJob.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CIAppPipelineEventFinishedJob.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CIAppPipelineEventFinishedJob) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CIAppPipelineEventFinishedJob'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CIAppPipelineEventFinishedJob'", e); + } + + // deserialize CIAppPipelineEventInProgressJob + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CIAppPipelineEventInProgressJob.class.equals(Integer.class) + || CIAppPipelineEventInProgressJob.class.equals(Long.class) + || CIAppPipelineEventInProgressJob.class.equals(Float.class) + || CIAppPipelineEventInProgressJob.class.equals(Double.class) + || CIAppPipelineEventInProgressJob.class.equals(Boolean.class) + || CIAppPipelineEventInProgressJob.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CIAppPipelineEventInProgressJob.class.equals(Integer.class) + || CIAppPipelineEventInProgressJob.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CIAppPipelineEventInProgressJob.class.equals(Float.class) + || CIAppPipelineEventInProgressJob.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (CIAppPipelineEventInProgressJob.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CIAppPipelineEventInProgressJob.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(CIAppPipelineEventInProgressJob.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((CIAppPipelineEventInProgressJob) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'CIAppPipelineEventInProgressJob'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'CIAppPipelineEventInProgressJob'", e); + } + + CIAppPipelineEventJob ret = new CIAppPipelineEventJob(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } - @JsonProperty(JSON_PROPERTY_STAGE_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getStageName_JsonNullable() { - return stageName; + /** Handle deserialization of the 'null' value. */ + @Override + public CIAppPipelineEventJob getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CIAppPipelineEventJob cannot be null"); + } } - @JsonProperty(JSON_PROPERTY_STAGE_NAME) - public void setStageName_JsonNullable(JsonNullable stageName) { - this.stageName = stageName; - } + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); - public void setStageName(String stageName) { - this.stageName = JsonNullable.of(stageName); + public CIAppPipelineEventJob() { + super("oneOf", Boolean.FALSE); } - public CIAppPipelineEventJob start(OffsetDateTime start) { - this.start = start; - return this; + public CIAppPipelineEventJob(CIAppPipelineEventFinishedJob o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - /** - * Time when the job run instance started (it should not include any queue time). The time format - * must be RFC3339. - * - * @return start - */ - @JsonProperty(JSON_PROPERTY_START) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OffsetDateTime getStart() { - return start; + public CIAppPipelineEventJob(CIAppPipelineEventInProgressJob o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - public void setStart(OffsetDateTime start) { - this.start = start; + static { + schemas.put( + "CIAppPipelineEventFinishedJob", new GenericType() {}); + schemas.put( + "CIAppPipelineEventInProgressJob", new GenericType() {}); + JSON.registerDescendants(CIAppPipelineEventJob.class, Collections.unmodifiableMap(schemas)); } - public CIAppPipelineEventJob status(CIAppPipelineEventJobStatus status) { - this.status = status; - this.unparsed |= !status.isValid(); - return this; + @Override + public Map getSchemas() { + return CIAppPipelineEventJob.schemas; } /** - * The final status of the job. + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CIAppPipelineEventFinishedJob, CIAppPipelineEventInProgressJob * - * @return status + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public CIAppPipelineEventJobStatus getStatus() { - return status; - } - - public void setStatus(CIAppPipelineEventJobStatus status) { - if (!status.isValid()) { - this.unparsed = true; - } - this.status = status; - } - - public CIAppPipelineEventJob tags(List tags) { - this.tags = JsonNullable.>of(tags); - return this; - } - - public CIAppPipelineEventJob addTagsItem(String tagsItem) { - if (this.tags == null || !this.tags.isPresent()) { - this.tags = JsonNullable.>of(new ArrayList<>()); + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(CIAppPipelineEventFinishedJob.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - try { - this.tags.get().add(tagsItem); - } catch (java.util.NoSuchElementException e) { - // this can never happen, as we make sure above that the value is present + if (JSON.isInstanceOf( + CIAppPipelineEventInProgressJob.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - return this; - } - - /** - * A list of user-defined tags. The tags must follow the key:value pattern. - * - * @return tags - */ - @jakarta.annotation.Nullable - @JsonIgnore - public List getTags() { - return tags.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable> getTags_JsonNullable() { - return tags; - } - - @JsonProperty(JSON_PROPERTY_TAGS) - public void setTags_JsonNullable(JsonNullable> tags) { - this.tags = tags; - } - - public void setTags(List tags) { - this.tags = JsonNullable.>of(tags); - } - public CIAppPipelineEventJob url(String url) { - this.url = url; - return this; - } - - /** - * The URL to look at the job in the CI provider UI. - * - * @return url - */ - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key The arbitrary key to set - * @param value The associated value - * @return CIAppPipelineEventJob - */ - @JsonAnySetter - public CIAppPipelineEventJob putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - this.additionalProperties.put(key, value); - return this; + throw new RuntimeException( + "Invalid instance type. Must be CIAppPipelineEventFinishedJob," + + " CIAppPipelineEventInProgressJob"); } /** - * Return the additional (undeclared) property. + * Get the actual instance, which can be the following: CIAppPipelineEventFinishedJob, + * CIAppPipelineEventInProgressJob * - * @return The additional properties + * @return The actual instance (CIAppPipelineEventFinishedJob, CIAppPipelineEventInProgressJob) */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; + @Override + public Object getActualInstance() { + return super.getActualInstance(); } /** - * Return the additional (undeclared) property with the specified name. + * Get the actual instance of `CIAppPipelineEventFinishedJob`. If the actual instance is not + * `CIAppPipelineEventFinishedJob`, the ClassCastException will be thrown. * - * @param key The arbitrary key to get - * @return The specific additional property for the given key + * @return The actual instance of `CIAppPipelineEventFinishedJob` + * @throws ClassCastException if the instance is not `CIAppPipelineEventFinishedJob` */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this CIAppPipelineEventJob object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CIAppPipelineEventJob ciAppPipelineEventJob = (CIAppPipelineEventJob) o; - return Objects.equals(this.dependencies, ciAppPipelineEventJob.dependencies) - && Objects.equals(this.end, ciAppPipelineEventJob.end) - && Objects.equals(this.error, ciAppPipelineEventJob.error) - && Objects.equals(this.git, ciAppPipelineEventJob.git) - && Objects.equals(this.id, ciAppPipelineEventJob.id) - && Objects.equals(this.level, ciAppPipelineEventJob.level) - && Objects.equals(this.metrics, ciAppPipelineEventJob.metrics) - && Objects.equals(this.name, ciAppPipelineEventJob.name) - && Objects.equals(this.node, ciAppPipelineEventJob.node) - && Objects.equals(this.parameters, ciAppPipelineEventJob.parameters) - && Objects.equals(this.pipelineName, ciAppPipelineEventJob.pipelineName) - && Objects.equals(this.pipelineUniqueId, ciAppPipelineEventJob.pipelineUniqueId) - && Objects.equals(this.queueTime, ciAppPipelineEventJob.queueTime) - && Objects.equals(this.stageId, ciAppPipelineEventJob.stageId) - && Objects.equals(this.stageName, ciAppPipelineEventJob.stageName) - && Objects.equals(this.start, ciAppPipelineEventJob.start) - && Objects.equals(this.status, ciAppPipelineEventJob.status) - && Objects.equals(this.tags, ciAppPipelineEventJob.tags) - && Objects.equals(this.url, ciAppPipelineEventJob.url) - && Objects.equals(this.additionalProperties, ciAppPipelineEventJob.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - dependencies, - end, - error, - git, - id, - level, - metrics, - name, - node, - parameters, - pipelineName, - pipelineUniqueId, - queueTime, - stageId, - stageName, - start, - status, - tags, - url, - additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CIAppPipelineEventJob {\n"); - sb.append(" dependencies: ").append(toIndentedString(dependencies)).append("\n"); - sb.append(" end: ").append(toIndentedString(end)).append("\n"); - sb.append(" error: ").append(toIndentedString(error)).append("\n"); - sb.append(" git: ").append(toIndentedString(git)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" level: ").append(toIndentedString(level)).append("\n"); - sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" node: ").append(toIndentedString(node)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" pipelineName: ").append(toIndentedString(pipelineName)).append("\n"); - sb.append(" pipelineUniqueId: ").append(toIndentedString(pipelineUniqueId)).append("\n"); - sb.append(" queueTime: ").append(toIndentedString(queueTime)).append("\n"); - sb.append(" stageId: ").append(toIndentedString(stageId)).append("\n"); - sb.append(" stageName: ").append(toIndentedString(stageName)).append("\n"); - sb.append(" start: ").append(toIndentedString(start)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); + public CIAppPipelineEventFinishedJob getCIAppPipelineEventFinishedJob() + throws ClassCastException { + return (CIAppPipelineEventFinishedJob) super.getActualInstance(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Get the actual instance of `CIAppPipelineEventInProgressJob`. If the actual instance is not + * `CIAppPipelineEventInProgressJob`, the ClassCastException will be thrown. + * + * @return The actual instance of `CIAppPipelineEventInProgressJob` + * @throws ClassCastException if the instance is not `CIAppPipelineEventInProgressJob` */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + public CIAppPipelineEventInProgressJob getCIAppPipelineEventInProgressJob() + throws ClassCastException { + return (CIAppPipelineEventInProgressJob) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJobInProgressStatus.java b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJobInProgressStatus.java new file mode 100644 index 00000000000..7a7d0cd5773 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppPipelineEventJobInProgressStatus.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The in-progress status of the job. */ +@JsonSerialize( + using = + CIAppPipelineEventJobInProgressStatus.CIAppPipelineEventJobInProgressStatusSerializer.class) +public class CIAppPipelineEventJobInProgressStatus extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("running")); + + public static final CIAppPipelineEventJobInProgressStatus RUNNING = + new CIAppPipelineEventJobInProgressStatus("running"); + + CIAppPipelineEventJobInProgressStatus(String value) { + super(value, allowedValues); + } + + public static class CIAppPipelineEventJobInProgressStatusSerializer + extends StdSerializer { + public CIAppPipelineEventJobInProgressStatusSerializer( + Class t) { + super(t); + } + + public CIAppPipelineEventJobInProgressStatusSerializer() { + this(null); + } + + @Override + public void serialize( + CIAppPipelineEventJobInProgressStatus value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CIAppPipelineEventJobInProgressStatus fromValue(String value) { + return new CIAppPipelineEventJobInProgressStatus(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.freeze b/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.freeze new file mode 100644 index 00000000000..450ad249ce0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.freeze @@ -0,0 +1 @@ +2026-06-23T12:16:50.217Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.json b/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.json new file mode 100644 index 00000000000..9c350088f9e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Send_running_job_event_returns_Request_accepted_for_processing_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/ci/pipeline", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":null}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 202, + "reasonPhrase": "Accepted" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "76fcf06d-cd10-c086-ca48-dc2cc137e937" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_pipelines.feature b/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_pipelines.feature index 3c52a30f4b7..c81cb9ec82e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_pipelines.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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