From b9ed6c7186b5cd15eaff6fd98e2b1be9bc27d2d7 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 6 Oct 2026 09:58:52 +0000 Subject: [PATCH] Regenerate client from commit 46c1a63 of spec repo --- .generator/schemas/v2/openapi.yaml | 281 +++++++++++++ .../v2/ci-visibility-logs/SubmitCILog.java | 37 ++ .../SubmitCILog_1818302850.java | 37 ++ .../SubmitCILog_4195490686.java | 40 ++ .../com/datadog/api/client/ApiClient.java | 69 ++++ .../client/v2/api/CiVisibilityLogsApi.java | 259 ++++++++++++ .../client/v2/model/CILogAttributeValue.java | 332 +++++++++++++++ .../client/v2/model/CILogContentEncoding.java | 56 +++ .../api/client/v2/model/CILogErrors.java | 145 +++++++ .../api/client/v2/model/CILogIntakeError.java | 191 +++++++++ .../client/v2/model/CILogIntakeErrors.java | 156 +++++++ .../api/client/v2/model/CILogItem.java | 384 ++++++++++++++++++ .../client/v2/api/ci_visibility_logs.feature | 44 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + .../test-runner-data/manifest.json | 14 + ...uest-accepted-for-processing-response.json | 46 +++ ...uest-accepted-for-processing-response.json | 42 ++ .../test-server-data/manifest.json | 5 + .../v2/ci-visibility-logs.json | 95 +++++ 19 files changed, 2239 insertions(+) create mode 100644 examples/v2/ci-visibility-logs/SubmitCILog.java create mode 100644 examples/v2/ci-visibility-logs/SubmitCILog_1818302850.java create mode 100644 examples/v2/ci-visibility-logs/SubmitCILog_4195490686.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/CiVisibilityLogsApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogAttributeValue.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogContentEncoding.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogErrors.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogIntakeError.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogIntakeErrors.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CILogItem.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/ci_visibility_logs.feature create mode 100644 src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-batched-ci-job-logs-returns-request-accepted-for-processing-response.json create mode 100644 src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-one-ci-job-log-returns-request-accepted-for-processing-response.json create mode 100644 src/test/resources/generated-test/test-server-data/v2/ci-visibility-logs.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1606032e9da..c43341f91d8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -15799,6 +15799,132 @@ components: example: "One or several indexes are missing or invalid, results hold data from the other indexes" type: string type: object + CILogAttributeValue: + description: A flat additional log attribute. Objects and arrays are not accepted. + oneOf: + - nullable: true + type: string + - format: double + type: number + - type: boolean + CILogContentEncoding: + description: HTTP header used to compress the JSON request body. + enum: + - identity + - gzip + type: string + x-enum-varnames: + - IDENTITY + - GZIP + CILogErrors: + description: Authentication and authorization errors returned by the CI logs intake API. + properties: + errors: + description: Error messages. + example: + - Forbidden + - API key is missing or invalid + items: + type: string + type: array + type: object + CILogIntakeError: + description: A request error returned by the CI logs intake API. + properties: + detail: + description: Error details. + example: Malformed payload + type: string + status: + description: HTTP status code. + example: "400" + type: string + title: + description: Error title. + example: Bad Request + type: string + type: object + CILogIntakeErrors: + description: Request errors returned by the CI logs intake API. + properties: + errors: + description: Request errors. + items: + $ref: "#/components/schemas/CILogIntakeError" + type: array + type: object + CILogItem: + additionalProperties: + $ref: "#/components/schemas/CILogAttributeValue" + description: A CI job log line. + maxProperties: 137 + properties: + ddtags: + description: Comma-separated `key:value` tags. A job can have up to 256 tags, including repeated keys. + example: runner:linux,architecture:amd64 + type: string + job_id: + description: The job event's `resource.id`, sent through the CI Visibility pipeline API. + example: job-456 + minLength: 1 + type: string + line_number: + description: The line number in the job log. Use 0 or 1 for the first line. + example: 812 + format: int64 + maximum: 9223372036854775807 + minimum: 0 + type: integer + message: + description: The non-empty log line message. + example: Running go test ./... + minLength: 1 + type: string + pipeline_unique_id: + description: |- + The `resource.unique_id` of the pipeline event, which must also match the job event's + `resource.pipeline_unique_id`. + example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + minLength: 1 + type: string + provider_name: + description: |- + The provider name sent with the pipeline event. It defaults to `custom` when omitted and, when provided, + must be non-empty and cannot contain a comma. + example: example-provider + minLength: 1 + pattern: "^[^,]+$" + type: string + section_name: + description: |- + The provider-defined section containing this log line, used to display collapsible groups of lines in the CI + job log view. + example: tests + type: string + status: + description: |- + The status of this log line. Any string is accepted. Datadog maps non-empty values to a standard log status. + See [status mapping](https://docs.datadoghq.com/logs/log_configuration/processors/log_status_remapper/). + example: warn + type: string + timestamp: + description: |- + The log line time in RFC 3339 format with an explicit timezone. If omitted, the intake time is used. It can + be at most 18 hours in the past or 12 hours in the future. + format: date-time + type: string + required: + - message + - pipeline_unique_id + - job_id + type: object + CILogRequest: + description: |- + A batch of up to 1,000 CI job log lines. Use a one-item array to send one log line. + items: + $ref: "#/components/schemas/CILogItem" + maxItems: 1000 + type: array CSMAgentsMetadata: description: Metadata related to the paginated response. properties: @@ -150692,6 +150818,159 @@ paths: permissions: - ci_visibility_read - test_optimization_read + /api/v2/cilogs: + post: + description: |- + Send log lines for a CI job over HTTP. See the [CI Visibility Pipelines + API](https://docs.datadoghq.com/api/latest/ci-visibility-pipelines/send-pipeline-event/) for submitting the + associated pipeline and job events. + + A request can contain one log object or an array of up to 1,000 log objects. The maximum uncompressed request + body size is 5.1 MiB. + + You can stream log lines while a CI job runs or send them after it finishes. After you submit the completed job + event, 20 seconds without a new log line marks the job's logs as complete. Lines sent after that may not appear. + + A job can have up to 128 additional attributes and 256 tags. Additional attributes are top-level fields with + string, number, Boolean, or null values. Nested objects and arrays are rejected. Additional attributes and + `ddtags` apply to all log lines in the job. If an additional attribute has different values on different lines, + the first value received is used. Tags supplied on different lines are combined. A job can contain up to + 2,000,000 log records or 1 GiB of message bytes in total. + + To reduce request size, send gzip-compressed JSON with the `Content-Encoding: gzip` header. Retry requests after + a 408, 429, 500, or 503 response. + operationId: SubmitCILog + parameters: + - description: HTTP header used to compress the JSON request body. + in: header + name: Content-Encoding + required: false + schema: + $ref: "#/components/schemas/CILogContentEncoding" + requestBody: + content: + application/json: + examples: + default: + summary: Single CI job log line + value: + - ddtags: runner:linux,architecture:amd64 + job_id: job-456 + line_number: 812 + message: Running go test ./... + pipeline_unique_id: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + provider_name: example-provider + section_name: tests + status: warn + stream: stdout + multiple-logs: + summary: Multiple CI job log lines + value: + - job_id: job-456 + line_number: 1 + message: Running go test ./... + pipeline_unique_id: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + - job_id: job-456 + line_number: 2 + message: Tests passed + pipeline_unique_id: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + schema: + $ref: "#/components/schemas/CILogRequest" + description: CI job log line or batch in JSON format. + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: {} + schema: + type: object + description: Request accepted for processing + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogIntakeErrors" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogErrors" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogErrors" + description: Forbidden + "408": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogIntakeErrors" + description: Request Timeout + "413": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogIntakeErrors" + description: Payload Too Large + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/CILogIntakeErrors" + description: Too Many Requests + security: + - apiKeyAuth: [] + servers: + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The regional site for CI Visibility customers. + enum: + - datadoghq.com + - us3.datadoghq.com + - us5.datadoghq.com + - ap1.datadoghq.com + - ap2.datadoghq.com + - uk1.datadoghq.com + - datadoghq.eu + x-enum-varnames: + - US1 + - US3 + - US5 + - AP1 + - AP2 + - UK1 + - EU1 + subdomain: + default: http-intake.logs + description: The subdomain where the API is deployed. + - url: "{protocol}://{name}" + variables: + name: + default: http-intake.logs.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: http-intake.logs + description: The subdomain where the API is deployed. + summary: Send CI job logs + tags: + - CI Visibility Logs + x-codegen-request-body-name: body /api/v2/cloud_auth/aws/persona_mapping: get: description: List all AWS cloud authentication persona mappings. This endpoint retrieves all configured persona mappings that associate AWS IAM principals with Datadog users. @@ -244478,6 +244757,8 @@ tags: [CI Visibility GitHub Actions setup page](https://docs.datadoghq.com/continuous_integration/pipelines/github/) for more information. name: CI Visibility GitHub Accounts + - description: Send CI job logs over HTTP for CI Visibility. + name: CI Visibility Logs - description: |- Search or aggregate your CI Visibility pipeline events and send them to your Datadog site over HTTP. See the [CI Pipeline Visibility in Datadog page](https://docs.datadoghq.com/continuous_integration/pipelines/) for more information. name: CI Visibility Pipelines diff --git a/examples/v2/ci-visibility-logs/SubmitCILog.java b/examples/v2/ci-visibility-logs/SubmitCILog.java new file mode 100644 index 00000000000..63be140e1e0 --- /dev/null +++ b/examples/v2/ci-visibility-logs/SubmitCILog.java @@ -0,0 +1,37 @@ +// Send CI job logs 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.CiVisibilityLogsApi; +import com.datadog.api.client.v2.model.CILogItem; +import java.util.Collections; +import java.util.List; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityLogsApi apiInstance = new CiVisibilityLogsApi(defaultClient); + + List body = + Collections.singletonList( + new CILogItem() + .ddtags("runner:linux,architecture:amd64") + .jobId("job-456") + .lineNumber(812L) + .message("Running go test ./...") + .pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .providerName("example-provider") + .sectionName("tests") + .status("warn")); + + try { + apiInstance.submitCILog(body); + } catch (ApiException e) { + System.err.println("Exception when calling CiVisibilityLogsApi#submitCILog"); + 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/examples/v2/ci-visibility-logs/SubmitCILog_1818302850.java b/examples/v2/ci-visibility-logs/SubmitCILog_1818302850.java new file mode 100644 index 00000000000..a4afd2aa39e --- /dev/null +++ b/examples/v2/ci-visibility-logs/SubmitCILog_1818302850.java @@ -0,0 +1,37 @@ +// Send one CI job log 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.CiVisibilityLogsApi; +import com.datadog.api.client.v2.model.CILogItem; +import java.util.Collections; +import java.util.List; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityLogsApi apiInstance = new CiVisibilityLogsApi(defaultClient); + + List body = + Collections.singletonList( + new CILogItem() + .message("Running go test ./...") + .pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .jobId("job-456") + .providerName("example-provider") + .lineNumber(1L) + .status("warn") + .sectionName("tests") + .ddtags("runner:linux,architecture:amd64")); + + try { + apiInstance.submitCILog(body); + } catch (ApiException e) { + System.err.println("Exception when calling CiVisibilityLogsApi#submitCILog"); + 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/examples/v2/ci-visibility-logs/SubmitCILog_4195490686.java b/examples/v2/ci-visibility-logs/SubmitCILog_4195490686.java new file mode 100644 index 00000000000..c10da0bf09f --- /dev/null +++ b/examples/v2/ci-visibility-logs/SubmitCILog_4195490686.java @@ -0,0 +1,40 @@ +// Send batched CI job logs 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.CiVisibilityLogsApi; +import com.datadog.api.client.v2.model.CILogItem; +import java.util.Arrays; +import java.util.List; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + CiVisibilityLogsApi apiInstance = new CiVisibilityLogsApi(defaultClient); + + List body = + Arrays.asList( + new CILogItem() + .message("Starting tests") + .pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .jobId("job-456") + .lineNumber(1L) + .status("notice") + .sectionName("tests"), + new CILogItem() + .message("Tests passed") + .pipelineUniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .jobId("job-456") + .lineNumber(2L)); + + try { + apiInstance.submitCILog(body); + } catch (ApiException e) { + System.err.println("Exception when calling CiVisibilityLogsApi#submitCILog"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 9f3127d3e0f..21161ff1cf9 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -288,6 +288,75 @@ public class ApiClient { new HashSet())); } })))); + put( + "v2.CiVisibilityLogsApi.submitCILog", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The regional site for CI Visibility customers.", + "datadoghq.com", + new HashSet( + Arrays.asList( + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "ap1.datadoghq.com", + "ap2.datadoghq.com", + "uk1.datadoghq.com", + "datadoghq.eu")))); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "http-intake.logs", + new HashSet())); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "http-intake.logs.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "http-intake.logs", + new HashSet())); + } + })))); put( "v2.EventsApi.createEvent", new ArrayList( diff --git a/src/main/java/com/datadog/api/client/v2/api/CiVisibilityLogsApi.java b/src/main/java/com/datadog/api/client/v2/api/CiVisibilityLogsApi.java new file mode 100644 index 00000000000..74409eb100b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/CiVisibilityLogsApi.java @@ -0,0 +1,259 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CILogContentEncoding; +import com.datadog.api.client.v2.model.CILogItem; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CiVisibilityLogsApi { + private ApiClient apiClient; + + public CiVisibilityLogsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public CiVisibilityLogsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** Manage optional parameters to submitCILog. */ + public static class SubmitCILogOptionalParameters { + private CILogContentEncoding contentEncoding; + + /** + * Set contentEncoding. + * + * @param contentEncoding HTTP header used to compress the JSON request body. (optional) + * @return SubmitCILogOptionalParameters + */ + public SubmitCILogOptionalParameters contentEncoding(CILogContentEncoding contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + } + + /** + * Send CI job logs. + * + *

See {@link #submitCILogWithHttpInfo}. + * + * @param body CI job log line or batch in JSON format. (required) + * @return Object + * @throws ApiException if fails to make API call + */ + public Object submitCILog(List body) throws ApiException { + return submitCILogWithHttpInfo(body, new SubmitCILogOptionalParameters()).getData(); + } + + /** + * Send CI job logs. + * + *

See {@link #submitCILogWithHttpInfoAsync}. + * + * @param body CI job log line or batch in JSON format. (required) + * @return CompletableFuture<Object> + */ + public CompletableFuture submitCILogAsync(List body) { + return submitCILogWithHttpInfoAsync(body, new SubmitCILogOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Send CI job logs. + * + *

See {@link #submitCILogWithHttpInfo}. + * + * @param body CI job log line or batch in JSON format. (required) + * @param parameters Optional parameters for the request. + * @return Object + * @throws ApiException if fails to make API call + */ + public Object submitCILog(List body, SubmitCILogOptionalParameters parameters) + throws ApiException { + return submitCILogWithHttpInfo(body, parameters).getData(); + } + + /** + * Send CI job logs. + * + *

See {@link #submitCILogWithHttpInfoAsync}. + * + * @param body CI job log line or batch in JSON format. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<Object> + */ + public CompletableFuture submitCILogAsync( + List body, SubmitCILogOptionalParameters parameters) { + return submitCILogWithHttpInfoAsync(body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Send log lines for a CI job over HTTP. See the CI + * Visibility Pipelines API for submitting the associated pipeline and job events. + * + *

A request can contain one log object or an array of up to 1,000 log objects. The maximum + * uncompressed request body size is 5.1 MiB. + * + *

You can stream log lines while a CI job runs or send them after it finishes. After you + * submit the completed job event, 20 seconds without a new log line marks the job's logs as + * complete. Lines sent after that may not appear. + * + *

A job can have up to 128 additional attributes and 256 tags. Additional attributes are + * top-level fields with string, number, Boolean, or null values. Nested objects and arrays are + * rejected. Additional attributes and ddtags apply to all log lines in the job. If + * an additional attribute has different values on different lines, the first value received is + * used. Tags supplied on different lines are combined. A job can contain up to 2,000,000 log + * records or 1 GiB of message bytes in total. + * + *

To reduce request size, send gzip-compressed JSON with the Content-Encoding: gzip + * header. Retry requests after a 408, 429, 500, or 503 response. + * + * @param body CI job log line or batch in JSON format. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<Object> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Request accepted for processing -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
408 Request Timeout -
413 Payload Too Large -
429 Too Many Requests -
+ */ + public ApiResponse submitCILogWithHttpInfo( + List body, SubmitCILogOptionalParameters parameters) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling submitCILog"); + } + CILogContentEncoding contentEncoding = parameters.contentEncoding; + // create path and map variables + String localVarPath = "/api/v2/cilogs"; + + Map localVarHeaderParams = new HashMap(); + + if (contentEncoding != null) { + localVarHeaderParams.put("Content-Encoding", apiClient.parameterToString(contentEncoding)); + } + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.CiVisibilityLogsApi.submitCILog", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Send CI job logs. + * + *

See {@link #submitCILogWithHttpInfo}. + * + * @param body CI job log line or batch in JSON format. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<Object>> + */ + public CompletableFuture> submitCILogWithHttpInfoAsync( + List body, SubmitCILogOptionalParameters parameters) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'body' when calling submitCILog")); + return result; + } + CILogContentEncoding contentEncoding = parameters.contentEncoding; + // create path and map variables + String localVarPath = "/api/v2/cilogs"; + + Map localVarHeaderParams = new HashMap(); + + if (contentEncoding != null) { + localVarHeaderParams.put("Content-Encoding", apiClient.parameterToString(contentEncoding)); + } + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.CiVisibilityLogsApi.submitCILog", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CILogAttributeValue.java b/src/main/java/com/datadog/api/client/v2/model/CILogAttributeValue.java new file mode 100644 index 00000000000..762ed5e249b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogAttributeValue.java @@ -0,0 +1,332 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +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.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = CILogAttributeValue.CILogAttributeValueDeserializer.class) +@JsonSerialize(using = CILogAttributeValue.CILogAttributeValueSerializer.class) +public class CILogAttributeValue extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CILogAttributeValue.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class CILogAttributeValueSerializer extends StdSerializer { + public CILogAttributeValueSerializer(Class t) { + super(t); + } + + public CILogAttributeValueSerializer() { + this(null); + } + + @Override + public void serialize( + CILogAttributeValue value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CILogAttributeValueDeserializer extends StdDeserializer { + public CILogAttributeValueDeserializer() { + this(CILogAttributeValue.class); + } + + public CILogAttributeValueDeserializer(Class vc) { + super(vc); + } + + @Override + public CILogAttributeValue 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 String + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (String.class.equals(Integer.class) + || String.class.equals(Long.class) + || String.class.equals(Float.class) + || String.class.equals(Double.class) + || String.class.equals(Boolean.class) + || String.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((String.class.equals(Integer.class) || String.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((String.class.equals(Float.class) || String.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (String.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (String.class.equals(String.class) && token == JsonToken.VALUE_STRING); + attemptParsing |= (token == JsonToken.VALUE_NULL); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(String.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. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'String'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'String'", e); + } + + // deserialize Double + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Double.class.equals(Integer.class) + || Double.class.equals(Long.class) + || Double.class.equals(Float.class) + || Double.class.equals(Double.class) + || Double.class.equals(Boolean.class) + || Double.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Double.class.equals(Integer.class) || Double.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Double.class.equals(Float.class) || Double.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Double.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Double.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Double.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. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Double'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Double'", e); + } + + // deserialize Boolean + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (Boolean.class.equals(Integer.class) + || Boolean.class.equals(Long.class) + || Boolean.class.equals(Float.class) + || Boolean.class.equals(Double.class) + || Boolean.class.equals(Boolean.class) + || Boolean.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((Boolean.class.equals(Integer.class) || Boolean.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((Boolean.class.equals(Float.class) || Boolean.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (Boolean.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (Boolean.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(Boolean.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. + deserialized = tmp; + match++; + + log.log(Level.FINER, "Input data matches schema 'Boolean'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Boolean'", e); + } + + CILogAttributeValue ret = new CILogAttributeValue(); + 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; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CILogAttributeValue getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CILogAttributeValue cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public CILogAttributeValue() { + super("oneOf", Boolean.FALSE); + } + + public CILogAttributeValue(String o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CILogAttributeValue(Double o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CILogAttributeValue(Boolean o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", new GenericType() {}); + schemas.put("Double", new GenericType() {}); + schemas.put("Boolean", new GenericType() {}); + JSON.registerDescendants(CILogAttributeValue.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return CILogAttributeValue.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String, Double, Boolean + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(String.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Double.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(Boolean.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be String, Double, Boolean"); + } + + /** + * Get the actual instance, which can be the following: String, Double, Boolean + * + * @return The actual instance (String, Double, Boolean) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Double`. If the actual instance is not `Double`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Double` + * @throws ClassCastException if the instance is not `Double` + */ + public Double getDouble() throws ClassCastException { + return (Double) super.getActualInstance(); + } + + /** + * Get the actual instance of `Boolean`. If the actual instance is not `Boolean`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Boolean` + * @throws ClassCastException if the instance is not `Boolean` + */ + public Boolean getBoolean() throws ClassCastException { + return (Boolean) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CILogContentEncoding.java b/src/main/java/com/datadog/api/client/v2/model/CILogContentEncoding.java new file mode 100644 index 00000000000..f1088c392a7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogContentEncoding.java @@ -0,0 +1,56 @@ +/* + * 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; + +/** HTTP header used to compress the JSON request body. */ +@JsonSerialize(using = CILogContentEncoding.CILogContentEncodingSerializer.class) +public class CILogContentEncoding extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("identity", "gzip")); + + public static final CILogContentEncoding IDENTITY = new CILogContentEncoding("identity"); + public static final CILogContentEncoding GZIP = new CILogContentEncoding("gzip"); + + CILogContentEncoding(String value) { + super(value, allowedValues); + } + + public static class CILogContentEncodingSerializer extends StdSerializer { + public CILogContentEncodingSerializer(Class t) { + super(t); + } + + public CILogContentEncodingSerializer() { + this(null); + } + + @Override + public void serialize( + CILogContentEncoding value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CILogContentEncoding fromValue(String value) { + return new CILogContentEncoding(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CILogErrors.java b/src/main/java/com/datadog/api/client/v2/model/CILogErrors.java new file mode 100644 index 00000000000..0fefda9bec1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogErrors.java @@ -0,0 +1,145 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Authentication and authorization errors returned by the CI logs intake API. */ +@JsonPropertyOrder({CILogErrors.JSON_PROPERTY_ERRORS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CILogErrors { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = null; + + public CILogErrors errors(List errors) { + this.errors = errors; + return this; + } + + public CILogErrors addErrorsItem(String errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + + /** + * Error messages. + * + * @return errors + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + /** + * 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 CILogErrors + */ + @JsonAnySetter + public CILogErrors 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 CILogErrors object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CILogErrors ciLogErrors = (CILogErrors) o; + return Objects.equals(this.errors, ciLogErrors.errors) + && Objects.equals(this.additionalProperties, ciLogErrors.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CILogErrors {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).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/CILogIntakeError.java b/src/main/java/com/datadog/api/client/v2/model/CILogIntakeError.java new file mode 100644 index 00000000000..c77dd0efeea --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogIntakeError.java @@ -0,0 +1,191 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A request error returned by the CI logs intake API. */ +@JsonPropertyOrder({ + CILogIntakeError.JSON_PROPERTY_DETAIL, + CILogIntakeError.JSON_PROPERTY_STATUS, + CILogIntakeError.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CILogIntakeError { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DETAIL = "detail"; + private String detail; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public CILogIntakeError detail(String detail) { + this.detail = detail; + return this; + } + + /** + * Error details. + * + * @return detail + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DETAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public CILogIntakeError status(String status) { + this.status = status; + return this; + } + + /** + * HTTP status code. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public CILogIntakeError title(String title) { + this.title = title; + return this; + } + + /** + * Error title. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * 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 CILogIntakeError + */ + @JsonAnySetter + public CILogIntakeError 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 CILogIntakeError object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CILogIntakeError ciLogIntakeError = (CILogIntakeError) o; + return Objects.equals(this.detail, ciLogIntakeError.detail) + && Objects.equals(this.status, ciLogIntakeError.status) + && Objects.equals(this.title, ciLogIntakeError.title) + && Objects.equals(this.additionalProperties, ciLogIntakeError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, status, title, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CILogIntakeError {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).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/CILogIntakeErrors.java b/src/main/java/com/datadog/api/client/v2/model/CILogIntakeErrors.java new file mode 100644 index 00000000000..bcfacaf36e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogIntakeErrors.java @@ -0,0 +1,156 @@ +/* + * 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Request errors returned by the CI logs intake API. */ +@JsonPropertyOrder({CILogIntakeErrors.JSON_PROPERTY_ERRORS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CILogIntakeErrors { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERRORS = "errors"; + private List errors = null; + + public CILogIntakeErrors errors(List errors) { + this.errors = errors; + if (errors != null) { + for (CILogIntakeError item : errors) { + this.unparsed |= item.unparsed; + } + } + return this; + } + + public CILogIntakeErrors addErrorsItem(CILogIntakeError errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + this.unparsed |= errorsItem.unparsed; + return this; + } + + /** + * Request errors. + * + * @return errors + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERRORS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + if (errors != null) { + for (CILogIntakeError item : errors) { + this.unparsed |= item.unparsed; + } + } + } + + /** + * 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 CILogIntakeErrors + */ + @JsonAnySetter + public CILogIntakeErrors 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 CILogIntakeErrors object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CILogIntakeErrors ciLogIntakeErrors = (CILogIntakeErrors) o; + return Objects.equals(this.errors, ciLogIntakeErrors.errors) + && Objects.equals(this.additionalProperties, ciLogIntakeErrors.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(errors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CILogIntakeErrors {\n"); + sb.append(" errors: ").append(toIndentedString(errors)).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/CILogItem.java b/src/main/java/com/datadog/api/client/v2/model/CILogItem.java new file mode 100644 index 00000000000..6618383974b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CILogItem.java @@ -0,0 +1,384 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A CI job log line. */ +@JsonPropertyOrder({ + CILogItem.JSON_PROPERTY_DDTAGS, + CILogItem.JSON_PROPERTY_JOB_ID, + CILogItem.JSON_PROPERTY_LINE_NUMBER, + CILogItem.JSON_PROPERTY_MESSAGE, + CILogItem.JSON_PROPERTY_PIPELINE_UNIQUE_ID, + CILogItem.JSON_PROPERTY_PROVIDER_NAME, + CILogItem.JSON_PROPERTY_SECTION_NAME, + CILogItem.JSON_PROPERTY_STATUS, + CILogItem.JSON_PROPERTY_TIMESTAMP +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CILogItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DDTAGS = "ddtags"; + private String ddtags; + + public static final String JSON_PROPERTY_JOB_ID = "job_id"; + private String jobId; + + public static final String JSON_PROPERTY_LINE_NUMBER = "line_number"; + private Long lineNumber; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_PIPELINE_UNIQUE_ID = "pipeline_unique_id"; + private String pipelineUniqueId; + + public static final String JSON_PROPERTY_PROVIDER_NAME = "provider_name"; + private String providerName; + + public static final String JSON_PROPERTY_SECTION_NAME = "section_name"; + private String sectionName; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private OffsetDateTime timestamp; + + public CILogItem() {} + + @JsonCreator + public CILogItem( + @JsonProperty(required = true, value = JSON_PROPERTY_JOB_ID) String jobId, + @JsonProperty(required = true, value = JSON_PROPERTY_MESSAGE) String message, + @JsonProperty(required = true, value = JSON_PROPERTY_PIPELINE_UNIQUE_ID) + String pipelineUniqueId) { + this.jobId = jobId; + this.message = message; + this.pipelineUniqueId = pipelineUniqueId; + } + + public CILogItem ddtags(String ddtags) { + this.ddtags = ddtags; + return this; + } + + /** + * Comma-separated key:value tags. A job can have up to 256 tags, including repeated + * keys. + * + * @return ddtags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DDTAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDdtags() { + return ddtags; + } + + public void setDdtags(String ddtags) { + this.ddtags = ddtags; + } + + public CILogItem jobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * The job event's resource.id, sent through the CI Visibility pipeline API. + * + * @return jobId + */ + @JsonProperty(JSON_PROPERTY_JOB_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public CILogItem lineNumber(Long lineNumber) { + this.lineNumber = lineNumber; + return this; + } + + /** + * The line number in the job log. Use 0 or 1 for the first line. minimum: 0 maximum: + * 9223372036854775807 + * + * @return lineNumber + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LINE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getLineNumber() { + return lineNumber; + } + + public void setLineNumber(Long lineNumber) { + this.lineNumber = lineNumber; + } + + public CILogItem message(String message) { + this.message = message; + return this; + } + + /** + * The non-empty log line message. + * + * @return message + */ + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public CILogItem pipelineUniqueId(String pipelineUniqueId) { + this.pipelineUniqueId = pipelineUniqueId; + return this; + } + + /** + * The resource.unique_id of the pipeline event, which must also match the job + * event's resource.pipeline_unique_id. + * + * @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 CILogItem providerName(String providerName) { + this.providerName = providerName; + return this; + } + + /** + * The provider name sent with the pipeline event. It defaults to custom when omitted + * and, when provided, must be non-empty and cannot contain a comma. + * + * @return providerName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PROVIDER_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProviderName() { + return providerName; + } + + public void setProviderName(String providerName) { + this.providerName = providerName; + } + + public CILogItem sectionName(String sectionName) { + this.sectionName = sectionName; + return this; + } + + /** + * The provider-defined section containing this log line, used to display collapsible groups of + * lines in the CI job log view. + * + * @return sectionName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SECTION_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSectionName() { + return sectionName; + } + + public void setSectionName(String sectionName) { + this.sectionName = sectionName; + } + + public CILogItem status(String status) { + this.status = status; + return this; + } + + /** + * The status of this log line. Any string is accepted. Datadog maps non-empty values to a + * standard log status. See status + * mapping. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public CILogItem timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * The log line time in RFC 3339 format with an explicit timezone. If omitted, the intake time is + * used. It can be at most 18 hours in the past or 12 hours in the future. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getTimestamp() { + return timestamp; + } + + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + /** + * 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 CILogItem + */ + @JsonAnySetter + public CILogItem 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 CILogItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CILogItem ciLogItem = (CILogItem) o; + return Objects.equals(this.ddtags, ciLogItem.ddtags) + && Objects.equals(this.jobId, ciLogItem.jobId) + && Objects.equals(this.lineNumber, ciLogItem.lineNumber) + && Objects.equals(this.message, ciLogItem.message) + && Objects.equals(this.pipelineUniqueId, ciLogItem.pipelineUniqueId) + && Objects.equals(this.providerName, ciLogItem.providerName) + && Objects.equals(this.sectionName, ciLogItem.sectionName) + && Objects.equals(this.status, ciLogItem.status) + && Objects.equals(this.timestamp, ciLogItem.timestamp) + && Objects.equals(this.additionalProperties, ciLogItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + ddtags, + jobId, + lineNumber, + message, + pipelineUniqueId, + providerName, + sectionName, + status, + timestamp, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CILogItem {\n"); + sb.append(" ddtags: ").append(toIndentedString(ddtags)).append("\n"); + sb.append(" jobId: ").append(toIndentedString(jobId)).append("\n"); + sb.append(" lineNumber: ").append(toIndentedString(lineNumber)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" pipelineUniqueId: ").append(toIndentedString(pipelineUniqueId)).append("\n"); + sb.append(" providerName: ").append(toIndentedString(providerName)).append("\n"); + sb.append(" sectionName: ").append(toIndentedString(sectionName)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).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/test/resources/com/datadog/api/client/v2/api/ci_visibility_logs.feature b/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_logs.feature new file mode 100644 index 00000000000..90b789d87ec --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/ci_visibility_logs.feature @@ -0,0 +1,44 @@ +@endpoint(ci-visibility-logs) @endpoint(ci-visibility-logs-v2) +Feature: CI Visibility Logs + Send CI job logs over HTTP for CI Visibility. + + Background: + Given a valid "apiKeyAuth" key in the system + And an instance of "CIVisibilityLogs" API + And new "SubmitCILog" request + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: Send CI job logs returns "Bad Request" response + Given body with value [{"ddtags": "runner:linux,architecture:amd64", "job_id": "job-456", "line_number": 812, "message": "Running go test ./...", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "provider_name": "example-provider", "section_name": "tests", "status": "warn"}] + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: Send CI job logs returns "Payload Too Large" response + Given body with value [{"ddtags": "runner:linux,architecture:amd64", "job_id": "job-456", "line_number": 812, "message": "Running go test ./...", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "provider_name": "example-provider", "section_name": "tests", "status": "warn"}] + When the request is sent + Then the response status is 413 Payload Too Large + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: Send CI job logs returns "Request Timeout" response + Given body with value [{"ddtags": "runner:linux,architecture:amd64", "job_id": "job-456", "line_number": 812, "message": "Running go test ./...", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "provider_name": "example-provider", "section_name": "tests", "status": "warn"}] + When the request is sent + Then the response status is 408 Request Timeout + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: Send CI job logs returns "Request accepted for processing" response + Given body with value [{"ddtags": "runner:linux,architecture:amd64", "job_id": "job-456", "line_number": 812, "message": "Running go test ./...", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "provider_name": "example-provider", "section_name": "tests", "status": "warn"}] + When the request is sent + Then the response status is 202 Request accepted for processing + + @team:ddoghq/ci-app-backend + Scenario: Send batched CI job logs returns "Request accepted for processing" response + Given body with value [{"message": "Starting tests", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "job_id": "job-456", "line_number": 1, "status": "notice", "section_name": "tests"}, {"message": "Tests passed", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "job_id": "job-456", "line_number": 2}] + When the request is sent + Then the response status is 202 Request accepted for processing + + @team:ddoghq/ci-app-backend + Scenario: Send one CI job log returns "Request accepted for processing" response + Given body with value [{"message": "Running go test ./...", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "job_id": "job-456", "provider_name": "example-provider", "line_number": 1, "status": "warn", "section_name": "tests", "ddtags": "runner:linux,architecture:amd64"}] + When the request is sent + Then the response status is 202 Request accepted for processing diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index c65a1e0cbcb..6b0fafaa067 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1483,6 +1483,12 @@ "type": "safe" } }, + "SubmitCILog": { + "tag": "CI Visibility Logs", + "undo": { + "type": "safe" + } + }, "ListAWSCloudAuthPersonaMappings": { "tag": "Cloud Authentication", "undo": { diff --git a/src/test/resources/generated-test/test-runner-data/manifest.json b/src/test/resources/generated-test/test-runner-data/manifest.json index 944d992b686..1017f4ccf33 100644 --- a/src/test/resources/generated-test/test-runner-data/manifest.json +++ b/src/test/resources/generated-test/test-runner-data/manifest.json @@ -3808,6 +3808,20 @@ "scenario": "Get all case types returns \"OK\" response", "version": "v2" }, + { + "feature": "CI Visibility Logs", + "feature_file": "../../com/datadog/api/client/v2/api/ci_visibility_logs.feature", + "file": "v2/ci-visibility-logs/send-batched-ci-job-logs-returns-request-accepted-for-processing-response.json", + "scenario": "Send batched CI job logs returns \"Request accepted for processing\" response", + "version": "v2" + }, + { + "feature": "CI Visibility Logs", + "feature_file": "../../com/datadog/api/client/v2/api/ci_visibility_logs.feature", + "file": "v2/ci-visibility-logs/send-one-ci-job-log-returns-request-accepted-for-processing-response.json", + "scenario": "Send one CI job log returns \"Request accepted for processing\" response", + "version": "v2" + }, { "feature": "CI Visibility Pipelines", "feature_file": "../../com/datadog/api/client/v2/api/ci_visibility_pipelines.feature", diff --git a/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-batched-ci-job-logs-returns-request-accepted-for-processing-response.json b/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-batched-ci-job-logs-returns-request-accepted-for-processing-response.json new file mode 100644 index 00000000000..455d085bd9a --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-batched-ci-job-logs-returns-request-accepted-for-processing-response.json @@ -0,0 +1,46 @@ +{ + "api": "CIVisibilityLogs", + "expected_status": 202, + "feature": "CI Visibility Logs", + "id": "v2/CI Visibility Logs/Send batched CI job logs returns \"Request accepted for processing\" response", + "operation_id": "SubmitCILog", + "request": { + "body": { + "schema": { + "format": null, + "items": { + "format": null, + "ref": "CILogItem", + "type": "object" + }, + "ref": "CILogRequest", + "type": "array" + }, + "source": "inline", + "value": [ + { + "job_id": "job-456", + "line_number": 1, + "message": "Starting tests", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + "section_name": "tests", + "status": "notice" + }, + { + "job_id": "job-456", + "line_number": 2, + "message": "Tests passed", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a" + } + ] + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/cilogs" + }, + "scenario": "Send batched CI job logs returns \"Request accepted for processing\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-one-ci-job-log-returns-request-accepted-for-processing-response.json b/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-one-ci-job-log-returns-request-accepted-for-processing-response.json new file mode 100644 index 00000000000..4335aab5ffe --- /dev/null +++ b/src/test/resources/generated-test/test-runner-data/v2/ci-visibility-logs/send-one-ci-job-log-returns-request-accepted-for-processing-response.json @@ -0,0 +1,42 @@ +{ + "api": "CIVisibilityLogs", + "expected_status": 202, + "feature": "CI Visibility Logs", + "id": "v2/CI Visibility Logs/Send one CI job log returns \"Request accepted for processing\" response", + "operation_id": "SubmitCILog", + "request": { + "body": { + "schema": { + "format": null, + "items": { + "format": null, + "ref": "CILogItem", + "type": "object" + }, + "ref": "CILogRequest", + "type": "array" + }, + "source": "inline", + "value": [ + { + "ddtags": "runner:linux,architecture:amd64", + "job_id": "job-456", + "line_number": 1, + "message": "Running go test ./...", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + "provider_name": "example-provider", + "section_name": "tests", + "status": "warn" + } + ] + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v2/cilogs" + }, + "scenario": "Send one CI job log returns \"Request accepted for processing\" response", + "schema_version": 1, + "version": "v2" +} diff --git a/src/test/resources/generated-test/test-server-data/manifest.json b/src/test/resources/generated-test/test-server-data/manifest.json index 3eaf315d477..6dc1a1f0bc7 100644 --- a/src/test/resources/generated-test/test-server-data/manifest.json +++ b/src/test/resources/generated-test/test-server-data/manifest.json @@ -170,6 +170,11 @@ "file": "v2/authn-mappings.json", "version": "v2" }, + { + "feature": "CI Visibility Logs", + "file": "v2/ci-visibility-logs.json", + "version": "v2" + }, { "feature": "CI Visibility Pipelines", "file": "v2/ci-visibility-pipelines.json", diff --git a/src/test/resources/generated-test/test-server-data/v2/ci-visibility-logs.json b/src/test/resources/generated-test/test-server-data/v2/ci-visibility-logs.json new file mode 100644 index 00000000000..1268cf5baf6 --- /dev/null +++ b/src/test/resources/generated-test/test-server-data/v2/ci-visibility-logs.json @@ -0,0 +1,95 @@ +{ + "feature": "CI Visibility Logs", + "recordings": [ + { + "feature": "CI Visibility Logs", + "frozen_at": "2026-10-01T13:38:29.002Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": [ + { + "job_id": "job-456", + "line_number": 1, + "message": "Starting tests", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + "section_name": "tests", + "status": "notice" + }, + { + "job_id": "job-456", + "line_number": 2, + "message": "Tests passed", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a" + } + ] + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/cilogs", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "Accepted", + "status": 202 + } + } + ], + "scenario": "Send batched CI job logs returns \"Request accepted for processing\" response", + "version": "v2" + }, + { + "feature": "CI Visibility Logs", + "frozen_at": "2026-10-01T14:45:37.327Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": [ + { + "ddtags": "runner:linux,architecture:amd64", + "job_id": "job-456", + "line_number": 1, + "message": "Running go test ./...", + "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + "provider_name": "example-provider", + "section_name": "tests", + "status": "warn" + } + ] + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/cilogs", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "Accepted", + "status": 202 + } + } + ], + "scenario": "Send one CI job log returns \"Request accepted for processing\" response", + "version": "v2" + } + ], + "schema_version": 1, + "version": "v2" +}