diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b8661d93ff71..6606535523d0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7297,6 +7297,51 @@ components: data: $ref: '#/components/schemas/BillingDimensionsMappingBody' type: object + BranchCoverageSummaryRequest: + description: Request object for getting code coverage summary for a branch. + properties: + data: + $ref: '#/components/schemas/BranchCoverageSummaryRequestData' + required: + - data + type: object + BranchCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a branch. + properties: + branch: + description: The branch name. + example: prod + minLength: 1 + type: string + repository_id: + description: The repository identifier. + example: github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_id + - branch + type: object + BranchCoverageSummaryRequestData: + description: Data object for branch summary request. + properties: + attributes: + $ref: '#/components/schemas/BranchCoverageSummaryRequestAttributes' + type: + $ref: '#/components/schemas/BranchCoverageSummaryRequestType' + required: + - type + - attributes + type: object + BranchCoverageSummaryRequestType: + description: JSON:API type for branch coverage summary request. The value must + always be `ci_app_coverage_branch_summary_request`. + enum: + - ci_app_coverage_branch_summary_request + example: ci_app_coverage_branch_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST Budget: description: A budget. properties: @@ -11760,6 +11805,51 @@ components: required: - location type: object + CommitCoverageSummaryRequest: + description: Request object for getting code coverage summary for a commit. + properties: + data: + $ref: '#/components/schemas/CommitCoverageSummaryRequestData' + required: + - data + type: object + CommitCoverageSummaryRequestAttributes: + description: Attributes for requesting code coverage summary for a commit. + properties: + commit_sha: + description: The commit SHA (40-character hexadecimal string). + example: 66adc9350f2cc9b250b69abddab733dd55e1a588 + pattern: ^[a-fA-F0-9]{40}$ + type: string + repository_id: + description: The repository identifier. + example: github.com/datadog/shopist + minLength: 1 + type: string + required: + - repository_id + - commit_sha + type: object + CommitCoverageSummaryRequestData: + description: Data object for commit summary request. + properties: + attributes: + $ref: '#/components/schemas/CommitCoverageSummaryRequestAttributes' + type: + $ref: '#/components/schemas/CommitCoverageSummaryRequestType' + required: + - type + - attributes + type: object + CommitCoverageSummaryRequestType: + description: JSON:API type for commit coverage summary request. The value must + always be `ci_app_coverage_commit_summary_request`. + enum: + - ci_app_coverage_commit_summary_request + example: ci_app_coverage_commit_summary_request + type: string + x-enum-varnames: + - CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST CompletionCondition: description: The definition of `CompletionCondition` object. properties: @@ -13270,6 +13360,123 @@ components: type: string x-enum-varnames: - COST_BY_ORG + CoverageSummaryAttributes: + description: Attributes object for code coverage summary response. + properties: + codeowners: + additionalProperties: + $ref: '#/components/schemas/CoverageSummaryCodeownerStats' + description: Coverage statistics broken down by code owner. + nullable: true + type: object + evaluated_flags_count: + description: Total number of coverage flags evaluated. + example: 8 + format: int64 + type: integer + evaluated_reports_count: + description: Total number of coverage reports evaluated. + example: 12 + format: int64 + type: integer + patch_coverage: + description: Overall patch coverage percentage. + example: 70.1 + format: double + nullable: true + type: number + services: + additionalProperties: + $ref: '#/components/schemas/CoverageSummaryServiceStats' + description: Coverage statistics broken down by service. + nullable: true + type: object + total_coverage: + description: Overall total coverage percentage. + example: 82.4 + format: double + nullable: true + type: number + type: object + CoverageSummaryCodeownerStats: + description: Coverage statistics for a specific code owner. + properties: + evaluated_flags_count: + description: Number of coverage flags evaluated for the code owner. + example: 2 + format: int64 + type: integer + evaluated_reports_count: + description: Number of coverage reports evaluated for the code owner. + example: 4 + format: int64 + type: integer + patch_coverage: + description: Patch coverage percentage for the code owner. + example: 75.2 + format: double + nullable: true + type: number + total_coverage: + description: Total coverage percentage for the code owner. + example: 88.7 + format: double + nullable: true + type: number + type: object + CoverageSummaryData: + description: Data object for coverage summary response. + properties: + attributes: + $ref: '#/components/schemas/CoverageSummaryAttributes' + id: + description: Unique identifier for the coverage summary (base64-hashed). + example: ZGQxMjM0NV9tYWluXzE3MDk1NjQwMDA= + type: string + type: + $ref: '#/components/schemas/CoverageSummaryType' + type: object + CoverageSummaryResponse: + description: Response object containing code coverage summary. + properties: + data: + $ref: '#/components/schemas/CoverageSummaryData' + type: object + CoverageSummaryServiceStats: + description: Coverage statistics for a specific service. + properties: + evaluated_flags_count: + description: Number of coverage flags evaluated for the service. + example: 3 + format: int64 + type: integer + evaluated_reports_count: + description: Number of coverage reports evaluated for the service. + example: 5 + format: int64 + type: integer + patch_coverage: + description: Patch coverage percentage for the service. + example: 72.3 + format: double + nullable: true + type: number + total_coverage: + description: Total coverage percentage for the service. + example: 85.5 + format: double + nullable: true + type: number + type: object + CoverageSummaryType: + description: JSON:API type for coverage summary response. The value must always + be `ci_app_coverage_summary`. + enum: + - ci_app_coverage_summary + example: ci_app_coverage_summary + type: string + x-enum-varnames: + - CI_APP_COVERAGE_SUMMARY Cpu: description: CPU usage statistics derived from historical Spark job metrics. Provides multiple estimates so users can choose between conservative and cost-saving @@ -67602,6 +67809,7 @@ components: cloud_cost_management_write: Configure cloud cost accounts and global customizations. For more details, see the Cloud Cost Management docs. code_analysis_read: View Code Analysis. + code_coverage_read: View Code Coverage. continuous_profiler_pgo_read: Read and query Continuous Profiler data for Profile-Guided Optimization (PGO). coterm_read: Read terminal recordings. @@ -70851,6 +71059,14 @@ paths: /api/v2/apm/services: get: operationId: GetServiceList + parameters: + - description: Filter services by environment. Can be set to `*` to return all + services across all environments. + in: query + name: filter[env] + required: true + schema: + type: string responses: '200': content: @@ -74203,6 +74419,119 @@ paths: operator: OR permissions: - security_monitoring_filters_write + /api/v2/code-coverage/branch/summary: + post: + description: 'Retrieve aggregated code coverage statistics for a specific branch + in a repository. + + This endpoint provides overall coverage metrics as well as breakdowns by service + + and code owner. + + + **Note**: This endpoint requires the `code_coverage_read` permission.' + operationId: GetCodeCoverageBranchSummary + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BranchCoverageSummaryRequest' + required: true + responses: + '200': + content: + application/json: + 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 branch + tags: + - Code Coverage + x-codegen-request-body-name: body + x-permission: + 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: 'Retrieve aggregated code coverage statistics for a specific commit + in a repository. + + This endpoint provides overall coverage metrics as well as breakdowns by service + + and code owner. + + + The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). + + + **Note**: This endpoint requires the `code_coverage_read` permission.' + operationId: GetCodeCoverageCommitSummary + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CommitCoverageSummaryRequest' + required: true + responses: + '200': + content: + application/json: + 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 commit + tags: + - Code Coverage + x-codegen-request-body-name: body + x-permission: + 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/container_images: get: description: 'Get all Container Images for your organization. @@ -103481,6 +103810,9 @@ tags: API. See the [Cloudflare integration page](https://docs.datadoghq.com/integrations/cloudflare/) for more information. name: Cloudflare Integration +- description: Retrieve and analyze code coverage data from Code Coverage. See the + [Code Coverage page](https://docs.datadoghq.com/code_coverage/) for more information. + name: Code Coverage - description: Manage your Datadog Confluent Cloud integration accounts and account resources directly through the Datadog API. See the [Confluent Cloud page](https://docs.datadoghq.com/integrations/confluent_cloud/) for more information. diff --git a/examples/v2/apm/GetServiceList.rb b/examples/v2/apm/GetServiceList.rb index d535894f09c1..ba444b6aa3cf 100644 --- a/examples/v2/apm/GetServiceList.rb +++ b/examples/v2/apm/GetServiceList.rb @@ -2,4 +2,4 @@ require "datadog_api_client" api_instance = DatadogAPIClient::V2::APMAPI.new -p api_instance.get_service_list() +p api_instance.get_service_list("filter[env]") diff --git a/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb new file mode 100644 index 000000000000..f5f6215bc64a --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary.rb @@ -0,0 +1,18 @@ +# Get code coverage summary for a branch returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_code_coverage_branch_summary".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::BranchCoverageSummaryRequest.new({ + data: DatadogAPIClient::V2::BranchCoverageSummaryRequestData.new({ + attributes: DatadogAPIClient::V2::BranchCoverageSummaryRequestAttributes.new({ + branch: "prod", + repository_id: "github.com/datadog/shopist", + }), + type: DatadogAPIClient::V2::BranchCoverageSummaryRequestType::CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST, + }), +}) +p api_instance.get_code_coverage_branch_summary(body) diff --git a/examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.rb b/examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.rb new file mode 100644 index 000000000000..cce6ea21e22a --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageBranchSummary_2532383345.rb @@ -0,0 +1,18 @@ +# Get code coverage summary for an existing branch with valid repository + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_code_coverage_branch_summary".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::BranchCoverageSummaryRequest.new({ + data: DatadogAPIClient::V2::BranchCoverageSummaryRequestData.new({ + attributes: DatadogAPIClient::V2::BranchCoverageSummaryRequestAttributes.new({ + repository_id: "github.com/datadog/shopist", + branch: "prod", + }), + type: DatadogAPIClient::V2::BranchCoverageSummaryRequestType::CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST, + }), +}) +p api_instance.get_code_coverage_branch_summary(body) diff --git a/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb new file mode 100644 index 000000000000..20a5f1e20f68 --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary.rb @@ -0,0 +1,18 @@ +# Get code coverage summary for a commit returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_code_coverage_commit_summary".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::CommitCoverageSummaryRequest.new({ + data: DatadogAPIClient::V2::CommitCoverageSummaryRequestData.new({ + attributes: DatadogAPIClient::V2::CommitCoverageSummaryRequestAttributes.new({ + commit_sha: "66adc9350f2cc9b250b69abddab733dd55e1a588", + repository_id: "github.com/datadog/shopist", + }), + type: DatadogAPIClient::V2::CommitCoverageSummaryRequestType::CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST, + }), +}) +p api_instance.get_code_coverage_commit_summary(body) diff --git a/examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.rb b/examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.rb new file mode 100644 index 000000000000..866b7124127d --- /dev/null +++ b/examples/v2/code-coverage/GetCodeCoverageCommitSummary_2575243916.rb @@ -0,0 +1,18 @@ +# Get code coverage summary for an existing commit with valid repository + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_code_coverage_commit_summary".to_sym] = true +end +api_instance = DatadogAPIClient::V2::CodeCoverageAPI.new + +body = DatadogAPIClient::V2::CommitCoverageSummaryRequest.new({ + data: DatadogAPIClient::V2::CommitCoverageSummaryRequestData.new({ + attributes: DatadogAPIClient::V2::CommitCoverageSummaryRequestAttributes.new({ + repository_id: "github.com/datadog/shopist", + commit_sha: "c55b0ce584e139bde41a00002ab31bc7d75f791d", + }), + type: DatadogAPIClient::V2::CommitCoverageSummaryRequestType::CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST, + }), +}) +p api_instance.get_code_coverage_commit_summary(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 47cf73e30458..c226dd7a5165 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1108,6 +1108,9 @@ "filter_id" => "String", "body" => "RetentionFilterUpdateRequest", }, + "v2.GetServiceList" => { + "filter_env" => "String", + }, "v2.DeleteApps" => { "body" => "DeleteAppsRequest", }, @@ -1758,6 +1761,12 @@ "v2.ListMultipleRulesets" => { "body" => "GetMultipleRulesetsRequest", }, + "v2.GetCodeCoverageBranchSummary" => { + "body" => "BranchCoverageSummaryRequest", + }, + "v2.GetCodeCoverageCommitSummary" => { + "body" => "CommitCoverageSummaryRequest", + }, "v2.ListContainerImages" => { "filter_tags" => "String", "group_by" => "String", diff --git a/features/v2/apm.feature b/features/v2/apm.feature index e35bd4d4750c..c286ba4f8ba7 100644 --- a/features/v2/apm.feature +++ b/features/v2/apm.feature @@ -9,5 +9,6 @@ Feature: APM And a valid "appKeyAuth" key in the system And an instance of "APM" API And new "GetServiceList" request + And request contains "filter[env]" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK diff --git a/features/v2/code_coverage.feature b/features/v2/code_coverage.feature new file mode 100644 index 000000000000..657ee0375c9e --- /dev/null +++ b/features/v2/code_coverage.feature @@ -0,0 +1,156 @@ +@endpoint(code-coverage) @endpoint(code-coverage-v2) +Feature: Code Coverage + Retrieve and analyze code coverage data from Code Coverage. See the [Code + Coverage page](https://docs.datadoghq.com/code_coverage/) for more + information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CodeCoverage" API + + @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 + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "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 + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "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 + And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_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 a branch with empty branch name returns bad request + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": ""}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a branch with empty repository_id returns bad request + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "", "branch": "prod"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit in nonexistent repository returns not found + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/nonexistent-repo", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "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 "Bad Request" response + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "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 + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "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 + And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_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 a commit with empty commit_sha returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": ""}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit with empty repository_id returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a commit with invalid commit SHA returns bad request + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "abc123"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent branch returns not found + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": "nonexistent-branch"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent commit returns not found + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for a nonexistent repository returns not found + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/nonexistent-repo", "branch": "main"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for an existing branch with valid repository + Given operation "GetCodeCoverageBranchSummary" enabled + And new "GetCodeCoverageBranchSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "branch": "prod"}, "type": "ci_app_coverage_branch_summary_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "ci_app_coverage_branch_summary" + And the response "data.attributes" has field "total_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" + + @skip @team:DataDog/ci-app-backend + Scenario: Get code coverage summary for an existing commit with valid repository + Given operation "GetCodeCoverageCommitSummary" enabled + And new "GetCodeCoverageCommitSummary" request + And body with value {"data": {"attributes": {"repository_id": "github.com/datadog/shopist", "commit_sha": "c55b0ce584e139bde41a00002ab31bc7d75f791d"}, "type": "ci_app_coverage_commit_summary_request"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "ci_app_coverage_commit_summary" + And the response "data.attributes" has field "total_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" diff --git a/features/v2/undo.json b/features/v2/undo.json index 5727d36b9564..75d0d7f71ed7 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1061,6 +1061,18 @@ "type": "idempotent" } }, + "GetCodeCoverageBranchSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, + "GetCodeCoverageCommitSummary": { + "tag": "Code Coverage", + "undo": { + "type": "safe" + } + }, "ListContainerImages": { "tag": "Container Images", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index c974274efe3a..7124bbe895fb 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -237,6 +237,8 @@ def initialize "v2.mute_findings": false, "v2.run_threat_hunting_job": false, "v2.search_security_monitoring_histsignals": false, + "v2.get_code_coverage_branch_summary": false, + "v2.get_code_coverage_commit_summary": false, "v2.create_dataset": false, "v2.delete_dataset": false, "v2.get_all_datasets": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 4ee5a6461c44..4a0ac91fa81b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1364,6 +1364,10 @@ def overrides "v2.billing_dimensions_mapping_body_item_attributes_endpoints_items" => "BillingDimensionsMappingBodyItemAttributesEndpointsItems", "v2.billing_dimensions_mapping_body_item_attributes_endpoints_items_status" => "BillingDimensionsMappingBodyItemAttributesEndpointsItemsStatus", "v2.billing_dimensions_mapping_response" => "BillingDimensionsMappingResponse", + "v2.branch_coverage_summary_request" => "BranchCoverageSummaryRequest", + "v2.branch_coverage_summary_request_attributes" => "BranchCoverageSummaryRequestAttributes", + "v2.branch_coverage_summary_request_data" => "BranchCoverageSummaryRequestData", + "v2.branch_coverage_summary_request_type" => "BranchCoverageSummaryRequestType", "v2.budget" => "Budget", "v2.budget_array" => "BudgetArray", "v2.budget_attributes" => "BudgetAttributes", @@ -1634,6 +1638,10 @@ def overrides "v2.cloud_workload_security_agent_rule_updater_attributes" => "CloudWorkloadSecurityAgentRuleUpdaterAttributes", "v2.cloud_workload_security_agent_rule_update_request" => "CloudWorkloadSecurityAgentRuleUpdateRequest", "v2.code_location" => "CodeLocation", + "v2.commit_coverage_summary_request" => "CommitCoverageSummaryRequest", + "v2.commit_coverage_summary_request_attributes" => "CommitCoverageSummaryRequestAttributes", + "v2.commit_coverage_summary_request_data" => "CommitCoverageSummaryRequestData", + "v2.commit_coverage_summary_request_type" => "CommitCoverageSummaryRequestType", "v2.completion_condition" => "CompletionCondition", "v2.completion_condition_operator" => "CompletionConditionOperator", "v2.completion_gate" => "CompletionGate", @@ -1732,6 +1740,12 @@ def overrides "v2.cost_by_org_attributes" => "CostByOrgAttributes", "v2.cost_by_org_response" => "CostByOrgResponse", "v2.cost_by_org_type" => "CostByOrgType", + "v2.coverage_summary_attributes" => "CoverageSummaryAttributes", + "v2.coverage_summary_codeowner_stats" => "CoverageSummaryCodeownerStats", + "v2.coverage_summary_data" => "CoverageSummaryData", + "v2.coverage_summary_response" => "CoverageSummaryResponse", + "v2.coverage_summary_service_stats" => "CoverageSummaryServiceStats", + "v2.coverage_summary_type" => "CoverageSummaryType", "v2.cpu" => "Cpu", "v2.create_action_connection_request" => "CreateActionConnectionRequest", "v2.create_action_connection_response" => "CreateActionConnectionResponse", @@ -5281,6 +5295,7 @@ def overrides "v2.cloud_cost_management_api" => "CloudCostManagementAPI", "v2.cloud_network_monitoring_api" => "CloudNetworkMonitoringAPI", "v2.cloudflare_integration_api" => "CloudflareIntegrationAPI", + "v2.code_coverage_api" => "CodeCoverageAPI", "v2.confluent_cloud_api" => "ConfluentCloudAPI", "v2.container_images_api" => "ContainerImagesAPI", "v2.containers_api" => "ContainersAPI", diff --git a/lib/datadog_api_client/v2/api/apm_api.rb b/lib/datadog_api_client/v2/api/apm_api.rb index 2df4704b0372..ae4156e44b00 100644 --- a/lib/datadog_api_client/v2/api/apm_api.rb +++ b/lib/datadog_api_client/v2/api/apm_api.rb @@ -26,24 +26,30 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) # Get service list. # # @see #get_service_list_with_http_info - def get_service_list(opts = {}) - data, _status_code, _headers = get_service_list_with_http_info(opts) + def get_service_list(filter_env, opts = {}) + data, _status_code, _headers = get_service_list_with_http_info(filter_env, opts) data end # Get service list. + # @param filter_env [String] Filter services by environment. Can be set to `*` to return all services across all environments. # @param opts [Hash] the optional parameters # @return [Array<(ServiceList, Integer, Hash)>] ServiceList data, response status code and response headers - def get_service_list_with_http_info(opts = {}) + def get_service_list_with_http_info(filter_env, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: APMAPI.get_service_list ...' end + # verify the required parameter 'filter_env' is set + if @api_client.config.client_side_validation && filter_env.nil? + fail ArgumentError, "Missing the required parameter 'filter_env' when calling APMAPI.get_service_list" + end # resource path local_var_path = '/api/v2/apm/services' # query parameters query_params = opts[:query_params] || {} + query_params[:'filter[env]'] = filter_env # header parameters header_params = opts[:header_params] || {} diff --git a/lib/datadog_api_client/v2/api/code_coverage_api.rb b/lib/datadog_api_client/v2/api/code_coverage_api.rb new file mode 100644 index 000000000000..705967ba30db --- /dev/null +++ b/lib/datadog_api_client/v2/api/code_coverage_api.rb @@ -0,0 +1,182 @@ +=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 'cgi' + +module DatadogAPIClient::V2 + class CodeCoverageAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Get code coverage summary for a branch. + # + # @see #get_code_coverage_branch_summary_with_http_info + def get_code_coverage_branch_summary(body, opts = {}) + data, _status_code, _headers = get_code_coverage_branch_summary_with_http_info(body, opts) + data + end + + # Get code coverage summary for a branch. + # + # Retrieve aggregated code coverage statistics for a specific branch in a repository. + # This endpoint provides overall coverage metrics as well as breakdowns by service + # and code owner. + # + # **Note**: This endpoint requires the `code_coverage_read` permission. + # + # @param body [BranchCoverageSummaryRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CoverageSummaryResponse, Integer, Hash)>] CoverageSummaryResponse data, response status code and response headers + def get_code_coverage_branch_summary_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_code_coverage_branch_summary".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_code_coverage_branch_summary") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_code_coverage_branch_summary")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_branch_summary ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CodeCoverageAPI.get_code_coverage_branch_summary" + end + # resource path + local_var_path = '/api/v2/code-coverage/branch/summary' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CoverageSummaryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_code_coverage_branch_summary, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CodeCoverageAPI#get_code_coverage_branch_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get code coverage summary for a commit. + # + # @see #get_code_coverage_commit_summary_with_http_info + def get_code_coverage_commit_summary(body, opts = {}) + data, _status_code, _headers = get_code_coverage_commit_summary_with_http_info(body, opts) + data + end + + # Get code coverage summary for a commit. + # + # Retrieve aggregated code coverage statistics for a specific commit in a repository. + # This endpoint provides overall coverage metrics as well as breakdowns by service + # and code owner. + # + # The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). + # + # **Note**: This endpoint requires the `code_coverage_read` permission. + # + # @param body [CommitCoverageSummaryRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CoverageSummaryResponse, Integer, Hash)>] CoverageSummaryResponse data, response status code and response headers + def get_code_coverage_commit_summary_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_code_coverage_commit_summary".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_code_coverage_commit_summary") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_code_coverage_commit_summary")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CodeCoverageAPI.get_code_coverage_commit_summary ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling CodeCoverageAPI.get_code_coverage_commit_summary" + end + # resource path + local_var_path = '/api/v2/code-coverage/commit/summary' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CoverageSummaryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_code_coverage_commit_summary, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CodeCoverageAPI#get_code_coverage_commit_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/branch_coverage_summary_request.rb b/lib/datadog_api_client/v2/models/branch_coverage_summary_request.rb new file mode 100644 index 000000000000..eee632b0e4c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/branch_coverage_summary_request.rb @@ -0,0 +1,123 @@ +=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 + # Request object for getting code coverage summary for a branch. + class BranchCoverageSummaryRequest + include BaseGenericModel + + # Data object for branch summary request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'BranchCoverageSummaryRequestData' + } + 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::BranchCoverageSummaryRequest` 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?(:'data') + self.data = attributes[:'data'] + 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 @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + 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 && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/branch_coverage_summary_request_attributes.rb b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_attributes.rb new file mode 100644 index 000000000000..03f051e334f7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_attributes.rb @@ -0,0 +1,152 @@ +=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 + # Attributes for requesting code coverage summary for a branch. + class BranchCoverageSummaryRequestAttributes + include BaseGenericModel + + # The branch name. + attr_reader :branch + + # The repository identifier. + attr_reader :repository_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'branch' => :'branch', + :'repository_id' => :'repository_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'branch' => :'String', + :'repository_id' => :'String' + } + 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::BranchCoverageSummaryRequestAttributes` 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?(:'branch') + self.branch = attributes[:'branch'] + end + + if attributes.key?(:'repository_id') + self.repository_id = attributes[:'repository_id'] + 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 @branch.nil? + return false if @branch.to_s.length < 1 + return false if @repository_id.nil? + return false if @repository_id.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param branch [Object] Object to be assigned + # @!visibility private + def branch=(branch) + if branch.nil? + fail ArgumentError, 'invalid value for "branch", branch cannot be nil.' + end + if branch.to_s.length < 1 + fail ArgumentError, 'invalid value for "branch", the character length must be great than or equal to 1.' + end + @branch = branch + end + + # Custom attribute writer method with validation + # @param repository_id [Object] Object to be assigned + # @!visibility private + def repository_id=(repository_id) + if repository_id.nil? + fail ArgumentError, 'invalid value for "repository_id", repository_id cannot be nil.' + end + if repository_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "repository_id", the character length must be great than or equal to 1.' + end + @repository_id = repository_id + 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 && + branch == o.branch && + repository_id == o.repository_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [branch, repository_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/branch_coverage_summary_request_data.rb b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_data.rb new file mode 100644 index 000000000000..eeccd91dbea4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_data.rb @@ -0,0 +1,144 @@ +=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 + # Data object for branch summary request. + class BranchCoverageSummaryRequestData + include BaseGenericModel + + # Attributes for requesting code coverage summary for a branch. + attr_reader :attributes + + # JSON:API type for branch coverage summary request. The value must always be `ci_app_coverage_branch_summary_request`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'BranchCoverageSummaryRequestAttributes', + :'type' => :'BranchCoverageSummaryRequestType' + } + 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::BranchCoverageSummaryRequestData` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/branch_coverage_summary_request_type.rb b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_type.rb new file mode 100644 index 000000000000..f1cdbb1d5785 --- /dev/null +++ b/lib/datadog_api_client/v2/models/branch_coverage_summary_request_type.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 + # JSON:API type for branch coverage summary request. The value must always be `ci_app_coverage_branch_summary_request`. + class BranchCoverageSummaryRequestType + include BaseEnumModel + + CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST = "ci_app_coverage_branch_summary_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/commit_coverage_summary_request.rb b/lib/datadog_api_client/v2/models/commit_coverage_summary_request.rb new file mode 100644 index 000000000000..2928c8b59335 --- /dev/null +++ b/lib/datadog_api_client/v2/models/commit_coverage_summary_request.rb @@ -0,0 +1,123 @@ +=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 + # Request object for getting code coverage summary for a commit. + class CommitCoverageSummaryRequest + include BaseGenericModel + + # Data object for commit summary request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CommitCoverageSummaryRequestData' + } + 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::CommitCoverageSummaryRequest` 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?(:'data') + self.data = attributes[:'data'] + 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 @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + 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 && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/commit_coverage_summary_request_attributes.rb b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_attributes.rb new file mode 100644 index 000000000000..1a53a1001230 --- /dev/null +++ b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_attributes.rb @@ -0,0 +1,154 @@ +=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 + # Attributes for requesting code coverage summary for a commit. + class CommitCoverageSummaryRequestAttributes + include BaseGenericModel + + # The commit SHA (40-character hexadecimal string). + attr_reader :commit_sha + + # The repository identifier. + attr_reader :repository_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'commit_sha' => :'commit_sha', + :'repository_id' => :'repository_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'commit_sha' => :'String', + :'repository_id' => :'String' + } + 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::CommitCoverageSummaryRequestAttributes` 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?(:'commit_sha') + self.commit_sha = attributes[:'commit_sha'] + end + + if attributes.key?(:'repository_id') + self.repository_id = attributes[:'repository_id'] + 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 @commit_sha.nil? + pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) + return false if @commit_sha !~ pattern + return false if @repository_id.nil? + return false if @repository_id.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param commit_sha [Object] Object to be assigned + # @!visibility private + def commit_sha=(commit_sha) + if commit_sha.nil? + fail ArgumentError, 'invalid value for "commit_sha", commit_sha cannot be nil.' + end + pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) + if commit_sha !~ pattern + fail ArgumentError, "invalid value for \"commit_sha\", must conform to the pattern #{pattern}." + end + @commit_sha = commit_sha + end + + # Custom attribute writer method with validation + # @param repository_id [Object] Object to be assigned + # @!visibility private + def repository_id=(repository_id) + if repository_id.nil? + fail ArgumentError, 'invalid value for "repository_id", repository_id cannot be nil.' + end + if repository_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "repository_id", the character length must be great than or equal to 1.' + end + @repository_id = repository_id + 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 && + commit_sha == o.commit_sha && + repository_id == o.repository_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [commit_sha, repository_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/commit_coverage_summary_request_data.rb b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_data.rb new file mode 100644 index 000000000000..87c7e1ce90a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_data.rb @@ -0,0 +1,144 @@ +=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 + # Data object for commit summary request. + class CommitCoverageSummaryRequestData + include BaseGenericModel + + # Attributes for requesting code coverage summary for a commit. + attr_reader :attributes + + # JSON:API type for commit coverage summary request. The value must always be `ci_app_coverage_commit_summary_request`. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CommitCoverageSummaryRequestAttributes', + :'type' => :'CommitCoverageSummaryRequestType' + } + 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::CommitCoverageSummaryRequestData` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + 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 @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/commit_coverage_summary_request_type.rb b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_type.rb new file mode 100644 index 000000000000..b9c14a2d3ebb --- /dev/null +++ b/lib/datadog_api_client/v2/models/commit_coverage_summary_request_type.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 + # JSON:API type for commit coverage summary request. The value must always be `ci_app_coverage_commit_summary_request`. + class CommitCoverageSummaryRequestType + include BaseEnumModel + + CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST = "ci_app_coverage_commit_summary_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb b/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb new file mode 100644 index 000000000000..c8e81d4a7bd9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb @@ -0,0 +1,166 @@ +=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 + # Attributes object for code coverage summary response. + class CoverageSummaryAttributes + include BaseGenericModel + + # Coverage statistics broken down by code owner. + attr_accessor :codeowners + + # Total number of coverage flags evaluated. + attr_accessor :evaluated_flags_count + + # Total number of coverage reports evaluated. + attr_accessor :evaluated_reports_count + + # Overall patch coverage percentage. + attr_accessor :patch_coverage + + # Coverage statistics broken down by service. + attr_accessor :services + + # Overall total coverage percentage. + attr_accessor :total_coverage + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'codeowners' => :'codeowners', + :'evaluated_flags_count' => :'evaluated_flags_count', + :'evaluated_reports_count' => :'evaluated_reports_count', + :'patch_coverage' => :'patch_coverage', + :'services' => :'services', + :'total_coverage' => :'total_coverage' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'codeowners' => :'Hash', + :'evaluated_flags_count' => :'Integer', + :'evaluated_reports_count' => :'Integer', + :'patch_coverage' => :'Float', + :'services' => :'Hash', + :'total_coverage' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'codeowners', + :'patch_coverage', + :'services', + :'total_coverage', + ]) + 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::CoverageSummaryAttributes` 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?(:'codeowners') + self.codeowners = attributes[:'codeowners'] + end + + if attributes.key?(:'evaluated_flags_count') + self.evaluated_flags_count = attributes[:'evaluated_flags_count'] + end + + if attributes.key?(:'evaluated_reports_count') + self.evaluated_reports_count = attributes[:'evaluated_reports_count'] + end + + if attributes.key?(:'patch_coverage') + self.patch_coverage = attributes[:'patch_coverage'] + end + + if attributes.key?(:'services') + self.services = attributes[:'services'] + end + + if attributes.key?(:'total_coverage') + self.total_coverage = attributes[:'total_coverage'] + end + 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 && + codeowners == o.codeowners && + evaluated_flags_count == o.evaluated_flags_count && + evaluated_reports_count == o.evaluated_reports_count && + patch_coverage == o.patch_coverage && + services == o.services && + total_coverage == o.total_coverage && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [codeowners, evaluated_flags_count, evaluated_reports_count, patch_coverage, services, total_coverage, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_codeowner_stats.rb b/lib/datadog_api_client/v2/models/coverage_summary_codeowner_stats.rb new file mode 100644 index 000000000000..43f6f61d3d97 --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_codeowner_stats.rb @@ -0,0 +1,144 @@ +=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 + # Coverage statistics for a specific code owner. + class CoverageSummaryCodeownerStats + include BaseGenericModel + + # Number of coverage flags evaluated for the code owner. + attr_accessor :evaluated_flags_count + + # Number of coverage reports evaluated for the code owner. + attr_accessor :evaluated_reports_count + + # Patch coverage percentage for the code owner. + attr_accessor :patch_coverage + + # Total coverage percentage for the code owner. + attr_accessor :total_coverage + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'evaluated_flags_count' => :'evaluated_flags_count', + :'evaluated_reports_count' => :'evaluated_reports_count', + :'patch_coverage' => :'patch_coverage', + :'total_coverage' => :'total_coverage' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'evaluated_flags_count' => :'Integer', + :'evaluated_reports_count' => :'Integer', + :'patch_coverage' => :'Float', + :'total_coverage' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'patch_coverage', + :'total_coverage', + ]) + 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::CoverageSummaryCodeownerStats` 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?(:'evaluated_flags_count') + self.evaluated_flags_count = attributes[:'evaluated_flags_count'] + end + + if attributes.key?(:'evaluated_reports_count') + self.evaluated_reports_count = attributes[:'evaluated_reports_count'] + end + + if attributes.key?(:'patch_coverage') + self.patch_coverage = attributes[:'patch_coverage'] + end + + if attributes.key?(:'total_coverage') + self.total_coverage = attributes[:'total_coverage'] + end + 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 && + evaluated_flags_count == o.evaluated_flags_count && + evaluated_reports_count == o.evaluated_reports_count && + patch_coverage == o.patch_coverage && + total_coverage == o.total_coverage && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [evaluated_flags_count, evaluated_reports_count, patch_coverage, total_coverage, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_data.rb b/lib/datadog_api_client/v2/models/coverage_summary_data.rb new file mode 100644 index 000000000000..7c6e1869356d --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_data.rb @@ -0,0 +1,125 @@ +=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 + # Data object for coverage summary response. + class CoverageSummaryData + include BaseGenericModel + + # Attributes object for code coverage summary response. + attr_accessor :attributes + + # Unique identifier for the coverage summary (base64-hashed). + attr_accessor :id + + # JSON:API type for coverage summary response. The value must always be `ci_app_coverage_summary`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CoverageSummaryAttributes', + :'id' => :'String', + :'type' => :'CoverageSummaryType' + } + 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::CoverageSummaryData` 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?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + 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 && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_response.rb b/lib/datadog_api_client/v2/models/coverage_summary_response.rb new file mode 100644 index 000000000000..d5bcf60cd942 --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_response.rb @@ -0,0 +1,105 @@ +=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 + # Response object containing code coverage summary. + class CoverageSummaryResponse + include BaseGenericModel + + # Data object for coverage summary response. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CoverageSummaryData' + } + 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::CoverageSummaryResponse` 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?(:'data') + self.data = attributes[:'data'] + end + 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 && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_service_stats.rb b/lib/datadog_api_client/v2/models/coverage_summary_service_stats.rb new file mode 100644 index 000000000000..a5b65c82dec7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_service_stats.rb @@ -0,0 +1,144 @@ +=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 + # Coverage statistics for a specific service. + class CoverageSummaryServiceStats + include BaseGenericModel + + # Number of coverage flags evaluated for the service. + attr_accessor :evaluated_flags_count + + # Number of coverage reports evaluated for the service. + attr_accessor :evaluated_reports_count + + # Patch coverage percentage for the service. + attr_accessor :patch_coverage + + # Total coverage percentage for the service. + attr_accessor :total_coverage + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'evaluated_flags_count' => :'evaluated_flags_count', + :'evaluated_reports_count' => :'evaluated_reports_count', + :'patch_coverage' => :'patch_coverage', + :'total_coverage' => :'total_coverage' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'evaluated_flags_count' => :'Integer', + :'evaluated_reports_count' => :'Integer', + :'patch_coverage' => :'Float', + :'total_coverage' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'patch_coverage', + :'total_coverage', + ]) + 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::CoverageSummaryServiceStats` 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?(:'evaluated_flags_count') + self.evaluated_flags_count = attributes[:'evaluated_flags_count'] + end + + if attributes.key?(:'evaluated_reports_count') + self.evaluated_reports_count = attributes[:'evaluated_reports_count'] + end + + if attributes.key?(:'patch_coverage') + self.patch_coverage = attributes[:'patch_coverage'] + end + + if attributes.key?(:'total_coverage') + self.total_coverage = attributes[:'total_coverage'] + end + 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 && + evaluated_flags_count == o.evaluated_flags_count && + evaluated_reports_count == o.evaluated_reports_count && + patch_coverage == o.patch_coverage && + total_coverage == o.total_coverage && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [evaluated_flags_count, evaluated_reports_count, patch_coverage, total_coverage, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_type.rb b/lib/datadog_api_client/v2/models/coverage_summary_type.rb new file mode 100644 index 000000000000..c57ecd29e45b --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_type.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 + # JSON:API type for coverage summary response. The value must always be `ci_app_coverage_summary`. + class CoverageSummaryType + include BaseEnumModel + + CI_APP_COVERAGE_SUMMARY = "ci_app_coverage_summary".freeze + end +end