diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3cabe03bba..ea6d9fe947 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38523,6 +38523,157 @@ components: format: int64 type: integer type: object + FileCoverageLines: + description: Per-file line coverage data including executable, covered, and added lines. + properties: + added_lines: + description: Line numbers that were added in the specified scope (for example, in a PR diff). + example: [11, 12] + items: + format: int64 + type: integer + type: array + covered_lines: + description: Line numbers that were covered by tests. + example: [10, 11, 15] + items: + format: int64 + type: integer + type: array + executable_lines: + description: Line numbers that are executable (can be covered). + example: [10, 11, 12, 15, 20] + items: + format: int64 + type: integer + type: array + type: object + FilesCoverageAttributes: + description: Attributes of the per-file code coverage response. + properties: + base_commit_sha: + description: The SHA of the base commit used for comparison (for example, the merge base for a PR). + example: abc1234567890abcdef1234567890abcdef12345 + type: string + event_timestamp: + description: Unix timestamp (milliseconds) of the coverage event. + example: 1709564000000 + format: int64 + type: integer + files: + additionalProperties: + $ref: "#/components/schemas/FileCoverageLines" + description: Map of file paths to per-file coverage line data. + type: object + head_commit_sha: + description: The SHA of the head commit for which coverage was evaluated. + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + type: string + report_count: + description: Number of coverage reports evaluated. + example: 3 + format: int64 + type: integer + type: object + FilesCoverageData: + description: Data object for files coverage response. + properties: + attributes: + $ref: "#/components/schemas/FilesCoverageAttributes" + id: + description: Unique identifier for the files coverage response. + example: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: string + type: + $ref: "#/components/schemas/FilesCoverageResponseType" + type: object + FilesCoverageRequest: + description: Request object for getting per-file code coverage data. + properties: + data: + $ref: "#/components/schemas/FilesCoverageRequestData" + required: + - data + type: object + FilesCoverageRequestAttributes: + description: Attributes for requesting per-file code coverage data. Exactly one of `commit_sha`, `branch`, or `pr_number` must be provided. At most one of `service`, `codeowner`, or `flag` may be provided. + properties: + branch: + description: The branch name. + example: main + type: string + changed_only: + description: When true, return coverage data only for files that were changed in the specified scope. + example: true + type: boolean + codeowner: + description: Filter coverage by code owner. At most one of `service`, `codeowner`, or `flag` may be provided. + example: "@my-team" + type: string + commit_sha: + description: The commit SHA (40-character hexadecimal string). + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + pattern: "^[a-fA-F0-9]{40}$" + type: string + flag: + description: Filter coverage by coverage flag. At most one of `service`, `codeowner`, or `flag` may be provided. + example: unit-tests + type: string + pr_number: + description: The pull request number. Must be a positive integer. + example: 42 + format: int64 + minimum: 1 + type: integer + repository_id: + deprecated: true + description: "Deprecated: use `repository_url` instead. The repository URL." + example: github.com/datadog/shopist + minLength: 1 + type: string + repository_url: + description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + example: https://github.com/datadog/shopist + minLength: 1 + type: string + service: + description: Filter coverage by service name. At most one of `service`, `codeowner`, or `flag` may be provided. + example: my-service + type: string + type: object + FilesCoverageRequestData: + description: Data object for files coverage request. + properties: + attributes: + $ref: "#/components/schemas/FilesCoverageRequestAttributes" + type: + $ref: "#/components/schemas/FilesCoverageRequestType" + required: + - type + - attributes + type: object + FilesCoverageRequestType: + description: JSON:API type for files coverage request. The value must always be `ci_app_coverage_files_request`. + enum: + - ci_app_coverage_files_request + example: ci_app_coverage_files_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_FILES_REQUEST + FilesCoverageResponse: + description: Response object containing per-file code coverage data. + properties: + data: + $ref: "#/components/schemas/FilesCoverageData" + type: object + FilesCoverageResponseType: + description: JSON:API type for files coverage response. The value must always be `ci_app_coverage_files`. + enum: + - ci_app_coverage_files + example: ci_app_coverage_files + type: string + x-enum-varnames: + - CI_APP_COVERAGE_FILES FiltersPerProduct: description: Product-specific filters for the dataset. properties: @@ -79919,6 +80070,51 @@ components: type: string x-enum-varnames: - OWNERSHIP_UNTAGGED_FINDINGS + PRCoverageSummaryRequest: + description: Request object for getting code coverage summary for a pull request. + properties: + data: + $ref: "#/components/schemas/PRCoverageSummaryRequestData" + required: + - data + type: object + PRCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a pull request. + properties: + pr_number: + description: The pull request number. Must be a positive integer. + example: 42 + format: int64 + minimum: 1 + type: integer + repository_url: + description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`). + example: https://github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_url + - pr_number + type: object + PRCoverageSummaryRequestData: + description: Data object for PR summary request. + properties: + attributes: + $ref: "#/components/schemas/PRCoverageSummaryRequestAttributes" + type: + $ref: "#/components/schemas/PRCoverageSummaryRequestType" + required: + - type + - attributes + type: object + PRCoverageSummaryRequestType: + description: JSON:API type for PR coverage summary request. The value must always be `ci_app_coverage_pr_summary_request`. + enum: + - ci_app_coverage_pr_summary_request + example: ci_app_coverage_pr_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_PR_SUMMARY_REQUEST PageAnnotationsAttributes: description: Attributes of the annotations on a page. properties: @@ -132319,9 +132515,6 @@ paths: operator: OR permissions: - code_coverage_read - x-unstable: |- - **Note**: This endpoint is in preview and may be subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/code-coverage/commit/summary: post: description: |- @@ -132389,9 +132582,142 @@ paths: operator: OR permissions: - code_coverage_read - x-unstable: |- - **Note**: This endpoint is in preview and may be subject to change. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/code-coverage/files: + post: + description: |- + Retrieve per-file code coverage data for a specific commit, branch, or pull request. + Exactly one of `commit_sha`, `branch`, or `pr_number` must be provided. + Optionally filter by `service`, `codeowner`, or `flag` (at most one). + operationId: GetCodeCoverageFiles + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + changed_only: true + commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588 + repository_url: https://github.com/datadog/test-service + type: ci_app_coverage_files_request + schema: + $ref: "#/components/schemas/FilesCoverageRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + base_commit_sha: abc1234567890abcdef1234567890abcdef12345 + event_timestamp: 1709564000000 + files: + src/main.go: + added_lines: [11, 12] + covered_lines: [10, 11, 15] + executable_lines: [10, 11, 12, 15, 20] + head_commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588 + report_count: 3 + id: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: ci_app_coverage_files + schema: + $ref: "#/components/schemas/FilesCoverageResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get per-file code coverage data + tags: ["Code Coverage"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read + /api/v2/code-coverage/pr/summary: + post: + description: |- + Retrieve aggregated code coverage statistics for a specific pull request in a repository. + This endpoint provides overall coverage metrics as well as breakdowns by service + and code owner. + operationId: GetCodeCoveragePRSummary + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + pr_number: 42 + repository_url: https://github.com/datadog/test-service + type: ci_app_coverage_pr_summary_request + schema: + $ref: "#/components/schemas/PRCoverageSummaryRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + evaluated_flags_count: 3 + evaluated_reports_count: 5 + patch_coverage: 65.2 + total_coverage: 78.6 + id: ZGQxMjM0NV9wcl80Ml8xNzA5NTY0MDAw + type: ci_app_coverage_summary + schema: + $ref: "#/components/schemas/CoverageSummaryResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Internal server error + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_coverage_read + summary: Get code coverage summary for a pull request + tags: ["Code Coverage"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - code_coverage_read /api/v2/compliance_findings/rule_based_view: get: deprecated: true diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index c2a5e5aa47..23536c8398 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -15551,6 +15551,69 @@ datadog\_api\_client.v2.model.feature\_flags\_pagination\_meta\_page module :members: :show-inheritance: +datadog\_api\_client.v2.model.file\_coverage\_lines module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.file_coverage_lines + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_attributes module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_data module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_request module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_request\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_request\_data module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_request\_type module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.files\_coverage\_response\_type module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.files_coverage_response_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.filters\_per\_product module ---------------------------------------------------------- @@ -34724,6 +34787,34 @@ datadog\_api\_client.v2.model.powerpacks\_response\_meta\_pagination module :members: :show-inheritance: +datadog\_api\_client.v2.model.pr\_coverage\_summary\_request module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.pr_coverage_summary_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.pr\_coverage\_summary\_request\_attributes module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.pr_coverage_summary_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.pr\_coverage\_summary\_request\_data module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.pr_coverage_summary_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.pr\_coverage\_summary\_request\_type module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.pr_coverage_summary_request_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.preview\_entity\_response\_data module -------------------------------------------------------------------- diff --git a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.py b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.py index 0be7622552..c7e0cd630c 100644 --- a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.py +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.py @@ -23,7 +23,6 @@ ) configuration = Configuration() -configuration.unstable_operations["get_code_coverage_branch_summary"] = True with ApiClient(configuration) as api_client: api_instance = CodeCoverageApi(api_client) response = api_instance.get_code_coverage_branch_summary(body=body) diff --git a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.py b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.py index 3b482b091f..7db3f20905 100644 --- a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.py +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.py @@ -23,7 +23,6 @@ ) configuration = Configuration() -configuration.unstable_operations["get_code_coverage_commit_summary"] = True with ApiClient(configuration) as api_client: api_instance = CodeCoverageApi(api_client) response = api_instance.get_code_coverage_commit_summary(body=body) diff --git a/examples/v2/code-coverage/GetCodeCoverageFiles.py b/examples/v2/code-coverage/GetCodeCoverageFiles.py new file mode 100644 index 0000000000..db2f641df0 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageFiles.py @@ -0,0 +1,28 @@ +""" +Get per-file code coverage data returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.code_coverage_api import CodeCoverageApi +from datadog_api_client.v2.model.files_coverage_request import FilesCoverageRequest +from datadog_api_client.v2.model.files_coverage_request_attributes import FilesCoverageRequestAttributes +from datadog_api_client.v2.model.files_coverage_request_data import FilesCoverageRequestData +from datadog_api_client.v2.model.files_coverage_request_type import FilesCoverageRequestType + +body = FilesCoverageRequest( + data=FilesCoverageRequestData( + attributes=FilesCoverageRequestAttributes( + changed_only=True, + commit_sha="66adc9350f2cc9b250b69abddab733dd55e1a588", + repository_url="https://github.com/datadog/shopist", + ), + type=FilesCoverageRequestType.CI_APP_COVERAGE_FILES_REQUEST, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CodeCoverageApi(api_client) + response = api_instance.get_code_coverage_files(body=body) + + print(response) diff --git a/examples/v2/code-coverage/GetCodeCoveragePRSummary.py b/examples/v2/code-coverage/GetCodeCoveragePRSummary.py new file mode 100644 index 0000000000..c78dfd1527 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoveragePRSummary.py @@ -0,0 +1,27 @@ +""" +Get code coverage summary for a pull request returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.code_coverage_api import CodeCoverageApi +from datadog_api_client.v2.model.pr_coverage_summary_request import PRCoverageSummaryRequest +from datadog_api_client.v2.model.pr_coverage_summary_request_attributes import PRCoverageSummaryRequestAttributes +from datadog_api_client.v2.model.pr_coverage_summary_request_data import PRCoverageSummaryRequestData +from datadog_api_client.v2.model.pr_coverage_summary_request_type import PRCoverageSummaryRequestType + +body = PRCoverageSummaryRequest( + data=PRCoverageSummaryRequestData( + attributes=PRCoverageSummaryRequestAttributes( + pr_number=42, + repository_url="https://github.com/datadog/shopist", + ), + type=PRCoverageSummaryRequestType.CI_APP_COVERAGE_PR_SUMMARY_REQUEST, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = CodeCoverageApi(api_client) + response = api_instance.get_code_coverage_pr_summary(body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 9c01331488..1b5efc3966 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -431,8 +431,6 @@ def __init__( "v2.update_security_monitoring_integration_config": False, "v2.validate_security_monitoring_integration_config": False, "v2.validate_security_monitoring_integration_credentials": False, - "v2.get_code_coverage_branch_summary": False, - "v2.get_code_coverage_commit_summary": False, "v2.get_rule_based_view": False, "v2.get_commitments_commitment_list": False, "v2.get_commitments_coverage_scalar": False, diff --git a/src/datadog_api_client/v2/api/code_coverage_api.py b/src/datadog_api_client/v2/api/code_coverage_api.py index 27eb024463..01099a9245 100644 --- a/src/datadog_api_client/v2/api/code_coverage_api.py +++ b/src/datadog_api_client/v2/api/code_coverage_api.py @@ -10,6 +10,9 @@ from datadog_api_client.v2.model.coverage_summary_response import CoverageSummaryResponse from datadog_api_client.v2.model.branch_coverage_summary_request import BranchCoverageSummaryRequest from datadog_api_client.v2.model.commit_coverage_summary_request import CommitCoverageSummaryRequest +from datadog_api_client.v2.model.files_coverage_response import FilesCoverageResponse +from datadog_api_client.v2.model.files_coverage_request import FilesCoverageRequest +from datadog_api_client.v2.model.pr_coverage_summary_request import PRCoverageSummaryRequest class CodeCoverageApi: @@ -62,6 +65,46 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_code_coverage_files_endpoint = _Endpoint( + settings={ + "response_type": (FilesCoverageResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/code-coverage/files", + "operation_id": "get_code_coverage_files", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (FilesCoverageRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._get_code_coverage_pr_summary_endpoint = _Endpoint( + settings={ + "response_type": (CoverageSummaryResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/code-coverage/pr/summary", + "operation_id": "get_code_coverage_pr_summary", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (PRCoverageSummaryRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def get_code_coverage_branch_summary( self, body: BranchCoverageSummaryRequest, @@ -99,3 +142,39 @@ def get_code_coverage_commit_summary( kwargs["body"] = body return self._get_code_coverage_commit_summary_endpoint.call_with_http_info(**kwargs) + + def get_code_coverage_files( + self, + body: FilesCoverageRequest, + ) -> FilesCoverageResponse: + """Get per-file code coverage data. + + Retrieve per-file code coverage data for a specific commit, branch, or pull request. + Exactly one of ``commit_sha`` , ``branch`` , or ``pr_number`` must be provided. + Optionally filter by ``service`` , ``codeowner`` , or ``flag`` (at most one). + + :type body: FilesCoverageRequest + :rtype: FilesCoverageResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._get_code_coverage_files_endpoint.call_with_http_info(**kwargs) + + def get_code_coverage_pr_summary( + self, + body: PRCoverageSummaryRequest, + ) -> CoverageSummaryResponse: + """Get code coverage summary for a pull request. + + Retrieve aggregated code coverage statistics for a specific pull request in a repository. + This endpoint provides overall coverage metrics as well as breakdowns by service + and code owner. + + :type body: PRCoverageSummaryRequest + :rtype: CoverageSummaryResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._get_code_coverage_pr_summary_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/file_coverage_lines.py b/src/datadog_api_client/v2/model/file_coverage_lines.py new file mode 100644 index 0000000000..40da68c7e4 --- /dev/null +++ b/src/datadog_api_client/v2/model/file_coverage_lines.py @@ -0,0 +1,56 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class FileCoverageLines(ModelNormal): + @cached_property + def openapi_types(_): + return { + "added_lines": ([int],), + "covered_lines": ([int],), + "executable_lines": ([int],), + } + + attribute_map = { + "added_lines": "added_lines", + "covered_lines": "covered_lines", + "executable_lines": "executable_lines", + } + + def __init__( + self_, + added_lines: Union[List[int], UnsetType] = unset, + covered_lines: Union[List[int], UnsetType] = unset, + executable_lines: Union[List[int], UnsetType] = unset, + **kwargs, + ): + """ + Per-file line coverage data including executable, covered, and added lines. + + :param added_lines: Line numbers that were added in the specified scope (for example, in a PR diff). + :type added_lines: [int], optional + + :param covered_lines: Line numbers that were covered by tests. + :type covered_lines: [int], optional + + :param executable_lines: Line numbers that are executable (can be covered). + :type executable_lines: [int], optional + """ + if added_lines is not unset: + kwargs["added_lines"] = added_lines + if covered_lines is not unset: + kwargs["covered_lines"] = covered_lines + if executable_lines is not unset: + kwargs["executable_lines"] = executable_lines + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/files_coverage_attributes.py b/src/datadog_api_client/v2/model/files_coverage_attributes.py new file mode 100644 index 0000000000..01ab557b35 --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_attributes.py @@ -0,0 +1,78 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Dict, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.file_coverage_lines import FileCoverageLines + + +class FilesCoverageAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.file_coverage_lines import FileCoverageLines + + return { + "base_commit_sha": (str,), + "event_timestamp": (int,), + "files": ({str: (FileCoverageLines,)},), + "head_commit_sha": (str,), + "report_count": (int,), + } + + attribute_map = { + "base_commit_sha": "base_commit_sha", + "event_timestamp": "event_timestamp", + "files": "files", + "head_commit_sha": "head_commit_sha", + "report_count": "report_count", + } + + def __init__( + self_, + base_commit_sha: Union[str, UnsetType] = unset, + event_timestamp: Union[int, UnsetType] = unset, + files: Union[Dict[str, FileCoverageLines], UnsetType] = unset, + head_commit_sha: Union[str, UnsetType] = unset, + report_count: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of the per-file code coverage response. + + :param base_commit_sha: The SHA of the base commit used for comparison (for example, the merge base for a PR). + :type base_commit_sha: str, optional + + :param event_timestamp: Unix timestamp (milliseconds) of the coverage event. + :type event_timestamp: int, optional + + :param files: Map of file paths to per-file coverage line data. + :type files: {str: (FileCoverageLines,)}, optional + + :param head_commit_sha: The SHA of the head commit for which coverage was evaluated. + :type head_commit_sha: str, optional + + :param report_count: Number of coverage reports evaluated. + :type report_count: int, optional + """ + if base_commit_sha is not unset: + kwargs["base_commit_sha"] = base_commit_sha + if event_timestamp is not unset: + kwargs["event_timestamp"] = event_timestamp + if files is not unset: + kwargs["files"] = files + if head_commit_sha is not unset: + kwargs["head_commit_sha"] = head_commit_sha + if report_count is not unset: + kwargs["report_count"] = report_count + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/files_coverage_data.py b/src/datadog_api_client/v2/model/files_coverage_data.py new file mode 100644 index 0000000000..36e919bc2c --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_data.py @@ -0,0 +1,64 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.files_coverage_attributes import FilesCoverageAttributes + from datadog_api_client.v2.model.files_coverage_response_type import FilesCoverageResponseType + + +class FilesCoverageData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.files_coverage_attributes import FilesCoverageAttributes + from datadog_api_client.v2.model.files_coverage_response_type import FilesCoverageResponseType + + return { + "attributes": (FilesCoverageAttributes,), + "id": (str,), + "type": (FilesCoverageResponseType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[FilesCoverageAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[FilesCoverageResponseType, UnsetType] = unset, + **kwargs, + ): + """ + Data object for files coverage response. + + :param attributes: Attributes of the per-file code coverage response. + :type attributes: FilesCoverageAttributes, optional + + :param id: Unique identifier for the files coverage response. + :type id: str, optional + + :param type: JSON:API type for files coverage response. The value must always be ``ci_app_coverage_files``. + :type type: FilesCoverageResponseType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/files_coverage_request.py b/src/datadog_api_client/v2/model/files_coverage_request.py new file mode 100644 index 0000000000..196fc766af --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.files_coverage_request_data import FilesCoverageRequestData + + +class FilesCoverageRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.files_coverage_request_data import FilesCoverageRequestData + + return { + "data": (FilesCoverageRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: FilesCoverageRequestData, **kwargs): + """ + Request object for getting per-file code coverage data. + + :param data: Data object for files coverage request. + :type data: FilesCoverageRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/files_coverage_request_attributes.py b/src/datadog_api_client/v2/model/files_coverage_request_attributes.py new file mode 100644 index 0000000000..2b56c177c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_request_attributes.py @@ -0,0 +1,117 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class FilesCoverageRequestAttributes(ModelNormal): + validations = { + "commit_sha": {}, + "pr_number": { + "inclusive_minimum": 1, + }, + "repository_id": { + "min_length": 1, + }, + "repository_url": { + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "branch": (str,), + "changed_only": (bool,), + "codeowner": (str,), + "commit_sha": (str,), + "flag": (str,), + "pr_number": (int,), + "repository_id": (str,), + "repository_url": (str,), + "service": (str,), + } + + attribute_map = { + "branch": "branch", + "changed_only": "changed_only", + "codeowner": "codeowner", + "commit_sha": "commit_sha", + "flag": "flag", + "pr_number": "pr_number", + "repository_id": "repository_id", + "repository_url": "repository_url", + "service": "service", + } + + def __init__( + self_, + branch: Union[str, UnsetType] = unset, + changed_only: Union[bool, UnsetType] = unset, + codeowner: Union[str, UnsetType] = unset, + commit_sha: Union[str, UnsetType] = unset, + flag: Union[str, UnsetType] = unset, + pr_number: Union[int, UnsetType] = unset, + repository_id: Union[str, UnsetType] = unset, + repository_url: Union[str, UnsetType] = unset, + service: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for requesting per-file code coverage data. Exactly one of ``commit_sha`` , ``branch`` , or ``pr_number`` must be provided. At most one of ``service`` , ``codeowner`` , or ``flag`` may be provided. + + :param branch: The branch name. + :type branch: str, optional + + :param changed_only: When true, return coverage data only for files that were changed in the specified scope. + :type changed_only: bool, optional + + :param codeowner: Filter coverage by code owner. At most one of ``service`` , ``codeowner`` , or ``flag`` may be provided. + :type codeowner: str, optional + + :param commit_sha: The commit SHA (40-character hexadecimal string). + :type commit_sha: str, optional + + :param flag: Filter coverage by coverage flag. At most one of ``service`` , ``codeowner`` , or ``flag`` may be provided. + :type flag: str, optional + + :param pr_number: The pull request number. Must be a positive integer. + :type pr_number: int, optional + + :param repository_id: Deprecated: use ``repository_url`` instead. The repository URL. **Deprecated**. + :type repository_id: str, optional + + :param repository_url: The repository URL. Accepts a full URL with or without a scheme (for example, ``https://github.com/org/repo`` or ``github.com/org/repo`` ). + :type repository_url: str, optional + + :param service: Filter coverage by service name. At most one of ``service`` , ``codeowner`` , or ``flag`` may be provided. + :type service: str, optional + """ + if branch is not unset: + kwargs["branch"] = branch + if changed_only is not unset: + kwargs["changed_only"] = changed_only + if codeowner is not unset: + kwargs["codeowner"] = codeowner + if commit_sha is not unset: + kwargs["commit_sha"] = commit_sha + if flag is not unset: + kwargs["flag"] = flag + if pr_number is not unset: + kwargs["pr_number"] = pr_number + if repository_id is not unset: + kwargs["repository_id"] = repository_id + if repository_url is not unset: + kwargs["repository_url"] = repository_url + if service is not unset: + kwargs["service"] = service + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/files_coverage_request_data.py b/src/datadog_api_client/v2/model/files_coverage_request_data.py new file mode 100644 index 0000000000..3595ec25d5 --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_request_data.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.files_coverage_request_attributes import FilesCoverageRequestAttributes + from datadog_api_client.v2.model.files_coverage_request_type import FilesCoverageRequestType + + +class FilesCoverageRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.files_coverage_request_attributes import FilesCoverageRequestAttributes + from datadog_api_client.v2.model.files_coverage_request_type import FilesCoverageRequestType + + return { + "attributes": (FilesCoverageRequestAttributes,), + "type": (FilesCoverageRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: FilesCoverageRequestAttributes, type: FilesCoverageRequestType, **kwargs): + """ + Data object for files coverage request. + + :param attributes: Attributes for requesting per-file code coverage data. Exactly one of ``commit_sha`` , ``branch`` , or ``pr_number`` must be provided. At most one of ``service`` , ``codeowner`` , or ``flag`` may be provided. + :type attributes: FilesCoverageRequestAttributes + + :param type: JSON:API type for files coverage request. The value must always be ``ci_app_coverage_files_request``. + :type type: FilesCoverageRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/files_coverage_request_type.py b/src/datadog_api_client/v2/model/files_coverage_request_type.py new file mode 100644 index 0000000000..7bf830effe --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_request_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FilesCoverageRequestType(ModelSimple): + """ + JSON:API type for files coverage request. The value must always be `ci_app_coverage_files_request`. + + :param value: If omitted defaults to "ci_app_coverage_files_request". Must be one of ["ci_app_coverage_files_request"]. + :type value: str + """ + + allowed_values = { + "ci_app_coverage_files_request", + } + CI_APP_COVERAGE_FILES_REQUEST: ClassVar["FilesCoverageRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FilesCoverageRequestType.CI_APP_COVERAGE_FILES_REQUEST = FilesCoverageRequestType("ci_app_coverage_files_request") diff --git a/src/datadog_api_client/v2/model/files_coverage_response.py b/src/datadog_api_client/v2/model/files_coverage_response.py new file mode 100644 index 0000000000..1041e43ca0 --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_response.py @@ -0,0 +1,42 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.files_coverage_data import FilesCoverageData + + +class FilesCoverageResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.files_coverage_data import FilesCoverageData + + return { + "data": (FilesCoverageData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[FilesCoverageData, UnsetType] = unset, **kwargs): + """ + Response object containing per-file code coverage data. + + :param data: Data object for files coverage response. + :type data: FilesCoverageData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/files_coverage_response_type.py b/src/datadog_api_client/v2/model/files_coverage_response_type.py new file mode 100644 index 0000000000..6e55410f10 --- /dev/null +++ b/src/datadog_api_client/v2/model/files_coverage_response_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class FilesCoverageResponseType(ModelSimple): + """ + JSON:API type for files coverage response. The value must always be `ci_app_coverage_files`. + + :param value: If omitted defaults to "ci_app_coverage_files". Must be one of ["ci_app_coverage_files"]. + :type value: str + """ + + allowed_values = { + "ci_app_coverage_files", + } + CI_APP_COVERAGE_FILES: ClassVar["FilesCoverageResponseType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +FilesCoverageResponseType.CI_APP_COVERAGE_FILES = FilesCoverageResponseType("ci_app_coverage_files") diff --git a/src/datadog_api_client/v2/model/pr_coverage_summary_request.py b/src/datadog_api_client/v2/model/pr_coverage_summary_request.py new file mode 100644 index 0000000000..95f2afd9be --- /dev/null +++ b/src/datadog_api_client/v2/model/pr_coverage_summary_request.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.pr_coverage_summary_request_data import PRCoverageSummaryRequestData + + +class PRCoverageSummaryRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.pr_coverage_summary_request_data import PRCoverageSummaryRequestData + + return { + "data": (PRCoverageSummaryRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: PRCoverageSummaryRequestData, **kwargs): + """ + Request object for getting code coverage summary for a pull request. + + :param data: Data object for PR summary request. + :type data: PRCoverageSummaryRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/pr_coverage_summary_request_attributes.py b/src/datadog_api_client/v2/model/pr_coverage_summary_request_attributes.py new file mode 100644 index 0000000000..8cf96886af --- /dev/null +++ b/src/datadog_api_client/v2/model/pr_coverage_summary_request_attributes.py @@ -0,0 +1,48 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class PRCoverageSummaryRequestAttributes(ModelNormal): + validations = { + "pr_number": { + "inclusive_minimum": 1, + }, + "repository_url": { + "min_length": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "pr_number": (int,), + "repository_url": (str,), + } + + attribute_map = { + "pr_number": "pr_number", + "repository_url": "repository_url", + } + + def __init__(self_, pr_number: int, repository_url: str, **kwargs): + """ + Attributes for requesting code coverage summary for a pull request. + + :param pr_number: The pull request number. Must be a positive integer. + :type pr_number: int + + :param repository_url: The repository URL. Accepts a full URL with or without a scheme (for example, ``https://github.com/org/repo`` or ``github.com/org/repo`` ). + :type repository_url: str + """ + super().__init__(kwargs) + + self_.pr_number = pr_number + self_.repository_url = repository_url diff --git a/src/datadog_api_client/v2/model/pr_coverage_summary_request_data.py b/src/datadog_api_client/v2/model/pr_coverage_summary_request_data.py new file mode 100644 index 0000000000..ffc8bfa9db --- /dev/null +++ b/src/datadog_api_client/v2/model/pr_coverage_summary_request_data.py @@ -0,0 +1,50 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.pr_coverage_summary_request_attributes import PRCoverageSummaryRequestAttributes + from datadog_api_client.v2.model.pr_coverage_summary_request_type import PRCoverageSummaryRequestType + + +class PRCoverageSummaryRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.pr_coverage_summary_request_attributes import ( + PRCoverageSummaryRequestAttributes, + ) + from datadog_api_client.v2.model.pr_coverage_summary_request_type import PRCoverageSummaryRequestType + + return { + "attributes": (PRCoverageSummaryRequestAttributes,), + "type": (PRCoverageSummaryRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: PRCoverageSummaryRequestAttributes, type: PRCoverageSummaryRequestType, **kwargs): + """ + Data object for PR summary request. + + :param attributes: Attributes for requesting code coverage summary for a pull request. + :type attributes: PRCoverageSummaryRequestAttributes + + :param type: JSON:API type for PR coverage summary request. The value must always be ``ci_app_coverage_pr_summary_request``. + :type type: PRCoverageSummaryRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/pr_coverage_summary_request_type.py b/src/datadog_api_client/v2/model/pr_coverage_summary_request_type.py new file mode 100644 index 0000000000..c63dd3d500 --- /dev/null +++ b/src/datadog_api_client/v2/model/pr_coverage_summary_request_type.py @@ -0,0 +1,37 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PRCoverageSummaryRequestType(ModelSimple): + """ + JSON:API type for PR coverage summary request. The value must always be `ci_app_coverage_pr_summary_request`. + + :param value: If omitted defaults to "ci_app_coverage_pr_summary_request". Must be one of ["ci_app_coverage_pr_summary_request"]. + :type value: str + """ + + allowed_values = { + "ci_app_coverage_pr_summary_request", + } + CI_APP_COVERAGE_PR_SUMMARY_REQUEST: ClassVar["PRCoverageSummaryRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PRCoverageSummaryRequestType.CI_APP_COVERAGE_PR_SUMMARY_REQUEST = PRCoverageSummaryRequestType( + "ci_app_coverage_pr_summary_request" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 7200f76674..f01989d71b 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2993,6 +2993,15 @@ from datadog_api_client.v2.model.feature_flag_status import FeatureFlagStatus from datadog_api_client.v2.model.feature_flags_pagination_meta import FeatureFlagsPaginationMeta from datadog_api_client.v2.model.feature_flags_pagination_meta_page import FeatureFlagsPaginationMetaPage +from datadog_api_client.v2.model.file_coverage_lines import FileCoverageLines +from datadog_api_client.v2.model.files_coverage_attributes import FilesCoverageAttributes +from datadog_api_client.v2.model.files_coverage_data import FilesCoverageData +from datadog_api_client.v2.model.files_coverage_request import FilesCoverageRequest +from datadog_api_client.v2.model.files_coverage_request_attributes import FilesCoverageRequestAttributes +from datadog_api_client.v2.model.files_coverage_request_data import FilesCoverageRequestData +from datadog_api_client.v2.model.files_coverage_request_type import FilesCoverageRequestType +from datadog_api_client.v2.model.files_coverage_response import FilesCoverageResponse +from datadog_api_client.v2.model.files_coverage_response_type import FilesCoverageResponseType from datadog_api_client.v2.model.filters_per_product import FiltersPerProduct from datadog_api_client.v2.model.finding import Finding from datadog_api_client.v2.model.finding_attributes import FindingAttributes @@ -6864,6 +6873,10 @@ from datadog_api_client.v2.model.ownership_untagged_findings_data import OwnershipUntaggedFindingsData from datadog_api_client.v2.model.ownership_untagged_findings_response import OwnershipUntaggedFindingsResponse from datadog_api_client.v2.model.ownership_untagged_findings_type import OwnershipUntaggedFindingsType +from datadog_api_client.v2.model.pr_coverage_summary_request import PRCoverageSummaryRequest +from datadog_api_client.v2.model.pr_coverage_summary_request_attributes import PRCoverageSummaryRequestAttributes +from datadog_api_client.v2.model.pr_coverage_summary_request_data import PRCoverageSummaryRequestData +from datadog_api_client.v2.model.pr_coverage_summary_request_type import PRCoverageSummaryRequestType from datadog_api_client.v2.model.page_annotations_attributes import PageAnnotationsAttributes from datadog_api_client.v2.model.page_annotations_data import PageAnnotationsData from datadog_api_client.v2.model.page_annotations_response import PageAnnotationsResponse @@ -12817,6 +12830,15 @@ "FeatureFlagStatus", "FeatureFlagsPaginationMeta", "FeatureFlagsPaginationMetaPage", + "FileCoverageLines", + "FilesCoverageAttributes", + "FilesCoverageData", + "FilesCoverageRequest", + "FilesCoverageRequestAttributes", + "FilesCoverageRequestData", + "FilesCoverageRequestType", + "FilesCoverageResponse", + "FilesCoverageResponseType", "FiltersPerProduct", "Finding", "FindingAttributes", @@ -15412,6 +15434,10 @@ "OwnershipUntaggedFindingsData", "OwnershipUntaggedFindingsResponse", "OwnershipUntaggedFindingsType", + "PRCoverageSummaryRequest", + "PRCoverageSummaryRequestAttributes", + "PRCoverageSummaryRequestData", + "PRCoverageSummaryRequestType", "PageAnnotationsAttributes", "PageAnnotationsData", "PageAnnotationsResponse", diff --git a/tests/v2/features/code_coverage.feature b/tests/v2/features/code_coverage.feature index a103acd210..217c50edf8 100644 --- a/tests/v2/features/code_coverage.feature +++ b/tests/v2/features/code_coverage.feature @@ -11,24 +11,21 @@ Feature: Code Coverage @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "Bad Request" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "Not Found" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a branch returns "OK" response - Given operation "GetCodeCoverageBranchSummary" enabled - And new "GetCodeCoverageBranchSummary" request + Given new "GetCodeCoverageBranchSummary" request And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}} When the request is sent Then the response status is 200 OK @@ -59,24 +56,21 @@ Feature: Code Coverage @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "Bad Request" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "Not Found" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 404 Not Found @generated @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for a commit returns "OK" response - Given operation "GetCodeCoverageCommitSummary" enabled - And new "GetCodeCoverageCommitSummary" request + Given new "GetCodeCoverageCommitSummary" request And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}} When the request is sent Then the response status is 200 OK @@ -129,6 +123,27 @@ Feature: Code Coverage When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "Bad Request" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "Not Found" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a pull request returns "OK" response + Given new "GetCodeCoveragePRSummary" request + And body with value {"data": {"attributes": {"pr_number": 42, "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_pr_summary_request"}} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/ci-app-backend Scenario: Get code coverage summary for an existing branch with valid repository Given operation "GetCodeCoverageBranchSummary" enabled @@ -154,3 +169,24 @@ Feature: Code Coverage And the response "data.attributes" has field "patch_coverage" And the response "data.attributes" has field "evaluated_reports_count" And the response "data.attributes" has field "evaluated_flags_count" + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "Bad Request" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"branch": "main", "changed_only": true, "codeowner": "@my-team", "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "flag": "unit-tests", "pr_number": 42, "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist", "service": "my-service"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "Not Found" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"changed_only": true, "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get per-file code coverage data returns "OK" response + Given new "GetCodeCoverageFiles" request + And body with value {"data": {"attributes": {"changed_only": true, "commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_files_request"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index df961ee10c..57c7469dac 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1548,6 +1548,18 @@ "type": "safe" } }, + "GetCodeCoverageFiles": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, + "GetCodeCoveragePRSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, "GetRuleBasedView": { "tag": "Compliance", "undo": {