Skip to content

Commit

Permalink
Regenerate client from commit 9b78f561 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jan 9, 2025
1 parent 5bf3b2f commit 297ff94
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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("[email protected]"))))))
.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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -177,14 +203,15 @@ 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
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: ")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-08T08:57:29.599Z
Original file line number Diff line number Diff line change
@@ -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\":\"[email protected]\",\"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"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]"}}},"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
Expand Down

0 comments on commit 297ff94

Please sign in to comment.