From 740b1b84e5d77057f28f01f97d7a9d6912ecd854 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 10 Dec 2024 19:50:33 +0000 Subject: [PATCH] Regenerate client from commit 5da0cd35 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 279 +++++++---- ...ipelines-events-returns-OK-response.frozen | 2 +- ...e-pipelines-events-returns-OK-response.yml | 6 +- ...ipelines-events-returns-OK-response.frozen | 2 +- ...f-pipelines-events-returns-OK-response.yml | 23 +- ...ipelines-events-returns-OK-response.frozen | 2 +- ...h-pipelines-events-returns-OK-response.yml | 16 +- ...st-accepted-for-processing-response.frozen | 2 +- ...quest-accepted-for-processing-response.yml | 6 +- ...st-accepted-for-processing-response.frozen | 2 +- ...quest-accepted-for-processing-response.yml | 6 +- ...st-accepted-for-processing-response.frozen | 1 + ...quest-accepted-for-processing-response.yml | 25 + .../CreateCIAppPipelineEvent.rb | 10 +- .../CreateCIAppPipelineEvent_129899466.rb | 8 +- .../CreateCIAppPipelineEvent_2341150096.rb | 27 ++ features/v2/ci_visibility_pipelines.feature | 13 +- lib/datadog_api_client/inflector.rb | 3 + ...ci_app_pipeline_event_finished_pipeline.rb | 427 +++++++++++++++++ ...app_pipeline_event_in_progress_pipeline.rb | 405 ++++++++++++++++ .../models/ci_app_pipeline_event_pipeline.rb | 436 ++---------------- ...eline_event_pipeline_in_progress_status.rb | 26 ++ 23 files changed, 1183 insertions(+), 552 deletions(-) create mode 100644 cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen create mode 100644 cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.yml create mode 100644 examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2341150096.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_pipeline_event_finished_pipeline.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_pipeline_event_in_progress_pipeline.rb create mode 100644 lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline_in_progress_status.rb diff --git a/.apigentools-info b/.apigentools-info index 2a3d319632d7..e35e604009bb 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 17:29:00.035501", - "spec_repo_commit": "f35e3502" + "regenerated": "2024-12-10 19:50:07.184039", + "spec_repo_commit": "5da0cd35" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-10 17:29:00.053946", - "spec_repo_commit": "f35e3502" + "regenerated": "2024-12-10 19:50:07.202868", + "spec_repo_commit": "5da0cd35" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cb2fda6b0184..a21342f7d18e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3259,6 +3259,183 @@ components: tags: $ref: '#/components/schemas/TagsEventAttribute' type: object + CIAppPipelineEventFinishedPipeline: + description: Details of a finished pipeline. + properties: + end: + description: Time when the pipeline run finished. It cannot be older than + 18 hours in the past from the current time. The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + error: + $ref: '#/components/schemas/CIAppCIError' + git: + $ref: '#/components/schemas/CIAppGitInfo' + is_manual: + description: Whether or not the pipeline was triggered manually by the user. + example: false + nullable: true + type: boolean + is_resumed: + description: Whether or not the pipeline was resumed after being blocked. + example: false + nullable: true + type: boolean + level: + $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' + metrics: + $ref: '#/components/schemas/CIAppPipelineEventMetrics' + name: + description: Name of the pipeline. All pipeline runs for the builds should + have the same name. + example: Deploy to AWS + type: string + node: + $ref: '#/components/schemas/CIAppHostInfo' + parameters: + $ref: '#/components/schemas/CIAppPipelineEventParameters' + parent_pipeline: + $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' + partial_retry: + description: 'Whether or not the pipeline was a partial retry of a previous + attempt. A partial retry is one + + which only runs a subset of the original jobs.' + example: false + type: boolean + pipeline_id: + description: 'Any ID used in the provider to identify the pipeline run even + if it is not unique across retries. + + If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` + can be set to the same value.' + example: '#023' + type: string + previous_attempt: + $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' + queue_time: + description: The queue time in milliseconds, if applicable. + example: 1004 + format: int64 + minimum: 0 + nullable: true + type: integer + start: + description: Time when the pipeline run started (it should not include any + queue time). The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + status: + $ref: '#/components/schemas/CIAppPipelineEventPipelineStatus' + tags: + $ref: '#/components/schemas/CIAppPipelineEventTags' + unique_id: + description: 'UUID of the pipeline run. The ID has to be unique across retries + and pipelines, + + including partial retries.' + example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + type: string + url: + description: The URL to look at the pipeline in the CI provider UI. + example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 + type: string + required: + - level + - unique_id + - name + - url + - start + - end + - status + - partial_retry + type: object + CIAppPipelineEventInProgressPipeline: + description: Details of a running pipeline. + properties: + error: + $ref: '#/components/schemas/CIAppCIError' + git: + $ref: '#/components/schemas/CIAppGitInfo' + is_manual: + description: Whether or not the pipeline was triggered manually by the user. + example: false + nullable: true + type: boolean + is_resumed: + description: Whether or not the pipeline was resumed after being blocked. + example: false + nullable: true + type: boolean + level: + $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' + metrics: + $ref: '#/components/schemas/CIAppPipelineEventMetrics' + name: + description: Name of the pipeline. All pipeline runs for the builds should + have the same name. + example: Deploy to AWS + type: string + node: + $ref: '#/components/schemas/CIAppHostInfo' + parameters: + $ref: '#/components/schemas/CIAppPipelineEventParameters' + parent_pipeline: + $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' + partial_retry: + description: 'Whether or not the pipeline was a partial retry of a previous + attempt. A partial retry is one + + which only runs a subset of the original jobs.' + example: false + type: boolean + pipeline_id: + description: 'Any ID used in the provider to identify the pipeline run even + if it is not unique across retries. + + If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` + can be set to the same value.' + example: '#023' + type: string + previous_attempt: + $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' + queue_time: + description: The queue time in milliseconds, if applicable. + example: 1004 + format: int64 + minimum: 0 + nullable: true + type: integer + start: + description: Time when the pipeline run started (it should not include any + queue time). The time format must be RFC3339. + example: '2023-05-31T15:30:00Z' + format: date-time + type: string + status: + $ref: '#/components/schemas/CIAppPipelineEventPipelineInProgressStatus' + tags: + $ref: '#/components/schemas/CIAppPipelineEventTags' + unique_id: + description: UUID of the pipeline run. The ID has to be the same as the + finished pipeline. + example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a + type: string + url: + description: The URL to look at the pipeline in the CI provider UI. + example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 + type: string + required: + - level + - unique_id + - name + - url + - start + - status + - partial_retry + type: object CIAppPipelineEventJob: description: Details of a CI job. properties: @@ -3407,97 +3584,17 @@ components: type: object CIAppPipelineEventPipeline: description: Details of the top level pipeline, build, or workflow of your CI. - properties: - end: - description: Time when the pipeline run finished. It cannot be older than - 18 hours in the past from the current time. The time format must be RFC3339. - example: '2023-05-31T15:30:00Z' - format: date-time - type: string - error: - $ref: '#/components/schemas/CIAppCIError' - git: - $ref: '#/components/schemas/CIAppGitInfo' - is_manual: - description: Whether or not the pipeline was triggered manually by the user. - example: false - nullable: true - type: boolean - is_resumed: - description: Whether or not the pipeline was resumed after being blocked. - example: false - nullable: true - type: boolean - level: - $ref: '#/components/schemas/CIAppPipelineEventPipelineLevel' - metrics: - $ref: '#/components/schemas/CIAppPipelineEventMetrics' - name: - description: Name of the pipeline. All pipeline runs for the builds should - have the same name. - example: Deploy to AWS - type: string - node: - $ref: '#/components/schemas/CIAppHostInfo' - parameters: - $ref: '#/components/schemas/CIAppPipelineEventParameters' - parent_pipeline: - $ref: '#/components/schemas/CIAppPipelineEventParentPipeline' - partial_retry: - description: 'Whether or not the pipeline was a partial retry of a previous - attempt. A partial retry is one - - which only runs a subset of the original jobs.' - example: false - type: boolean - pipeline_id: - description: 'Any ID used in the provider to identify the pipeline run even - if it is not unique across retries. - - If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` - can be set to the same value.' - example: '#023' - type: string - previous_attempt: - $ref: '#/components/schemas/CIAppPipelineEventPreviousPipeline' - queue_time: - description: The queue time in milliseconds, if applicable. - example: 1004 - format: int64 - minimum: 0 - nullable: true - type: integer - start: - description: Time when the pipeline run started (it should not include any - queue time). The time format must be RFC3339. - example: '2023-05-31T15:30:00Z' - format: date-time - type: string - status: - $ref: '#/components/schemas/CIAppPipelineEventPipelineStatus' - tags: - $ref: '#/components/schemas/CIAppPipelineEventTags' - unique_id: - description: 'UUID of the pipeline run. The ID has to be unique across retries - and pipelines, - - including partial retries.' - example: 3eacb6f3-ff04-4e10-8a9c-46e6d054024a - type: string - url: - description: The URL to look at the pipeline in the CI provider UI. - example: https://my-ci-provider.example/pipelines/my-pipeline/run/1 - type: string - required: - - level - - unique_id - - name - - url - - start - - end - - status - - partial_retry - type: object + oneOf: + - $ref: '#/components/schemas/CIAppPipelineEventFinishedPipeline' + - $ref: '#/components/schemas/CIAppPipelineEventInProgressPipeline' + CIAppPipelineEventPipelineInProgressStatus: + description: The in progress status of the pipeline. + enum: + - running + example: running + type: string + x-enum-varnames: + - RUNNING CIAppPipelineEventPipelineLevel: default: pipeline description: Used to distinguish between pipelines, stages, jobs, and steps. diff --git a/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen index de1ba14a5546..2f1c06d3bfec 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen +++ b/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-11-28T11:57:44.730Z \ No newline at end of file +2024-11-25T20:08:40.375Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.yml index 143de696f687..1979fcc0e20a 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.yml +++ b/cassettes/features/v2/ci_visibility_pipelines/Aggregate-pipelines-events-returns-OK-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Mon, 28 Nov 2022 11:57:44 GMT +- recorded_at: Mon, 25 Nov 2024 20:08:40 GMT request: body: encoding: UTF-8 @@ -15,7 +15,9 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"meta":{"elapsed":170,"request_id":"pddv1ChYzYWhuN3VqLVR4ZTV4V0Q0LVFDYVB3IiwKHKG6G1xIn05fWwGRsD7MITrTmBASHDayL3wqgBcSDEOG5uEAxWRZVp8G4w","status":"done"},"data":{"buckets":[{"computes":{"c0":236880835985.0375},"by":{"@ci.status":"error"}},{"computes":{"c0":3026515237.0540113},"by":{"@ci.status":"skipped"}},{"computes":{"c0":146575581775.90088},"by":{"@ci.status":"success"}}]}}' + string: '{"meta":{"elapsed":90,"request_id":"pddv1ChZiVnBUVTltRVJocUlzSWlyYkdkRHFRIi0KHQLKXxzUXfzSm-D5KYypc61Y_NGGMKnRbrtODJpWEgwQ-7lds-czCpOBaB4","status":"done"},"data":{"buckets":[]}} + + ' headers: Content-Type: - application/json diff --git a/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen index db490a74c716..79cb47db8353 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen +++ b/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-11-28T11:57:44.947Z \ No newline at end of file +2024-11-25T20:08:40.699Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.yml index 21ccc2feb543..2fb93151a75c 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.yml +++ b/cassettes/features/v2/ci_visibility_pipelines/Get-a-list-of-pipelines-events-returns-OK-response.yml @@ -1,31 +1,18 @@ http_interactions: -- recorded_at: Mon, 28 Nov 2022 11:57:44 GMT +- recorded_at: Mon, 25 Nov 2024 20:08:40 GMT request: body: null headers: Accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bfrom%5D=2022-11-28T11%3A27%3A44.947Z&filter%5Bto%5D=2022-11-28T11%3A57%3A44.947Z&page%5Blimit%5D=5 + uri: https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bfrom%5D=2024-11-25T19%3A38%3A40.699Z&filter%5Bto%5D=2024-11-25T20%3A08%3A40.699Z&page%5Blimit%5D=5 response: body: encoding: UTF-8 - string: '{"data":[{"id":"AgAAAYS-GYtIKjvAWQAAAAAAAAAYAAAAAEFZUy1HWXRJQUFDVGxWdU5hQ2MyOW5kYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz","type":"cipipeline","attributes":{"attributes":{"duration":176127000000,"git":{"commit":{"committer":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"author":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"message":"Directly - send SIGPROF signals to thread holding Global VM Lock","sha":"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a"},"repository_url":"https://github.com/DataDog/repo","repository":{"path":"/DataDog/repo","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"johndoe/directly-signal-gvl-thread"},"ci":{"pipeline":{"name":"build-and-test","id":"e67854de-34d7-4782-a62a-2231977026a6","url":"https://app.circleci.com/pipelines/workflows/e67804de-0000-4782-a62a-2231977026a6"},"provider":{"instance":"circleci","name":"circleci"},"job":{"name":"test-3.0","id":"b2fd7e9c-be84-4ad7-9cc5-3796b0cdbede","url":"https://app.circleci.com/jobs/gh/DataDog/repo/301777"},"status":"success"},"circleci":{"result":"success"},"start":1669636479817000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYS-GWnbVbAEgQAAAAAAAAAYAAAAAEFZUy1HV25iQUFDWG5zSTV2dWM3dzNkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz","type":"cipipeline","attributes":{"attributes":{"duration":226593000000,"git":{"commit":{"committer":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"author":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"message":"Directly - send SIGPROF signals to thread holding Global VM Lock","sha":"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a"},"repository_url":"https://github.com/DataDog/repo","repository":{"path":"/DataDog/drepo","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"johndoe/directly-signal-gvl-thread"},"ci":{"pipeline":{"name":"build-and-test","id":"e67854de-0000-4782-a62a-2231977026a6","url":"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6"},"provider":{"instance":"circleci","name":"circleci"},"job":{"name":"build-jruby-9.3-latest-1","id":"55c12323-bb52-48ad-8f66-42a65d50bad5","url":"https://app.circleci.com/jobs/gh/DataDog/repo/301773"},"status":"success"},"circleci":{"result":"success"},"start":1669636420794000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYS-GUIqP9PNOgAAAAAAAAAYAAAAAEFZUy1HVUlxQUFDekFXOHlOUHZTVVhkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz","type":"cipipeline","attributes":{"attributes":{"duration":217224000000,"git":{"commit":{"committer":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"author":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"message":"Directly - send SIGPROF signals to thread holding Global VM Lock","sha":"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a"},"repository_url":"https://github.com/DataDog/repo","repository":{"path":"DataDog/repo","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"johndoe/directly-signal-gvl-thread"},"ci":{"pipeline":{"name":"build-and-test","id":"e67854de-34d7-4782-a62a-2231977026a6","url":"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6"},"provider":{"instance":"circleci","name":"circleci"},"job":{"name":"build_and_test_integration-2.4","id":"dfb0036b-f9b7-414b-a147-1991e4bf7611","url":"https://app.circleci.com/jobs/gh/DataDog/repo/301772"},"status":"success"},"circleci":{"result":"success"},"start":1669636420002000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYS-GPpigabGUAAAAAAAAAAYAAAAAEFZUy1HUHBpQUFBTEMyS0MwclNtTjNkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz","type":"cipipeline","attributes":{"attributes":{"duration":200658000000,"git":{"commit":{"committer":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"author":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"message":"Directly - send SIGPROF signals to thread holding Global VM Lock","sha":"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a"},"repository_url":"https://github.com/DataDog/repo","repository":{"path":"/DataDog/repo","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"johndoe/directly-signal-gvl-thread"},"ci":{"pipeline":{"name":"build-and-test","id":"e67854de-34d7-4782-a62a-2231977026a6","url":"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6"},"provider":{"instance":"circleci","name":"circleci"},"job":{"name":"build-jruby-9.2-latest-1","id":"09df7769-9b36-40cd-af1c-e97a00e233a5","url":"https://app.circleci.com/jobs/gh/DataDog/repo/301760"},"status":"success"},"circleci":{"result":"success"},"start":1669636418192000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYS-GOd-VzPNOgAAAAAAAAAYAAAAAEFZUy1HT2QtQUFEUzFMbWdMNW4wTFhkYQAAACQAAAAAMDE4NGJlMWItODM2OC00YWNkLTg0ZGMtZTYzMDMzMjk5Mjgz","type":"cipipeline","attributes":{"attributes":{"duration":195791000000,"git":{"commit":{"committer":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"author":{"date":"2022-11-28T11:53:10Z","name":"John - Doe","email":"john.doe@email.com","date_timestamp":1669636390000},"message":"Directly - send SIGPROF signals to thread holding Global VM Lock","sha":"e1d41e2ebc93f48d901d3baa6cbe84f71bdb500a"},"repository_url":"https://github.com/DataDog/dd-trace-rb","repository":{"path":"/DataDog/repo","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"johndoe/directly-signal-gvl-thread"},"ci":{"pipeline":{"name":"build-and-test","id":"e67854de-34d7-4782-a62a-2231977026a6","url":"https://app.circleci.com/pipelines/workflows/e67854de-0000-4782-a62a-2231977026a6"},"provider":{"instance":"circleci","name":"circleci"},"job":{"name":"build_and_test_integration-2.3","id":"64006f66-267a-47b7-8823-94833268546a","url":"https://app.circleci.com/jobs/gh/DataDog/repo/301761"},"status":"success"},"circleci":{"result":"success"},"start":1669636418223000000},"ci_level":"job","tags":["source:apm","source:apm"]}}],"meta":{"page":{"after":"eyJhZnRlciI6IkFnQUFBWVMtR09kLVZ6UE5PZ0FBQUFBQUFBQVlBQUFBQUVGWlV5MUhUMlF0UVVGRVV6Rk1iV2RNTlc0d1RGaGtZUUFBQUNRQUFBQUFNREU0TkdKbE1XSXRPRE0yT0MwMFlXTmtMVGcwWkdNdFpUWXpNRE16TWprNU1qZ3oifQ"}},"links":{"next":"https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bfrom%5D=2022-11-28T11%3A27%3A44.947Z&filter%5Bquery%5D=%40ci.provider.name%3Acircleci&filter%5Bto%5D=2022-11-28T11%3A57%3A44.947Z&page%5Bcursor%5D=eyJhZnRlciI6IkFnQUFBWVMtR09kLVZ6UE5PZ0FBQUFBQUFBQVlBQUFBQUVGWlV5MUhUMlF0UVVGRVV6Rk1iV2RNTlc0d1RGaGtZUUFBQUNRQUFBQUFNREU0TkdKbE1XSXRPRE0yT0MwMFlXTmtMVGcwWkdNdFpUWXpNRE16TWprNU1qZ3oifQ&page%5Blimit%5D=5"}}' + string: '{"data":[],"meta":{"elapsed":24,"request_id":"pddv1ChZWQVB6eTZTZlNqbUZVNm52YmpoX3ZnIi0KHc-jI3NiRHtRq6GL8JBczM6emoOFupT0-5U_puB2EgwHRoVgx7kIsJDWMYA","status":"done"}} + + ' headers: Content-Type: - application/json diff --git a/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen index 7fa758696146..934c9992ff31 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen +++ b/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.frozen @@ -1 +1 @@ -2022-10-21T09:09:41.747Z \ No newline at end of file +2024-11-25T20:08:40.877Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.yml index 04fb5db1d93d..70fc22df3580 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.yml +++ b/cassettes/features/v2/ci_visibility_pipelines/Search-pipelines-events-returns-OK-response.yml @@ -1,5 +1,5 @@ http_interactions: -- recorded_at: Fri, 21 Oct 2022 09:09:41 GMT +- recorded_at: Mon, 25 Nov 2024 20:08:40 GMT request: body: encoding: UTF-8 @@ -14,19 +14,7 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":[{"id":"AgAAAYP5wIfA7N1YyAAAAAAAAAAYAAAAAEFZUDV3SWZBQUFBZGs5R2kyd25pbjdNMQAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx","type":"cipipeline","attributes":{"attributes":{"duration":0,"github":{"conclusion":"failure","node_group":"","html_url":"https://github.com/DataDog/repo","run_attempt":"1","app_id":"128890"},"git":{"commit":{"sha":"95094daa15b4281c41780073ab8b77bc7c8d63d6"},"default_branch":"prod","repository_url":"https://github.com/DataDog/repo.git","repository":{"path":"/DataDog/repo.git","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"erkang.zhang/SYM-390/cache-test-spec"},"ci":{"pipeline":{"name":"Request - Schema diff","id":"3296065344-1"},"node":{"labels":[]},"provider":{"instance":"github-actions","name":"github"},"job":{"name":"Annotate - PR","id":"9025881221","url":"https://github.com/DataDog/repo/runs/9025881221"},"status":"error"},"start":1666342488000000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYP5wZVIw5--1wAAAAAAAAAYAAAAAEFZUDV3WlZJQUFCakl1V1FZUE1TdHlxYgAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx","type":"cipipeline","attributes":{"attributes":{"duration":247000000000,"github":{"conclusion":"failure","node_group":"GitHub - Actions","html_url":"https://github.com/DataDog/repo","run_attempt":"1","app_id":"128890"},"git":{"commit":{"sha":"51aec3962c7b3be87b2d656b22042ee5e2c89a3f"},"repository_url":"https://github.com/DataDog/repo.git","repository":{"path":"/DataDog/repo.git","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"master"},"ci":{"pipeline":{"name":"Staging - Build Deploy and Test","id":"3296065853-1"},"provider":{"instance":"github-actions","name":"github"},"step":{"name":"Run - Datadog Synthetic test"},"job":{"name":"test-checkouts","id":"9025825907"},"status":"error"},"start":1666342310000000000},"ci_level":"step","tags":["source:apm","source:apm"]}},{"id":"AgAAAYP5wZkww5--2gAAAAAAAAAYAAAAAEFZUDV3Wmt3QUFBN1R2bTVRRkxzaENxYgAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx","type":"cipipeline","attributes":{"attributes":{"duration":251000000000,"github":{"conclusion":"failure","node_group":"GitHub - Actions","html_url":"https://github.com/DataDog/repo","run_attempt":"1","app_id":"128890"},"git":{"commit":{"sha":"51aec3962c7b3be87b2d656b22042ee5e2c89a3f"},"default_branch":"master","repository_url":"https://github.com/DataDog/repo.git","repository":{"path":"/DataDog/repo.git","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"master"},"ci":{"pipeline":{"name":"Staging - Build Deploy and Test","id":"3296065853-1"},"node":{"labels":["ubuntu-latest"]},"provider":{"instance":"github-actions","name":"github"},"job":{"name":"test-checkouts","id":"9025825907","url":"https://github.com/DataDog/repo/actions/runs/3296065853/jobs/5435334930"},"status":"error"},"start":1666342307000000000},"ci_level":"job","tags":["source:apm","source:apm"]}},{"id":"AgAAAYP5wmg4dbfjZwAAAAAAAAAYAAAAAEFZUDV3bWc0QUFBX0RBNlJkS1RqWkNLSAAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx","type":"cipipeline","attributes":{"attributes":{"duration":29000000000,"github":{"conclusion":"failure","node_group":"GitHub - Actions","html_url":"https://github.com/DataDog/repo","run_attempt":"1","app_id":"128890"},"git":{"commit":{"sha":"62bd7b957a4db5b6926ca570b087b3cfdb9f05a7"},"repository_url":"https://github.com/DataDog/repo.git","repository":{"path":"/DataDog/repo.git","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"juanjux/APPSEC-6399-only-report-actorip-on-attack-part2"},"ci":{"pipeline":{"name":"Framework - tests","id":"3296098174-1"},"provider":{"instance":"github-actions","name":"github"},"step":{"name":"Run - tests"},"job":{"name":"starlette-testsuite-0_17_1","id":"9025869107"},"status":"error"},"start":1666342582000000000},"ci_level":"step","tags":["source:apm","source:apm"]}},{"id":"AgAAAYP5wnAIdbfjbAAAAAAAAAAYAAAAAEFZUDV3bkFJQUFENkpheXhlTXJfS3lLSAAAACQAAAAAMDE4M2Y5YzUtYWUwZi00MzFhLWI0MWItOGU2MDg1NDM3MzAx","type":"cipipeline","attributes":{"attributes":{"duration":164000000000,"github":{"conclusion":"failure","node_group":"GitHub - Actions","html_url":"https://github.com/DataDog/repo","run_attempt":"1","app_id":"128890"},"git":{"commit":{"sha":"62bd7b957a4db5b6926ca570b087b3cfdb9f05a7"},"default_branch":"1.x","repository_url":"https://github.com/DataDog/repo.git","repository":{"path":"/DataDog/repo.git","scheme":"https","name":"DataDog/repo","host":"github.com","id":"github.com/DataDog/repo"},"branch":"juanjux/APPSEC-6399-only-report-actorip-on-attack-part2"},"ci":{"pipeline":{"name":"Framework - tests","id":"3296098174-1"},"node":{"labels":["ubuntu-latest"]},"provider":{"instance":"github-actions","name":"github"},"job":{"name":"starlette-testsuite-0_17_1","id":"9025869107","url":"https://github.com/DataDog/repo/actions/runs/3296098174/jobs/5435368427"},"status":"error"},"start":1666342449000000000},"ci_level":"job","tags":["source:apm","source:apm"]}}],"meta":{"page":{"after":"eyJhZnRlciI6IkFnQUFBWVA1d25BSWRiZmpiQUFBQUFBQUFBQVlBQUFBQUVGWlVEVjNia0ZKUVVGRU5rcGhlWGhsVFhKZlMzbExTQUFBQUNRQUFBQUFNREU0TTJZNVl6VXRZV1V3WmkwME16RmhMV0kwTVdJdE9HVTJNRGcxTkRNM016QXgifQ"}},"links":{"next":"https://api.datadoghq.com/api/v2/ci/pipelines/events?filter%5Bfrom%5D=now-15m&filter%5Bquery%5D=%40ci.provider.name%3Agithub+AND+%40ci.status%3Aerror&filter%5Bto%5D=now&page%5Bcursor%5D=eyJhZnRlciI6IkFnQUFBWVA1d25BSWRiZmpiQUFBQUFBQUFBQVlBQUFBQUVGWlVEVjNia0ZKUVVGRU5rcGhlWGhsVFhKZlMzbExTQUFBQUNRQUFBQUFNREU0TTJZNVl6VXRZV1V3WmkwME16RmhMV0kwTVdJdE9HVTJNRGcxTkRNM016QXgifQ&page%5Blimit%5D=5&sort=timestamp"}} + string: '{"data":[],"meta":{"elapsed":20,"request_id":"pddv1ChZSTVpjd2Q0MlI2LVVBNjVTYlhFUThBIi0KHQuJgBOuQyr2rULJokHKzwf2zKDYmaOmEm5TrJuvEgyvH4LB-7WWiTQznlw","status":"done"}} ' headers: diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen index f80fdc73b8c2..9ea3b8ed04d8 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.frozen @@ -1 +1 @@ -2023-06-22T08:08:28.046Z \ No newline at end of file +2024-11-25T20:08:41.018Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.yml index 0d72f738b127..b7bf9d5c2d02 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.yml +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-event-returns-Request-accepted-for-processing-response.yml @@ -1,10 +1,10 @@ http_interactions: -- recorded_at: Thu, 22 Jun 2023 08:08:28 GMT +- recorded_at: Mon, 25 Nov 2024 20:08:41 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"resource":{"end":"2023-06-22T08:07:58.046Z","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":"2023-06-22T08:06:28.046Z","status":"success","unique_id":"3eacb6f3-ff04-4e10-8a9c-46e6d054024a","url":"https://my-ci-provider.example/pipelines/my-pipeline/run/1"}},"type":"cipipeline_resource_request"}}' + string: '{"data":{"attributes":{"resource":{"end":"2024-11-25T20:08:11.018Z","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":"2024-11-25T20:06:41.018Z","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: Accept: - application/json diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen index bdbb925c5b24..ad34df9881f9 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.frozen @@ -1 +1 @@ -2023-09-27T09:29:38.798Z \ No newline at end of file +2024-11-25T20:08:41.167Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.yml index 7e3c9ac85d94..d5a921ee47ef 100644 --- a/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.yml +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-pipeline-job-event-returns-Request-accepted-for-processing-response.yml @@ -1,10 +1,10 @@ http_interactions: -- recorded_at: Wed, 27 Sep 2023 09:29:38 GMT +- recorded_at: Mon, 25 Nov 2024 20:08:41 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"resource":{"end":"2023-09-27T09:29:08.798Z","id":"cf9456de-8b9e-4c27-aa79-27b1e78c1a33","level":"job","name":"Build - image","pipeline_name":"Deploy to AWS","pipeline_unique_id":"3eacb6f3-ff04-4e10-8a9c-46e6d054024a","start":"2023-09-27T09:27:38.798Z","status":"error","url":"https://my-ci-provider.example/jobs/my-jobs/run/1"}},"type":"cipipeline_resource_request"}}' + string: '{"data":{"attributes":{"resource":{"end":"2024-11-25T20:08:11.167Z","id":"cf9456de-8b9e-4c27-aa79-27b1e78c1a33","level":"job","name":"Build + image","pipeline_name":"Deploy to AWS","pipeline_unique_id":"3eacb6f3-ff04-4e10-8a9c-46e6d054024a","start":"2024-11-25T20:06:41.167Z","status":"error","url":"https://my-ci-provider.example/jobs/my-jobs/run/1"}},"type":"cipipeline_resource_request"}}' headers: Accept: - application/json diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen b/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen new file mode 100644 index 000000000000..229caddd7a60 --- /dev/null +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.frozen @@ -0,0 +1 @@ +2024-11-25T20:08:41.317Z \ No newline at end of file diff --git a/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.yml b/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.yml new file mode 100644 index 000000000000..82d1e3acb437 --- /dev/null +++ b/cassettes/features/v2/ci_visibility_pipelines/Send-running-pipeline-event-returns-Request-accepted-for-processing-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Mon, 25 Nov 2024 20:08:41 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"resource":{"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":"2024-11-25T20:06:41.317Z","status":"running","unique_id":"3eacb6f3-ff04-4e10-8a9c-46e6d054024a","url":"https://my-ci-provider.example/pipelines/my-pipeline/run/1"}},"type":"cipipeline_resource_request"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/ci/pipeline + response: + body: + encoding: UTF-8 + string: '{"data":null}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb index 71deaa7cb133..a673b3523aeb 100644 --- a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent.rb @@ -6,15 +6,15 @@ body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({ data: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({ attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({ - resource: DatadogAPIClient::V2::CIAppPipelineEventPipeline.new({ - _end: (Time.now + -30), + resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({ level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE, + unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", name: "Deploy to AWS", - partial_retry: false, + url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1", start: (Time.now + -120), + _end: (Time.now + -30), status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS, - unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", - url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1", + partial_retry: false, git: DatadogAPIClient::V2::CIAppGitInfo.new({ repository_url: "https://github.com/DataDog/datadog-agent", sha: "7f263865994b76066c4612fd1965215e7dcb4cd2", diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb index 9fce433633c9..c079a135968a 100644 --- a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_129899466.rb @@ -7,14 +7,14 @@ data: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({ attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({ resource: DatadogAPIClient::V2::CIAppPipelineEventJob.new({ - _end: (Time.now + -30), level: DatadogAPIClient::V2::CIAppPipelineEventJobLevel::JOB, - name: "Build image", - start: (Time.now + -120), - status: DatadogAPIClient::V2::CIAppPipelineEventJobStatus::ERROR, id: "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", + name: "Build image", pipeline_unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", pipeline_name: "Deploy to AWS", + start: (Time.now + -120), + _end: (Time.now + -30), + status: DatadogAPIClient::V2::CIAppPipelineEventJobStatus::ERROR, url: "https://my-ci-provider.example/jobs/my-jobs/run/1", }), }), diff --git a/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2341150096.rb b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2341150096.rb new file mode 100644 index 000000000000..3bc4801b9e0d --- /dev/null +++ b/examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_2341150096.rb @@ -0,0 +1,27 @@ +# Send running pipeline event returns "Request accepted for processing" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new + +body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({ + data: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({ + attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({ + resource: DatadogAPIClient::V2::CIAppPipelineEventInProgressPipeline.new({ + level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE, + unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", + name: "Deploy to AWS", + url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1", + start: (Time.now + -120), + status: DatadogAPIClient::V2::CIAppPipelineEventPipelineInProgressStatus::RUNNING, + partial_retry: false, + git: DatadogAPIClient::V2::CIAppGitInfo.new({ + repository_url: "https://github.com/DataDog/datadog-agent", + sha: "7f263865994b76066c4612fd1965215e7dcb4cd2", + author_email: "john.doe@email.com", + }), + }), + }), + type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST, + }), +}) +p api_instance.create_ci_app_pipeline_event(body) diff --git a/features/v2/ci_visibility_pipelines.feature b/features/v2/ci_visibility_pipelines.feature index 71dcea8c15a9..7f7079507233 100644 --- a/features/v2/ci_visibility_pipelines.feature +++ b/features/v2/ci_visibility_pipelines.feature @@ -104,13 +104,20 @@ Feature: CI Visibility Pipelines @team:Datadog/ci-app-backend Scenario: Send pipeline event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request - And body with value {"data": {"attributes": {"resource": {"end": "{{ timeISO('now - 30s') }}", "level": "pipeline", "name": "Deploy to AWS", "partial_retry": false, "start": "{{ timeISO('now - 120s') }}", "status": "success", "unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","git":{"repository_url":"https://github.com/DataDog/datadog-agent","sha":"7f263865994b76066c4612fd1965215e7dcb4cd2","author_email":"john.doe@email.com"}}}, "type": "cipipeline_resource_request"}} + And body with value {"data": {"attributes": {"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 - @team:Datadog/ci-app-backend + @skip @team:Datadog/ci-app-backend Scenario: Send pipeline job event returns "Request accepted for processing" response Given new "CreateCIAppPipelineEvent" request - And body with value {"data": {"attributes": {"resource": {"end": "{{ timeISO('now - 30s') }}", "level": "job", "name": "Build image", "start": "{{ timeISO('now - 120s') }}", "status": "error", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "url": "https://my-ci-provider.example/jobs/my-jobs/run/1"}}, "type": "cipipeline_resource_request"}} + And body with value {"data": {"attributes": {"resource": {"level": "job", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "name": "Build image", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "start": "{{ timeISO('now - 120s') }}", "end": "{{ timeISO('now - 30s') }}", "status": "error", "url": "https://my-ci-provider.example/jobs/my-jobs/run/1"}}, "type": "cipipeline_resource_request"}} + When the request is sent + Then the response status is 202 Request accepted for processing + + @team:Datadog/ci-app-backend + Scenario: Send running pipeline event returns "Request accepted for processing" response + Given new "CreateCIAppPipelineEvent" request + And body with value {"data": {"attributes": {"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') }}","status": "running","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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 7389ea3b544e..92edeca70319 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1114,11 +1114,14 @@ def overrides "v2.ci_app_host_info" => "CIAppHostInfo", "v2.ci_app_pipeline_event" => "CIAppPipelineEvent", "v2.ci_app_pipeline_event_attributes" => "CIAppPipelineEventAttributes", + "v2.ci_app_pipeline_event_finished_pipeline" => "CIAppPipelineEventFinishedPipeline", + "v2.ci_app_pipeline_event_in_progress_pipeline" => "CIAppPipelineEventInProgressPipeline", "v2.ci_app_pipeline_event_job" => "CIAppPipelineEventJob", "v2.ci_app_pipeline_event_job_level" => "CIAppPipelineEventJobLevel", "v2.ci_app_pipeline_event_job_status" => "CIAppPipelineEventJobStatus", "v2.ci_app_pipeline_event_parent_pipeline" => "CIAppPipelineEventParentPipeline", "v2.ci_app_pipeline_event_pipeline" => "CIAppPipelineEventPipeline", + "v2.ci_app_pipeline_event_pipeline_in_progress_status" => "CIAppPipelineEventPipelineInProgressStatus", "v2.ci_app_pipeline_event_pipeline_level" => "CIAppPipelineEventPipelineLevel", "v2.ci_app_pipeline_event_pipeline_status" => "CIAppPipelineEventPipelineStatus", "v2.ci_app_pipeline_event_previous_pipeline" => "CIAppPipelineEventPreviousPipeline", diff --git a/lib/datadog_api_client/v2/models/ci_app_pipeline_event_finished_pipeline.rb b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_finished_pipeline.rb new file mode 100644 index 000000000000..1abe144ae479 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_finished_pipeline.rb @@ -0,0 +1,427 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Details of a finished pipeline. + class CIAppPipelineEventFinishedPipeline + include BaseGenericModel + + # Time when the pipeline run finished. It cannot be older than 18 hours in the past from the current time. The time format must be RFC3339. + attr_reader :_end + + # Contains information of the CI error. + attr_accessor :error + + # If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. + # Note that either `tag` or `branch` has to be provided, but not both. + attr_accessor :git + + # Whether or not the pipeline was triggered manually by the user. + attr_accessor :is_manual + + # Whether or not the pipeline was resumed after being blocked. + attr_accessor :is_resumed + + # Used to distinguish between pipelines, stages, jobs, and steps. + attr_reader :level + + # A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + attr_accessor :metrics + + # Name of the pipeline. All pipeline runs for the builds should have the same name. + attr_reader :name + + # Contains information of the host running the pipeline, stage, job, or step. + attr_accessor :node + + # A map of key-value parameters or environment variables that were defined for the pipeline. + attr_accessor :parameters + + # If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. + attr_accessor :parent_pipeline + + # Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one + # which only runs a subset of the original jobs. + attr_reader :partial_retry + + # Any ID used in the provider to identify the pipeline run even if it is not unique across retries. + # If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. + attr_accessor :pipeline_id + + # If the pipeline is a retry, this should contain the details of the previous attempt. + attr_accessor :previous_attempt + + # The queue time in milliseconds, if applicable. + attr_reader :queue_time + + # Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. + attr_reader :start + + # The final status of the pipeline. + attr_reader :status + + # A list of user-defined tags. The tags must follow the `key:value` pattern. + attr_accessor :tags + + # UUID of the pipeline run. The ID has to be unique across retries and pipelines, + # including partial retries. + attr_reader :unique_id + + # The URL to look at the pipeline in the CI provider UI. + attr_reader :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_end' => :'end', + :'error' => :'error', + :'git' => :'git', + :'is_manual' => :'is_manual', + :'is_resumed' => :'is_resumed', + :'level' => :'level', + :'metrics' => :'metrics', + :'name' => :'name', + :'node' => :'node', + :'parameters' => :'parameters', + :'parent_pipeline' => :'parent_pipeline', + :'partial_retry' => :'partial_retry', + :'pipeline_id' => :'pipeline_id', + :'previous_attempt' => :'previous_attempt', + :'queue_time' => :'queue_time', + :'start' => :'start', + :'status' => :'status', + :'tags' => :'tags', + :'unique_id' => :'unique_id', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_end' => :'Time', + :'error' => :'CIAppCIError', + :'git' => :'CIAppGitInfo', + :'is_manual' => :'Boolean', + :'is_resumed' => :'Boolean', + :'level' => :'CIAppPipelineEventPipelineLevel', + :'metrics' => :'Array', + :'name' => :'String', + :'node' => :'CIAppHostInfo', + :'parameters' => :'Hash', + :'parent_pipeline' => :'CIAppPipelineEventParentPipeline', + :'partial_retry' => :'Boolean', + :'pipeline_id' => :'String', + :'previous_attempt' => :'CIAppPipelineEventPreviousPipeline', + :'queue_time' => :'Integer', + :'start' => :'Time', + :'status' => :'CIAppPipelineEventPipelineStatus', + :'tags' => :'Array', + :'unique_id' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'error', + :'git', + :'is_manual', + :'is_resumed', + :'metrics', + :'node', + :'parameters', + :'parent_pipeline', + :'previous_attempt', + :'queue_time', + :'tags', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'git') + self.git = attributes[:'git'] + end + + if attributes.key?(:'is_manual') + self.is_manual = attributes[:'is_manual'] + end + + if attributes.key?(:'is_resumed') + self.is_resumed = attributes[:'is_resumed'] + end + + if attributes.key?(:'level') + self.level = attributes[:'level'] + end + + if attributes.key?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'node') + self.node = attributes[:'node'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'parent_pipeline') + self.parent_pipeline = attributes[:'parent_pipeline'] + end + + if attributes.key?(:'partial_retry') + self.partial_retry = attributes[:'partial_retry'] + end + + if attributes.key?(:'pipeline_id') + self.pipeline_id = attributes[:'pipeline_id'] + end + + if attributes.key?(:'previous_attempt') + self.previous_attempt = attributes[:'previous_attempt'] + end + + if attributes.key?(:'queue_time') + self.queue_time = attributes[:'queue_time'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'unique_id') + self.unique_id = attributes[:'unique_id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @_end.nil? + return false if @level.nil? + return false if @name.nil? + return false if @partial_retry.nil? + return false if !@queue_time.nil? && @queue_time < 0 + return false if @start.nil? + return false if @status.nil? + return false if @unique_id.nil? + return false if @url.nil? + true + end + + # Custom attribute writer method with validation + # @param _end [Object] Object to be assigned + # @!visibility private + def _end=(_end) + if _end.nil? + fail ArgumentError, 'invalid value for "_end", _end cannot be nil.' + end + @_end = _end + end + + # Custom attribute writer method with validation + # @param level [Object] Object to be assigned + # @!visibility private + def level=(level) + if level.nil? + fail ArgumentError, 'invalid value for "level", level cannot be nil.' + end + @level = level + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param partial_retry [Object] Object to be assigned + # @!visibility private + def partial_retry=(partial_retry) + if partial_retry.nil? + fail ArgumentError, 'invalid value for "partial_retry", partial_retry cannot be nil.' + end + @partial_retry = partial_retry + end + + # Custom attribute writer method with validation + # @param queue_time [Object] Object to be assigned + # @!visibility private + def queue_time=(queue_time) + if !queue_time.nil? && queue_time < 0 + fail ArgumentError, 'invalid value for "queue_time", must be greater than or equal to 0.' + end + @queue_time = queue_time + end + + # Custom attribute writer method with validation + # @param start [Object] Object to be assigned + # @!visibility private + def start=(start) + if start.nil? + fail ArgumentError, 'invalid value for "start", start cannot be nil.' + end + @start = start + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param unique_id [Object] Object to be assigned + # @!visibility private + def unique_id=(unique_id) + if unique_id.nil? + fail ArgumentError, 'invalid value for "unique_id", unique_id cannot be nil.' + end + @unique_id = unique_id + end + + # Custom attribute writer method with validation + # @param url [Object] Object to be assigned + # @!visibility private + def url=(url) + if url.nil? + fail ArgumentError, 'invalid value for "url", url cannot be nil.' + end + @url = url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _end == o._end && + error == o.error && + git == o.git && + is_manual == o.is_manual && + is_resumed == o.is_resumed && + level == o.level && + metrics == o.metrics && + name == o.name && + node == o.node && + parameters == o.parameters && + parent_pipeline == o.parent_pipeline && + partial_retry == o.partial_retry && + pipeline_id == o.pipeline_id && + previous_attempt == o.previous_attempt && + queue_time == o.queue_time && + start == o.start && + status == o.status && + tags == o.tags && + unique_id == o.unique_id && + url == o.url + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_end, error, git, is_manual, is_resumed, level, metrics, name, node, parameters, parent_pipeline, partial_retry, pipeline_id, previous_attempt, queue_time, start, status, tags, unique_id, url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_pipeline_event_in_progress_pipeline.rb b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_in_progress_pipeline.rb new file mode 100644 index 000000000000..b718971804dd --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_in_progress_pipeline.rb @@ -0,0 +1,405 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Details of a running pipeline. + class CIAppPipelineEventInProgressPipeline + include BaseGenericModel + + # Contains information of the CI error. + attr_accessor :error + + # If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. + # Note that either `tag` or `branch` has to be provided, but not both. + attr_accessor :git + + # Whether or not the pipeline was triggered manually by the user. + attr_accessor :is_manual + + # Whether or not the pipeline was resumed after being blocked. + attr_accessor :is_resumed + + # Used to distinguish between pipelines, stages, jobs, and steps. + attr_reader :level + + # A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. + attr_accessor :metrics + + # Name of the pipeline. All pipeline runs for the builds should have the same name. + attr_reader :name + + # Contains information of the host running the pipeline, stage, job, or step. + attr_accessor :node + + # A map of key-value parameters or environment variables that were defined for the pipeline. + attr_accessor :parameters + + # If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. + attr_accessor :parent_pipeline + + # Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one + # which only runs a subset of the original jobs. + attr_reader :partial_retry + + # Any ID used in the provider to identify the pipeline run even if it is not unique across retries. + # If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. + attr_accessor :pipeline_id + + # If the pipeline is a retry, this should contain the details of the previous attempt. + attr_accessor :previous_attempt + + # The queue time in milliseconds, if applicable. + attr_reader :queue_time + + # Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. + attr_reader :start + + # The in progress status of the pipeline. + attr_reader :status + + # A list of user-defined tags. The tags must follow the `key:value` pattern. + attr_accessor :tags + + # UUID of the pipeline run. The ID has to be the same as the finished pipeline. + attr_reader :unique_id + + # The URL to look at the pipeline in the CI provider UI. + attr_reader :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'error' => :'error', + :'git' => :'git', + :'is_manual' => :'is_manual', + :'is_resumed' => :'is_resumed', + :'level' => :'level', + :'metrics' => :'metrics', + :'name' => :'name', + :'node' => :'node', + :'parameters' => :'parameters', + :'parent_pipeline' => :'parent_pipeline', + :'partial_retry' => :'partial_retry', + :'pipeline_id' => :'pipeline_id', + :'previous_attempt' => :'previous_attempt', + :'queue_time' => :'queue_time', + :'start' => :'start', + :'status' => :'status', + :'tags' => :'tags', + :'unique_id' => :'unique_id', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'error' => :'CIAppCIError', + :'git' => :'CIAppGitInfo', + :'is_manual' => :'Boolean', + :'is_resumed' => :'Boolean', + :'level' => :'CIAppPipelineEventPipelineLevel', + :'metrics' => :'Array', + :'name' => :'String', + :'node' => :'CIAppHostInfo', + :'parameters' => :'Hash', + :'parent_pipeline' => :'CIAppPipelineEventParentPipeline', + :'partial_retry' => :'Boolean', + :'pipeline_id' => :'String', + :'previous_attempt' => :'CIAppPipelineEventPreviousPipeline', + :'queue_time' => :'Integer', + :'start' => :'Time', + :'status' => :'CIAppPipelineEventPipelineInProgressStatus', + :'tags' => :'Array', + :'unique_id' => :'String', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'error', + :'git', + :'is_manual', + :'is_resumed', + :'metrics', + :'node', + :'parameters', + :'parent_pipeline', + :'previous_attempt', + :'queue_time', + :'tags', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppPipelineEventInProgressPipeline` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'git') + self.git = attributes[:'git'] + end + + if attributes.key?(:'is_manual') + self.is_manual = attributes[:'is_manual'] + end + + if attributes.key?(:'is_resumed') + self.is_resumed = attributes[:'is_resumed'] + end + + if attributes.key?(:'level') + self.level = attributes[:'level'] + end + + if attributes.key?(:'metrics') + if (value = attributes[:'metrics']).is_a?(Array) + self.metrics = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'node') + self.node = attributes[:'node'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + + if attributes.key?(:'parent_pipeline') + self.parent_pipeline = attributes[:'parent_pipeline'] + end + + if attributes.key?(:'partial_retry') + self.partial_retry = attributes[:'partial_retry'] + end + + if attributes.key?(:'pipeline_id') + self.pipeline_id = attributes[:'pipeline_id'] + end + + if attributes.key?(:'previous_attempt') + self.previous_attempt = attributes[:'previous_attempt'] + end + + if attributes.key?(:'queue_time') + self.queue_time = attributes[:'queue_time'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'unique_id') + self.unique_id = attributes[:'unique_id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @level.nil? + return false if @name.nil? + return false if @partial_retry.nil? + return false if !@queue_time.nil? && @queue_time < 0 + return false if @start.nil? + return false if @status.nil? + return false if @unique_id.nil? + return false if @url.nil? + true + end + + # Custom attribute writer method with validation + # @param level [Object] Object to be assigned + # @!visibility private + def level=(level) + if level.nil? + fail ArgumentError, 'invalid value for "level", level cannot be nil.' + end + @level = level + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param partial_retry [Object] Object to be assigned + # @!visibility private + def partial_retry=(partial_retry) + if partial_retry.nil? + fail ArgumentError, 'invalid value for "partial_retry", partial_retry cannot be nil.' + end + @partial_retry = partial_retry + end + + # Custom attribute writer method with validation + # @param queue_time [Object] Object to be assigned + # @!visibility private + def queue_time=(queue_time) + if !queue_time.nil? && queue_time < 0 + fail ArgumentError, 'invalid value for "queue_time", must be greater than or equal to 0.' + end + @queue_time = queue_time + end + + # Custom attribute writer method with validation + # @param start [Object] Object to be assigned + # @!visibility private + def start=(start) + if start.nil? + fail ArgumentError, 'invalid value for "start", start cannot be nil.' + end + @start = start + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param unique_id [Object] Object to be assigned + # @!visibility private + def unique_id=(unique_id) + if unique_id.nil? + fail ArgumentError, 'invalid value for "unique_id", unique_id cannot be nil.' + end + @unique_id = unique_id + end + + # Custom attribute writer method with validation + # @param url [Object] Object to be assigned + # @!visibility private + def url=(url) + if url.nil? + fail ArgumentError, 'invalid value for "url", url cannot be nil.' + end + @url = url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + git == o.git && + is_manual == o.is_manual && + is_resumed == o.is_resumed && + level == o.level && + metrics == o.metrics && + name == o.name && + node == o.node && + parameters == o.parameters && + parent_pipeline == o.parent_pipeline && + partial_retry == o.partial_retry && + pipeline_id == o.pipeline_id && + previous_attempt == o.previous_attempt && + queue_time == o.queue_time && + start == o.start && + status == o.status && + tags == o.tags && + unique_id == o.unique_id && + url == o.url + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [error, git, is_manual, is_resumed, level, metrics, name, node, parameters, parent_pipeline, partial_retry, pipeline_id, previous_attempt, queue_time, start, status, tags, unique_id, url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline.rb b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline.rb index 0e9e1afd3878..b01251633db5 100644 --- a/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline.rb +++ b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline.rb @@ -18,410 +18,46 @@ module DatadogAPIClient::V2 # Details of the top level pipeline, build, or workflow of your CI. - class CIAppPipelineEventPipeline - include BaseGenericModel - - # Time when the pipeline run finished. It cannot be older than 18 hours in the past from the current time. The time format must be RFC3339. - attr_reader :_end - - # Contains information of the CI error. - attr_accessor :error - - # If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. - # Note that either `tag` or `branch` has to be provided, but not both. - attr_accessor :git - - # Whether or not the pipeline was triggered manually by the user. - attr_accessor :is_manual - - # Whether or not the pipeline was resumed after being blocked. - attr_accessor :is_resumed - - # Used to distinguish between pipelines, stages, jobs, and steps. - attr_reader :level - - # A list of user-defined metrics. The metrics must follow the `key:value` pattern and the value must be numeric. - attr_accessor :metrics - - # Name of the pipeline. All pipeline runs for the builds should have the same name. - attr_reader :name - - # Contains information of the host running the pipeline, stage, job, or step. - attr_accessor :node - - # A map of key-value parameters or environment variables that were defined for the pipeline. - attr_accessor :parameters - - # If the pipeline is triggered as child of another pipeline, this should contain the details of the parent pipeline. - attr_accessor :parent_pipeline - - # Whether or not the pipeline was a partial retry of a previous attempt. A partial retry is one - # which only runs a subset of the original jobs. - attr_reader :partial_retry - - # Any ID used in the provider to identify the pipeline run even if it is not unique across retries. - # If the `pipeline_id` is unique, then both `unique_id` and `pipeline_id` can be set to the same value. - attr_accessor :pipeline_id - - # If the pipeline is a retry, this should contain the details of the previous attempt. - attr_accessor :previous_attempt - - # The queue time in milliseconds, if applicable. - attr_reader :queue_time - - # Time when the pipeline run started (it should not include any queue time). The time format must be RFC3339. - attr_reader :start - - # The final status of the pipeline. - attr_reader :status - - # A list of user-defined tags. The tags must follow the `key:value` pattern. - attr_accessor :tags - - # UUID of the pipeline run. The ID has to be unique across retries and pipelines, - # including partial retries. - attr_reader :unique_id - - # The URL to look at the pipeline in the CI provider UI. - attr_reader :url - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'_end' => :'end', - :'error' => :'error', - :'git' => :'git', - :'is_manual' => :'is_manual', - :'is_resumed' => :'is_resumed', - :'level' => :'level', - :'metrics' => :'metrics', - :'name' => :'name', - :'node' => :'node', - :'parameters' => :'parameters', - :'parent_pipeline' => :'parent_pipeline', - :'partial_retry' => :'partial_retry', - :'pipeline_id' => :'pipeline_id', - :'previous_attempt' => :'previous_attempt', - :'queue_time' => :'queue_time', - :'start' => :'start', - :'status' => :'status', - :'tags' => :'tags', - :'unique_id' => :'unique_id', - :'url' => :'url' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'_end' => :'Time', - :'error' => :'CIAppCIError', - :'git' => :'CIAppGitInfo', - :'is_manual' => :'Boolean', - :'is_resumed' => :'Boolean', - :'level' => :'CIAppPipelineEventPipelineLevel', - :'metrics' => :'Array', - :'name' => :'String', - :'node' => :'CIAppHostInfo', - :'parameters' => :'Hash', - :'parent_pipeline' => :'CIAppPipelineEventParentPipeline', - :'partial_retry' => :'Boolean', - :'pipeline_id' => :'String', - :'previous_attempt' => :'CIAppPipelineEventPreviousPipeline', - :'queue_time' => :'Integer', - :'start' => :'Time', - :'status' => :'CIAppPipelineEventPipelineStatus', - :'tags' => :'Array', - :'unique_id' => :'String', - :'url' => :'String' - } - end - - # List of attributes with nullable: true - # @!visibility private - def self.openapi_nullable - Set.new([ - :'error', - :'git', - :'is_manual', - :'is_resumed', - :'metrics', - :'node', - :'parameters', - :'parent_pipeline', - :'previous_attempt', - :'queue_time', - :'tags', - ]) - end - - # Initializes the object - # @param attributes [Hash] Model attributes in the form of hash - # @!visibility private - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppPipelineEventPipeline` initialize method" - end - - self.additional_properties = {} - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - self.additional_properties[k.to_sym] = v - else - h[k.to_sym] = v - end - } - - if attributes.key?(:'_end') - self._end = attributes[:'_end'] - end - - if attributes.key?(:'error') - self.error = attributes[:'error'] - end - - if attributes.key?(:'git') - self.git = attributes[:'git'] - end - - if attributes.key?(:'is_manual') - self.is_manual = attributes[:'is_manual'] - end - - if attributes.key?(:'is_resumed') - self.is_resumed = attributes[:'is_resumed'] - end - - if attributes.key?(:'level') - self.level = attributes[:'level'] - end - - if attributes.key?(:'metrics') - if (value = attributes[:'metrics']).is_a?(Array) - self.metrics = value - end - end - - if attributes.key?(:'name') - self.name = attributes[:'name'] - end - - if attributes.key?(:'node') - self.node = attributes[:'node'] - end - - if attributes.key?(:'parameters') - self.parameters = attributes[:'parameters'] - end - - if attributes.key?(:'parent_pipeline') - self.parent_pipeline = attributes[:'parent_pipeline'] - end - - if attributes.key?(:'partial_retry') - self.partial_retry = attributes[:'partial_retry'] - end - - if attributes.key?(:'pipeline_id') - self.pipeline_id = attributes[:'pipeline_id'] - end - - if attributes.key?(:'previous_attempt') - self.previous_attempt = attributes[:'previous_attempt'] - end - - if attributes.key?(:'queue_time') - self.queue_time = attributes[:'queue_time'] - end - - if attributes.key?(:'start') - self.start = attributes[:'start'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'tags') - if (value = attributes[:'tags']).is_a?(Array) - self.tags = value + module CIAppPipelineEventPipeline + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'CIAppPipelineEventFinishedPipeline', + :'CIAppPipelineEventInProgressPipeline' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - end - if attributes.key?(:'unique_id') - self.unique_id = attributes[:'unique_id'] - end - - if attributes.key?(:'url') - self.url = attributes[:'url'] - end - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @_end.nil? - return false if @level.nil? - return false if @name.nil? - return false if @partial_retry.nil? - return false if !@queue_time.nil? && @queue_time < 0 - return false if @start.nil? - return false if @status.nil? - return false if @unique_id.nil? - return false if @url.nil? - true - end - - # Custom attribute writer method with validation - # @param _end [Object] Object to be assigned - # @!visibility private - def _end=(_end) - if _end.nil? - fail ArgumentError, 'invalid value for "_end", _end cannot be nil.' - end - @_end = _end - end - - # Custom attribute writer method with validation - # @param level [Object] Object to be assigned - # @!visibility private - def level=(level) - if level.nil? - fail ArgumentError, 'invalid value for "level", level cannot be nil.' - end - @level = level - end - - # Custom attribute writer method with validation - # @param name [Object] Object to be assigned - # @!visibility private - def name=(name) - if name.nil? - fail ArgumentError, 'invalid value for "name", name cannot be nil.' - end - @name = name - end - - # Custom attribute writer method with validation - # @param partial_retry [Object] Object to be assigned - # @!visibility private - def partial_retry=(partial_retry) - if partial_retry.nil? - fail ArgumentError, 'invalid value for "partial_retry", partial_retry cannot be nil.' - end - @partial_retry = partial_retry - end - - # Custom attribute writer method with validation - # @param queue_time [Object] Object to be assigned - # @!visibility private - def queue_time=(queue_time) - if !queue_time.nil? && queue_time < 0 - fail ArgumentError, 'invalid value for "queue_time", must be greater than or equal to 0.' - end - @queue_time = queue_time - end - - # Custom attribute writer method with validation - # @param start [Object] Object to be assigned - # @!visibility private - def start=(start) - if start.nil? - fail ArgumentError, 'invalid value for "start", start cannot be nil.' - end - @start = start - end - - # Custom attribute writer method with validation - # @param status [Object] Object to be assigned - # @!visibility private - def status=(status) - if status.nil? - fail ArgumentError, 'invalid value for "status", status cannot be nil.' - end - @status = status - end - - # Custom attribute writer method with validation - # @param unique_id [Object] Object to be assigned - # @!visibility private - def unique_id=(unique_id) - if unique_id.nil? - fail ArgumentError, 'invalid value for "unique_id", unique_id cannot be nil.' - end - @unique_id = unique_id - end - - # Custom attribute writer method with validation - # @param url [Object] Object to be assigned - # @!visibility private - def url=(url) - if url.nil? - fail ArgumentError, 'invalid value for "url", url cannot be nil.' - end - @url = url - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) end - - hash[param] = _to_hash(value) - end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - _end == o._end && - error == o.error && - git == o.git && - is_manual == o.is_manual && - is_resumed == o.is_resumed && - level == o.level && - metrics == o.metrics && - name == o.name && - node == o.node && - parameters == o.parameters && - parent_pipeline == o.parent_pipeline && - partial_retry == o.partial_retry && - pipeline_id == o.pipeline_id && - previous_attempt == o.previous_attempt && - queue_time == o.queue_time && - start == o.start && - status == o.status && - tags == o.tags && - unique_id == o.unique_id && - url == o.url - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [_end, error, git, is_manual, is_resumed, level, metrics, name, node, parameters, parent_pipeline, partial_retry, pipeline_id, previous_attempt, queue_time, start, status, tags, unique_id, url].hash end end end diff --git a/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline_in_progress_status.rb b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline_in_progress_status.rb new file mode 100644 index 000000000000..5335a01fac85 --- /dev/null +++ b/lib/datadog_api_client/v2/models/ci_app_pipeline_event_pipeline_in_progress_status.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The in progress status of the pipeline. + class CIAppPipelineEventPipelineInProgressStatus + include BaseEnumModel + + RUNNING = "running".freeze + end +end