From 297ff94009f7f42daf30525f2b3281c194068567 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 9 Jan 2025 14:30:14 +0000 Subject: [PATCH] Regenerate client from commit 9b78f561 of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v2/openapi.yaml | 3 + .../CreateCIAppPipelineEvent_819339921.java | 61 +++++++++++++++++++ ...pCreatePipelineEventRequestAttributes.java | 29 ++++++++- ...st_accepted_for_processing_response.freeze | 1 + ...uest_accepted_for_processing_response.json | 32 ++++++++++ .../v2/api/ci_visibility_pipelines.feature | 7 +++ 7 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.java create mode 100644 src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.json diff --git a/.apigentools-info b/.apigentools-info index e7dd4e2644f..58123f9dec0 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-08 14:02:25.501612", - "spec_repo_commit": "1920836f" + "regenerated": "2025-01-09 14:28:27.764486", + "spec_repo_commit": "9b78f561" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-08 14:02:25.524422", - "spec_repo_commit": "1920836f" + "regenerated": "2025-01-09 14:28:27.784183", + "spec_repo_commit": "9b78f561" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fadab8d3ec6..4ec6889455e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3382,6 +3382,9 @@ components: env: description: The Datadog environment. type: string + provider_name: + description: The name of the CI provider. By default, this is "custom". + type: string resource: $ref: '#/components/schemas/CIAppCreatePipelineEventRequestAttributesResource' service: diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.java b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.java new file mode 100644 index 00000000000..d8ef10c0f73 --- /dev/null +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.java @@ -0,0 +1,61 @@ +// Send pipeline event with custom provider 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.CIAppCreatePipelineEventRequestDataType; +import com.datadog.api.client.v2.model.CIAppGitInfo; +import com.datadog.api.client.v2.model.CIAppPipelineEventFinishedPipeline; +import com.datadog.api.client.v2.model.CIAppPipelineEventPipeline; +import com.datadog.api.client.v2.model.CIAppPipelineEventPipelineLevel; +import com.datadog.api.client.v2.model.CIAppPipelineEventPipelineStatus; +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 CIAppCreatePipelineEventRequestData() + .attributes( + new CIAppCreatePipelineEventRequestAttributes() + .providerName("example-provider") + .resource( + new CIAppCreatePipelineEventRequestAttributesResource( + new CIAppPipelineEventPipeline( + new CIAppPipelineEventFinishedPipeline() + .level(CIAppPipelineEventPipelineLevel.PIPELINE) + .uniqueId("3eacb6f3-ff04-4e10-8a9c-46e6d054024a") + .name("Deploy to AWS") + .url( + "https://my-ci-provider.example/pipelines/my-pipeline/run/1") + .start(OffsetDateTime.now().plusSeconds(-120)) + .end(OffsetDateTime.now().plusSeconds(-30)) + .status(CIAppPipelineEventPipelineStatus.SUCCESS) + .partialRetry(false) + .git( + new CIAppGitInfo() + .repositoryUrl( + "https://github.com/DataDog/datadog-agent") + .sha("7f263865994b76066c4612fd1965215e7dcb4cd2") + .authorEmail("john.doe@email.com")))))) + .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/CIAppCreatePipelineEventRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CIAppCreatePipelineEventRequestAttributes.java index df42d23f837..5e191c0a905 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CIAppCreatePipelineEventRequestAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/CIAppCreatePipelineEventRequestAttributes.java @@ -20,6 +20,7 @@ /** Attributes of the pipeline event to create. */ @JsonPropertyOrder({ CIAppCreatePipelineEventRequestAttributes.JSON_PROPERTY_ENV, + CIAppCreatePipelineEventRequestAttributes.JSON_PROPERTY_PROVIDER_NAME, CIAppCreatePipelineEventRequestAttributes.JSON_PROPERTY_RESOURCE, CIAppCreatePipelineEventRequestAttributes.JSON_PROPERTY_SERVICE }) @@ -30,6 +31,9 @@ public class CIAppCreatePipelineEventRequestAttributes { public static final String JSON_PROPERTY_ENV = "env"; private String env; + public static final String JSON_PROPERTY_PROVIDER_NAME = "provider_name"; + private String providerName; + public static final String JSON_PROPERTY_RESOURCE = "resource"; private CIAppCreatePipelineEventRequestAttributesResource resource; @@ -67,6 +71,27 @@ public void setEnv(String env) { this.env = env; } + public CIAppCreatePipelineEventRequestAttributes providerName(String providerName) { + this.providerName = providerName; + return this; + } + + /** + * The name of the CI provider. By default, this is "custom". + * + * @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 CIAppCreatePipelineEventRequestAttributes resource( CIAppCreatePipelineEventRequestAttributesResource resource) { this.resource = resource; @@ -168,6 +193,7 @@ public boolean equals(Object o) { CIAppCreatePipelineEventRequestAttributes ciAppCreatePipelineEventRequestAttributes = (CIAppCreatePipelineEventRequestAttributes) o; return Objects.equals(this.env, ciAppCreatePipelineEventRequestAttributes.env) + && Objects.equals(this.providerName, ciAppCreatePipelineEventRequestAttributes.providerName) && Objects.equals(this.resource, ciAppCreatePipelineEventRequestAttributes.resource) && Objects.equals(this.service, ciAppCreatePipelineEventRequestAttributes.service) && Objects.equals( @@ -177,7 +203,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(env, resource, service, additionalProperties); + return Objects.hash(env, providerName, resource, service, additionalProperties); } @Override @@ -185,6 +211,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CIAppCreatePipelineEventRequestAttributes {\n"); sb.append(" env: ").append(toIndentedString(env)).append("\n"); + sb.append(" providerName: ").append(toIndentedString(providerName)).append("\n"); sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); sb.append(" service: ").append(toIndentedString(service)).append("\n"); sb.append(" additionalProperties: ") diff --git a/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.freeze b/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.freeze new file mode 100644 index 00000000000..da0b2504134 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.freeze @@ -0,0 +1 @@ +2025-01-08T08:57:29.599Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.json b/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.json new file mode 100644 index 00000000000..4a6fd2931c8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Send_pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"provider_name\":\"example-provider\",\"resource\":{\"end\":\"2025-01-08T08:56:59.599Z\",\"git\":{\"author_email\":\"john.doe@email.com\",\"repository_url\":\"https://github.com/DataDog/datadog-agent\",\"sha\":\"7f263865994b76066c4612fd1965215e7dcb4cd2\"},\"level\":\"pipeline\",\"name\":\"Deploy to AWS\",\"partial_retry\":false,\"start\":\"2025-01-08T08:55:29.599Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}" + }, + "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": "c3f1f245-7eca-522f-3006-d46cf4c7d02e" + } +] \ 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 7f707950723..81bd36d12d5 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 @@ -108,6 +108,13 @@ Feature: CI Visibility Pipelines When the request is sent Then the response status is 202 Request accepted for processing + @team:Datadog/ci-app-backend + Scenario: Send pipeline event with custom provider returns "Request accepted for processing" response + Given new "CreateCIAppPipelineEvent" request + And body with value {"data": {"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}} + When the request is sent + Then the response status is 202 Request accepted for processing + @skip @team:Datadog/ci-app-backend Scenario: Send pipeline job event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request