|
| 1 | +# Send several pipeline events returns "Request accepted for processing" response |
| 2 | + |
| 3 | +require "datadog_api_client" |
| 4 | +api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new |
| 5 | + |
| 6 | +body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({ |
| 7 | + data: [ |
| 8 | + DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({ |
| 9 | + attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({ |
| 10 | + provider_name: "example-provider", |
| 11 | + resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({ |
| 12 | + level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE, |
| 13 | + unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", |
| 14 | + name: "Deploy to AWS", |
| 15 | + url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1", |
| 16 | + start: (Time.now + -120), |
| 17 | + _end: (Time.now + -30), |
| 18 | + status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS, |
| 19 | + partial_retry: false, |
| 20 | + git: DatadogAPIClient::V2::CIAppGitInfo.new({ |
| 21 | + repository_url: "https://github.com/DataDog/datadog-agent", |
| 22 | + sha: "7f263865994b76066c4612fd1965215e7dcb4cd2", |
| 23 | + author_email: "john.doe@email.com", |
| 24 | + }), |
| 25 | + }), |
| 26 | + }), |
| 27 | + type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST, |
| 28 | + }), |
| 29 | + DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({ |
| 30 | + attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({ |
| 31 | + provider_name: "example-provider", |
| 32 | + resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({ |
| 33 | + level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE, |
| 34 | + unique_id: "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b", |
| 35 | + name: "Deploy to Production", |
| 36 | + url: "https://my-ci-provider.example/pipelines/prod-pipeline/run/2", |
| 37 | + start: (Time.now + -180), |
| 38 | + _end: (Time.now + -45), |
| 39 | + status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS, |
| 40 | + partial_retry: false, |
| 41 | + git: DatadogAPIClient::V2::CIAppGitInfo.new({ |
| 42 | + repository_url: "https://github.com/DataDog/datadog-agent", |
| 43 | + sha: "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e", |
| 44 | + author_email: "jane.smith@email.com", |
| 45 | + }), |
| 46 | + }), |
| 47 | + }), |
| 48 | + type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST, |
| 49 | + }), |
| 50 | + ], |
| 51 | +}) |
| 52 | +p api_instance.create_ci_app_pipeline_event(body) |
0 commit comments