-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit 05535c9b of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Jan 15, 2025
1 parent
851e958
commit 7012c3d
Showing
7 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Send pipeline event with custom provider returns "Request accepted for processing" response | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" | ||
) | ||
|
||
func main() { | ||
body := datadogV2.CIAppCreatePipelineEventRequest{ | ||
Data: &datadogV2.CIAppCreatePipelineEventRequestData{ | ||
Attributes: &datadogV2.CIAppCreatePipelineEventRequestAttributes{ | ||
ProviderName: datadog.PtrString("example-provider"), | ||
Resource: datadogV2.CIAppCreatePipelineEventRequestAttributesResource{ | ||
CIAppPipelineEventPipeline: &datadogV2.CIAppPipelineEventPipeline{ | ||
CIAppPipelineEventFinishedPipeline: &datadogV2.CIAppPipelineEventFinishedPipeline{ | ||
Level: datadogV2.CIAPPPIPELINEEVENTPIPELINELEVEL_PIPELINE, | ||
UniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", | ||
Name: "Deploy to AWS", | ||
Url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1", | ||
Start: time.Now().Add(time.Second * -120), | ||
End: time.Now().Add(time.Second * -30), | ||
Status: datadogV2.CIAPPPIPELINEEVENTPIPELINESTATUS_SUCCESS, | ||
PartialRetry: false, | ||
Git: *datadogV2.NewNullableCIAppGitInfo(&datadogV2.CIAppGitInfo{ | ||
RepositoryUrl: "https://github.com/DataDog/datadog-agent", | ||
Sha: "7f263865994b76066c4612fd1965215e7dcb4cd2", | ||
AuthorEmail: "[email protected]", | ||
}), | ||
}}}, | ||
}, | ||
Type: datadogV2.CIAPPCREATEPIPELINEEVENTREQUESTDATATYPE_CIPIPELINE_RESOURCE_REQUEST.Ptr(), | ||
}, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV2.NewCIVisibilityPipelinesApi(apiClient) | ||
resp, r, err := api.CreateCIAppPipelineEvent(ctx, body) | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `CIVisibilityPipelinesApi.CreateCIAppPipelineEvent`: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
} | ||
|
||
responseContent, _ := json.MarshalIndent(resp, "", " ") | ||
fmt.Fprintf(os.Stdout, "Response from `CIVisibilityPipelinesApi.CreateCIAppPipelineEvent`:\n%s\n", responseContent) | ||
} |
1 change: 1 addition & 0 deletions
1
...peline_event_with_custom_provider_returns_Request_accepted_for_processing_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2025-01-08T08:57:29.599Z |
22 changes: 22 additions & 0 deletions
22
...pipeline_event_with_custom_provider_returns_Request_accepted_for_processing_response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"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"}} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
id: 0 | ||
method: POST | ||
url: https://api.datadoghq.com/api/v2/ci/pipeline | ||
response: | ||
body: '{"data":null}' | ||
code: 202 | ||
duration: 0ms | ||
headers: | ||
Content-Type: | ||
- application/vnd.api+json | ||
status: 202 Accepted | ||
version: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|