diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0e7b8a86740e..b5697ca4b188 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -30615,6 +30615,15 @@ components: example: 12 format: int64 type: integer + flags: + additionalProperties: + $ref: "#/components/schemas/CoverageSummaryFlagStats" + description: |- + Coverage statistics broken down by flag. Each entry contains only coverage percentages. + Branch summaries include the flags of the latest covered commit, including coverage carried forward + to that commit. Pull request summaries include flags across all commits of the pull request. + nullable: true + type: object patch_coverage: description: Overall patch coverage percentage. example: 70.1 @@ -30672,6 +30681,22 @@ components: type: $ref: "#/components/schemas/CoverageSummaryType" type: object + CoverageSummaryFlagStats: + description: Coverage statistics for a specific flag. + properties: + patch_coverage: + description: Patch coverage percentage for the flag. + example: 70.0 + format: double + nullable: true + type: number + total_coverage: + description: Total coverage percentage for the flag. + example: 75.0 + format: double + nullable: true + type: number + type: object CoverageSummaryResponse: description: Response object containing code coverage summary. properties: @@ -170025,8 +170050,8 @@ paths: 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. + This endpoint provides overall coverage metrics as well as breakdowns by service, + code owner, and flag. operationId: GetCodeCoverageBranchSummary requestBody: content: @@ -170090,8 +170115,8 @@ paths: 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. + This endpoint provides overall coverage metrics as well as breakdowns by service, + code owner, and flag. The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). operationId: GetCodeCoverageCommitSummary @@ -170228,8 +170253,8 @@ paths: 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. + This endpoint provides overall coverage metrics as well as breakdowns by service, + code owner, and flag. operationId: GetCodeCoveragePRSummary requestBody: content: diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2503a4d6f464..894e1a486c85 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2865,6 +2865,7 @@ def overrides "v2.coverage_summary_attributes" => "CoverageSummaryAttributes", "v2.coverage_summary_codeowner_stats" => "CoverageSummaryCodeownerStats", "v2.coverage_summary_data" => "CoverageSummaryData", + "v2.coverage_summary_flag_stats" => "CoverageSummaryFlagStats", "v2.coverage_summary_response" => "CoverageSummaryResponse", "v2.coverage_summary_service_stats" => "CoverageSummaryServiceStats", "v2.coverage_summary_type" => "CoverageSummaryType", diff --git a/lib/datadog_api_client/v2/api/code_coverage_api.rb b/lib/datadog_api_client/v2/api/code_coverage_api.rb index 5d10dd6fe0de..f307dc23b56c 100644 --- a/lib/datadog_api_client/v2/api/code_coverage_api.rb +++ b/lib/datadog_api_client/v2/api/code_coverage_api.rb @@ -34,8 +34,8 @@ def get_code_coverage_branch_summary(body, opts = {}) # 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. + # This endpoint provides overall coverage metrics as well as breakdowns by service, + # code owner, and flag. # # @param body [BranchCoverageSummaryRequest] # @param opts [Hash] the optional parameters @@ -103,8 +103,8 @@ def get_code_coverage_commit_summary(body, opts = {}) # 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. + # This endpoint provides overall coverage metrics as well as breakdowns by service, + # code owner, and flag. # # The commit SHA must be a 40-character hexadecimal string (SHA-1 hash). # @@ -243,8 +243,8 @@ def get_code_coverage_pr_summary(body, opts = {}) # 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. + # This endpoint provides overall coverage metrics as well as breakdowns by service, + # code owner, and flag. # # @param body [PRCoverageSummaryRequest] # @param opts [Hash] the optional parameters diff --git a/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb b/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb index c8e81d4a7bd9..cace46745573 100644 --- a/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb +++ b/lib/datadog_api_client/v2/models/coverage_summary_attributes.rb @@ -30,6 +30,11 @@ class CoverageSummaryAttributes # Total number of coverage reports evaluated. attr_accessor :evaluated_reports_count + # Coverage statistics broken down by flag. Each entry contains only coverage percentages. + # Branch summaries include the flags of the latest covered commit, including coverage carried forward + # to that commit. Pull request summaries include flags across all commits of the pull request. + attr_accessor :flags + # Overall patch coverage percentage. attr_accessor :patch_coverage @@ -48,6 +53,7 @@ def self.attribute_map :'codeowners' => :'codeowners', :'evaluated_flags_count' => :'evaluated_flags_count', :'evaluated_reports_count' => :'evaluated_reports_count', + :'flags' => :'flags', :'patch_coverage' => :'patch_coverage', :'services' => :'services', :'total_coverage' => :'total_coverage' @@ -61,6 +67,7 @@ def self.openapi_types :'codeowners' => :'Hash', :'evaluated_flags_count' => :'Integer', :'evaluated_reports_count' => :'Integer', + :'flags' => :'Hash', :'patch_coverage' => :'Float', :'services' => :'Hash', :'total_coverage' => :'Float' @@ -72,6 +79,7 @@ def self.openapi_types def self.openapi_nullable Set.new([ :'codeowners', + :'flags', :'patch_coverage', :'services', :'total_coverage', @@ -108,6 +116,10 @@ def initialize(attributes = {}) self.evaluated_reports_count = attributes[:'evaluated_reports_count'] end + if attributes.key?(:'flags') + self.flags = attributes[:'flags'] + end + if attributes.key?(:'patch_coverage') self.patch_coverage = attributes[:'patch_coverage'] end @@ -150,6 +162,7 @@ def ==(o) codeowners == o.codeowners && evaluated_flags_count == o.evaluated_flags_count && evaluated_reports_count == o.evaluated_reports_count && + flags == o.flags && patch_coverage == o.patch_coverage && services == o.services && total_coverage == o.total_coverage && @@ -160,7 +173,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [codeowners, evaluated_flags_count, evaluated_reports_count, patch_coverage, services, total_coverage, additional_properties].hash + [codeowners, evaluated_flags_count, evaluated_reports_count, flags, patch_coverage, services, total_coverage, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/coverage_summary_flag_stats.rb b/lib/datadog_api_client/v2/models/coverage_summary_flag_stats.rb new file mode 100644 index 000000000000..c5846f3e2d01 --- /dev/null +++ b/lib/datadog_api_client/v2/models/coverage_summary_flag_stats.rb @@ -0,0 +1,124 @@ +=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 flag. + class CoverageSummaryFlagStats + include BaseGenericModel + + # Patch coverage percentage for the flag. + attr_accessor :patch_coverage + + # Total coverage percentage for the flag. + attr_accessor :total_coverage + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'patch_coverage' => :'patch_coverage', + :'total_coverage' => :'total_coverage' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'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::CoverageSummaryFlagStats` 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?(:'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 && + 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 + [patch_coverage, total_coverage, additional_properties].hash + end + end +end