From 4102395620804dd86b3ed6253647db9a6f79590d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 7 Apr 2026 10:51:00 +0000 Subject: [PATCH] Regenerate client from commit bdcc8b5 of spec repo --- .generator/schemas/v2/openapi.yaml | 155 +++++++++++- .../v2/test-optimization/SearchFlakyTests.rb | 2 +- .../SearchFlakyTests_1224086727.rb | 2 +- .../SearchFlakyTests_209064879.rb | 2 +- features/v2/test_optimization.feature | 10 +- lib/datadog_api_client/inflector.rb | 3 + .../v2/models/flaky_test_history.rb | 22 +- .../v2/models/flaky_test_history_policy_id.rb | 34 +++ .../models/flaky_test_history_policy_meta.rb | 235 ++++++++++++++++++ .../flaky_test_history_policy_meta_config.rb | 229 +++++++++++++++++ .../v2/models/flaky_tests_search_filter.rb | 14 +- .../flaky_tests_search_request_attributes.rb | 14 +- 12 files changed, 692 insertions(+), 30 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/flaky_test_history_policy_id.rb create mode 100644 lib/datadog_api_client/v2/models/flaky_test_history_policy_meta.rb create mode 100644 lib/datadog_api_client/v2/models/flaky_test_history_policy_meta_config.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e5f..8d4963e55a6c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -26216,9 +26216,18 @@ components: Includes state transitions like new -> quarantined -> fixed, along with the associated commit SHA when available. example: - commit_sha: abc123def456 + policy_id: ftm_policy.quarantine.failure_rate + policy_meta: + config: + failure_rate: 0.1 + required_runs: 100 + failure_rate: 0.25 + total_runs: 200 status: quarantined timestamp: 1704067200000 - commit_sha: "" + policy_id: unknown + policy_meta: status: new timestamp: 1703980800000 items: @@ -26288,6 +26297,11 @@ components: description: The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. example: abc123def456 type: string + policy_id: + $ref: "#/components/schemas/FlakyTestHistoryPolicyId" + policy_meta: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMeta" + nullable: true status: description: The test status at this point in history. example: quarantined @@ -26302,6 +26316,131 @@ components: - commit_sha - timestamp type: object + FlakyTestHistoryPolicyId: + description: The policy that triggered this status change. + enum: + - ftm_policy.manual + - ftm_policy.fixed + - ftm_policy.disable.failure_rate + - ftm_policy.disable.branch_flake + - ftm_policy.disable.days_active + - ftm_policy.quarantine.failure_rate + - ftm_policy.quarantine.branch_flake + - ftm_policy.quarantine.days_active + - unknown + example: ftm_policy.quarantine.failure_rate + nullable: false + type: string + x-enum-varnames: + - MANUAL + - FIXED + - DISABLE_FAILURE_RATE + - DISABLE_BRANCH_FLAKE + - DISABLE_DAYS_ACTIVE + - QUARANTINE_FAILURE_RATE + - QUARANTINE_BRANCH_FLAKE + - QUARANTINE_DAYS_ACTIVE + - UNKNOWN + FlakyTestHistoryPolicyMeta: + description: Metadata about the policy that triggered this status change. + properties: + branches: + description: Branches where the test was flaky at the time of the status change. + example: ["main", "develop"] + items: + type: string + nullable: true + type: array + config: + $ref: "#/components/schemas/FlakyTestHistoryPolicyMetaConfig" + nullable: true + days_active: + description: The number of days the test has been active at the time of the status change. + example: 15 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + days_without_flake: + description: The number of days since the test last exhibited flakiness. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate of the test at the time of the status change. + example: 0.25 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + state: + description: The previous state of the test. + example: quarantined + nullable: true + type: string + total_runs: + description: The total number of test runs at the time of the status change. + example: 200 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + type: object + FlakyTestHistoryPolicyMetaConfig: + description: Configuration parameters of the policy that triggered this status change. + properties: + branches: + description: The branches considered by the policy. + example: ["main"] + items: + type: string + nullable: true + type: array + days_active: + description: The number of days a test must have been active for the policy to trigger. + example: 30 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + failure_rate: + description: The failure rate threshold for the policy to trigger. + example: 0.7 + format: double + maximum: 1 + minimum: 0 + nullable: true + type: number + forget_branches: + description: Branches excluded from the policy evaluation. + example: ["release"] + items: + type: string + nullable: true + type: array + required_runs: + description: The minimum number of test runs required for the policy to trigger. + example: 100 + format: int32 + maximum: 2147483647 + nullable: true + type: integer + state: + description: The target state the policy transitions the test from. + example: quarantined + nullable: true + type: string + test_services: + description: Test services excluded from the policy evaluation. + example: ["my-service"] + items: + type: string + nullable: true + type: array + type: object FlakyTestPipelineStats: description: CI pipeline related statistics for the flaky test. This information is only available if test runs are associated with CI pipeline events from CI Visibility. properties: @@ -26381,6 +26520,14 @@ components: FlakyTestsSearchFilter: description: Search filter settings. properties: + include_history: + default: false + description: |- + Whether to include the status change history for each flaky test in the response. + When set to true, each test will include a `history` array with chronological status changes. + Defaults to false. + example: true + type: boolean query: default: "*" description: |- @@ -26426,14 +26573,6 @@ components: properties: filter: $ref: "#/components/schemas/FlakyTestsSearchFilter" - include_history: - default: false - description: |- - Whether to include the status change history for each flaky test in the response. - When set to true, each test will include a `history` array with chronological status changes. - Defaults to false. - example: true - type: boolean page: $ref: "#/components/schemas/FlakyTestsSearchPageOptions" sort: diff --git a/examples/v2/test-optimization/SearchFlakyTests.rb b/examples/v2/test-optimization/SearchFlakyTests.rb index a1f4e85d854f..738052db39d9 100644 --- a/examples/v2/test-optimization/SearchFlakyTests.rb +++ b/examples/v2/test-optimization/SearchFlakyTests.rb @@ -10,9 +10,9 @@ data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({ attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({ filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({ + include_history: true, query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', }), - include_history: true, page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({ cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", limit: 25, diff --git a/examples/v2/test-optimization/SearchFlakyTests_1224086727.rb b/examples/v2/test-optimization/SearchFlakyTests_1224086727.rb index 3a73c924473d..4ae53253ddd8 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_1224086727.rb +++ b/examples/v2/test-optimization/SearchFlakyTests_1224086727.rb @@ -10,9 +10,9 @@ data: DatadogAPIClient::V2::FlakyTestsSearchRequestData.new({ attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({ filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({ + include_history: true, query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', }), - include_history: true, page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({ cursor: "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", limit: 25, diff --git a/examples/v2/test-optimization/SearchFlakyTests_209064879.rb b/examples/v2/test-optimization/SearchFlakyTests_209064879.rb index 7f3a97502a82..bc9879461e72 100644 --- a/examples/v2/test-optimization/SearchFlakyTests_209064879.rb +++ b/examples/v2/test-optimization/SearchFlakyTests_209064879.rb @@ -11,12 +11,12 @@ attributes: DatadogAPIClient::V2::FlakyTestsSearchRequestAttributes.new({ filter: DatadogAPIClient::V2::FlakyTestsSearchFilter.new({ query: 'flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"', + include_history: true, }), page: DatadogAPIClient::V2::FlakyTestsSearchPageOptions.new({ limit: 10, }), sort: DatadogAPIClient::V2::FlakyTestsSearchSort::FQN_ASCENDING, - include_history: true, }), type: DatadogAPIClient::V2::FlakyTestsSearchRequestDataType::SEARCH_FLAKY_TESTS_REQUEST, }), diff --git a/features/v2/test_optimization.feature b/features/v2/test_optimization.feature index 427db05baf4f..27f337f9299c 100644 --- a/features/v2/test_optimization.feature +++ b/features/v2/test_optimization.feature @@ -85,7 +85,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "Bad Request" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 400 Bad Request @@ -101,7 +101,7 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 200 OK @@ -117,19 +117,21 @@ Feature: Test Optimization Scenario: Search flaky tests returns "OK" response with history Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"limit": 10}, "sort": "fqn", "include_history": true}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\"", "include_history": true}, "page": {"limit": 10}, "sort": "fqn"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 200 OK And the response "data[0].attributes" has field "history" And the response "data[0].attributes.history[0]" has field "status" And the response "data[0].attributes.history[0]" has field "commit_sha" And the response "data[0].attributes.history[0]" has field "timestamp" + And the response "data[0].attributes.history[0]" has field "policy_id" + And the response "data[0].attributes.history[0]" has field "policy_meta" @generated @skip @team:DataDog/ci-app-backend @with-pagination Scenario: Search flaky tests returns "OK" response with pagination Given operation "SearchFlakyTests" enabled And new "SearchFlakyTests" request - And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "include_history": true, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + And body with value {"data": {"attributes": {"filter": {"include_history": true, "query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request with pagination is sent Then the response status is 200 OK diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b38f547854a2..6ef4ddaa8745 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2621,6 +2621,9 @@ def overrides "v2.flaky_test_attributes" => "FlakyTestAttributes", "v2.flaky_test_attributes_flaky_state" => "FlakyTestAttributesFlakyState", "v2.flaky_test_history" => "FlakyTestHistory", + "v2.flaky_test_history_policy_id" => "FlakyTestHistoryPolicyId", + "v2.flaky_test_history_policy_meta" => "FlakyTestHistoryPolicyMeta", + "v2.flaky_test_history_policy_meta_config" => "FlakyTestHistoryPolicyMetaConfig", "v2.flaky_test_pipeline_stats" => "FlakyTestPipelineStats", "v2.flaky_test_run_metadata" => "FlakyTestRunMetadata", "v2.flaky_tests_pagination" => "FlakyTestsPagination", diff --git a/lib/datadog_api_client/v2/models/flaky_test_history.rb b/lib/datadog_api_client/v2/models/flaky_test_history.rb index 7b6316e067bb..39632790df94 100644 --- a/lib/datadog_api_client/v2/models/flaky_test_history.rb +++ b/lib/datadog_api_client/v2/models/flaky_test_history.rb @@ -24,6 +24,12 @@ class FlakyTestHistory # The commit SHA associated with this status change. Will be an empty string if the commit SHA is not available. attr_reader :commit_sha + # The policy that triggered this status change. + attr_accessor :policy_id + + # Metadata about the policy that triggered this status change. + attr_accessor :policy_meta + # The test status at this point in history. attr_reader :status @@ -37,6 +43,8 @@ class FlakyTestHistory def self.attribute_map { :'commit_sha' => :'commit_sha', + :'policy_id' => :'policy_id', + :'policy_meta' => :'policy_meta', :'status' => :'status', :'timestamp' => :'timestamp' } @@ -47,6 +55,8 @@ def self.attribute_map def self.openapi_types { :'commit_sha' => :'String', + :'policy_id' => :'FlakyTestHistoryPolicyId', + :'policy_meta' => :'FlakyTestHistoryPolicyMeta', :'status' => :'String', :'timestamp' => :'Integer' } @@ -74,6 +84,14 @@ def initialize(attributes = {}) self.commit_sha = attributes[:'commit_sha'] end + if attributes.key?(:'policy_id') + self.policy_id = attributes[:'policy_id'] + end + + if attributes.key?(:'policy_meta') + self.policy_meta = attributes[:'policy_meta'] + end + if attributes.key?(:'status') self.status = attributes[:'status'] end @@ -150,6 +168,8 @@ def ==(o) return true if self.equal?(o) self.class == o.class && commit_sha == o.commit_sha && + policy_id == o.policy_id && + policy_meta == o.policy_meta && status == o.status && timestamp == o.timestamp && additional_properties == o.additional_properties @@ -159,7 +179,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [commit_sha, status, timestamp, additional_properties].hash + [commit_sha, policy_id, policy_meta, status, timestamp, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/flaky_test_history_policy_id.rb b/lib/datadog_api_client/v2/models/flaky_test_history_policy_id.rb new file mode 100644 index 000000000000..39eea2a6debe --- /dev/null +++ b/lib/datadog_api_client/v2/models/flaky_test_history_policy_id.rb @@ -0,0 +1,34 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The policy that triggered this status change. + class FlakyTestHistoryPolicyId + include BaseEnumModel + + MANUAL = "ftm_policy.manual".freeze + FIXED = "ftm_policy.fixed".freeze + DISABLE_FAILURE_RATE = "ftm_policy.disable.failure_rate".freeze + DISABLE_BRANCH_FLAKE = "ftm_policy.disable.branch_flake".freeze + DISABLE_DAYS_ACTIVE = "ftm_policy.disable.days_active".freeze + QUARANTINE_FAILURE_RATE = "ftm_policy.quarantine.failure_rate".freeze + QUARANTINE_BRANCH_FLAKE = "ftm_policy.quarantine.branch_flake".freeze + QUARANTINE_DAYS_ACTIVE = "ftm_policy.quarantine.days_active".freeze + UNKNOWN = "unknown".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta.rb b/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta.rb new file mode 100644 index 000000000000..6d08654a1232 --- /dev/null +++ b/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta.rb @@ -0,0 +1,235 @@ +=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 + # Metadata about the policy that triggered this status change. + class FlakyTestHistoryPolicyMeta + include BaseGenericModel + + # Branches where the test was flaky at the time of the status change. + attr_accessor :branches + + # Configuration parameters of the policy that triggered this status change. + attr_accessor :config + + # The number of days the test has been active at the time of the status change. + attr_reader :days_active + + # The number of days since the test last exhibited flakiness. + attr_reader :days_without_flake + + # The failure rate of the test at the time of the status change. + attr_reader :failure_rate + + # The previous state of the test. + attr_accessor :state + + # The total number of test runs at the time of the status change. + attr_reader :total_runs + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'branches' => :'branches', + :'config' => :'config', + :'days_active' => :'days_active', + :'days_without_flake' => :'days_without_flake', + :'failure_rate' => :'failure_rate', + :'state' => :'state', + :'total_runs' => :'total_runs' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'branches' => :'Array', + :'config' => :'FlakyTestHistoryPolicyMetaConfig', + :'days_active' => :'Integer', + :'days_without_flake' => :'Integer', + :'failure_rate' => :'Float', + :'state' => :'String', + :'total_runs' => :'Integer' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'branches', + :'days_active', + :'days_without_flake', + :'failure_rate', + :'state', + :'total_runs', + ]) + 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::FlakyTestHistoryPolicyMeta` 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?(:'branches') + if (value = attributes[:'branches']).is_a?(Array) + self.branches = value + end + end + + if attributes.key?(:'config') + self.config = attributes[:'config'] + end + + if attributes.key?(:'days_active') + self.days_active = attributes[:'days_active'] + end + + if attributes.key?(:'days_without_flake') + self.days_without_flake = attributes[:'days_without_flake'] + end + + if attributes.key?(:'failure_rate') + self.failure_rate = attributes[:'failure_rate'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'total_runs') + self.total_runs = attributes[:'total_runs'] + 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 !@days_active.nil? && @days_active > 2147483647 + return false if !@days_without_flake.nil? && @days_without_flake > 2147483647 + return false if !@failure_rate.nil? && @failure_rate > 1 + return false if !@failure_rate.nil? && @failure_rate < 0 + return false if !@total_runs.nil? && @total_runs > 2147483647 + true + end + + # Custom attribute writer method with validation + # @param days_active [Object] Object to be assigned + # @!visibility private + def days_active=(days_active) + if !days_active.nil? && days_active > 2147483647 + fail ArgumentError, 'invalid value for "days_active", must be smaller than or equal to 2147483647.' + end + @days_active = days_active + end + + # Custom attribute writer method with validation + # @param days_without_flake [Object] Object to be assigned + # @!visibility private + def days_without_flake=(days_without_flake) + if !days_without_flake.nil? && days_without_flake > 2147483647 + fail ArgumentError, 'invalid value for "days_without_flake", must be smaller than or equal to 2147483647.' + end + @days_without_flake = days_without_flake + end + + # Custom attribute writer method with validation + # @param failure_rate [Object] Object to be assigned + # @!visibility private + def failure_rate=(failure_rate) + if !failure_rate.nil? && failure_rate > 1 + fail ArgumentError, 'invalid value for "failure_rate", must be smaller than or equal to 1.' + end + if !failure_rate.nil? && failure_rate < 0 + fail ArgumentError, 'invalid value for "failure_rate", must be greater than or equal to 0.' + end + @failure_rate = failure_rate + end + + # Custom attribute writer method with validation + # @param total_runs [Object] Object to be assigned + # @!visibility private + def total_runs=(total_runs) + if !total_runs.nil? && total_runs > 2147483647 + fail ArgumentError, 'invalid value for "total_runs", must be smaller than or equal to 2147483647.' + end + @total_runs = total_runs + 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 && + branches == o.branches && + config == o.config && + days_active == o.days_active && + days_without_flake == o.days_without_flake && + failure_rate == o.failure_rate && + state == o.state && + total_runs == o.total_runs && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [branches, config, days_active, days_without_flake, failure_rate, state, total_runs, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta_config.rb b/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta_config.rb new file mode 100644 index 000000000000..17775a48f6aa --- /dev/null +++ b/lib/datadog_api_client/v2/models/flaky_test_history_policy_meta_config.rb @@ -0,0 +1,229 @@ +=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 + # Configuration parameters of the policy that triggered this status change. + class FlakyTestHistoryPolicyMetaConfig + include BaseGenericModel + + # The branches considered by the policy. + attr_accessor :branches + + # The number of days a test must have been active for the policy to trigger. + attr_reader :days_active + + # The failure rate threshold for the policy to trigger. + attr_reader :failure_rate + + # Branches excluded from the policy evaluation. + attr_accessor :forget_branches + + # The minimum number of test runs required for the policy to trigger. + attr_reader :required_runs + + # The target state the policy transitions the test from. + attr_accessor :state + + # Test services excluded from the policy evaluation. + attr_accessor :test_services + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'branches' => :'branches', + :'days_active' => :'days_active', + :'failure_rate' => :'failure_rate', + :'forget_branches' => :'forget_branches', + :'required_runs' => :'required_runs', + :'state' => :'state', + :'test_services' => :'test_services' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'branches' => :'Array', + :'days_active' => :'Integer', + :'failure_rate' => :'Float', + :'forget_branches' => :'Array', + :'required_runs' => :'Integer', + :'state' => :'String', + :'test_services' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'branches', + :'days_active', + :'failure_rate', + :'forget_branches', + :'required_runs', + :'state', + :'test_services', + ]) + 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::FlakyTestHistoryPolicyMetaConfig` 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?(:'branches') + if (value = attributes[:'branches']).is_a?(Array) + self.branches = value + end + end + + if attributes.key?(:'days_active') + self.days_active = attributes[:'days_active'] + end + + if attributes.key?(:'failure_rate') + self.failure_rate = attributes[:'failure_rate'] + end + + if attributes.key?(:'forget_branches') + if (value = attributes[:'forget_branches']).is_a?(Array) + self.forget_branches = value + end + end + + if attributes.key?(:'required_runs') + self.required_runs = attributes[:'required_runs'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'test_services') + if (value = attributes[:'test_services']).is_a?(Array) + self.test_services = value + end + 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 !@days_active.nil? && @days_active > 2147483647 + return false if !@failure_rate.nil? && @failure_rate > 1 + return false if !@failure_rate.nil? && @failure_rate < 0 + return false if !@required_runs.nil? && @required_runs > 2147483647 + true + end + + # Custom attribute writer method with validation + # @param days_active [Object] Object to be assigned + # @!visibility private + def days_active=(days_active) + if !days_active.nil? && days_active > 2147483647 + fail ArgumentError, 'invalid value for "days_active", must be smaller than or equal to 2147483647.' + end + @days_active = days_active + end + + # Custom attribute writer method with validation + # @param failure_rate [Object] Object to be assigned + # @!visibility private + def failure_rate=(failure_rate) + if !failure_rate.nil? && failure_rate > 1 + fail ArgumentError, 'invalid value for "failure_rate", must be smaller than or equal to 1.' + end + if !failure_rate.nil? && failure_rate < 0 + fail ArgumentError, 'invalid value for "failure_rate", must be greater than or equal to 0.' + end + @failure_rate = failure_rate + end + + # Custom attribute writer method with validation + # @param required_runs [Object] Object to be assigned + # @!visibility private + def required_runs=(required_runs) + if !required_runs.nil? && required_runs > 2147483647 + fail ArgumentError, 'invalid value for "required_runs", must be smaller than or equal to 2147483647.' + end + @required_runs = required_runs + 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 && + branches == o.branches && + days_active == o.days_active && + failure_rate == o.failure_rate && + forget_branches == o.forget_branches && + required_runs == o.required_runs && + state == o.state && + test_services == o.test_services && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [branches, days_active, failure_rate, forget_branches, required_runs, state, test_services, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/flaky_tests_search_filter.rb b/lib/datadog_api_client/v2/models/flaky_tests_search_filter.rb index e07d066034dc..64751326ec53 100644 --- a/lib/datadog_api_client/v2/models/flaky_tests_search_filter.rb +++ b/lib/datadog_api_client/v2/models/flaky_tests_search_filter.rb @@ -21,6 +21,11 @@ module DatadogAPIClient::V2 class FlakyTestsSearchFilter include BaseGenericModel + # Whether to include the status change history for each flaky test in the response. + # When set to true, each test will include a `history` array with chronological status changes. + # Defaults to false. + attr_accessor :include_history + # Search query following log syntax used to filter flaky tests, same as on Flaky Tests Management UI. The supported search keys are: # - `flaky_test_state` # - `flaky_test_category` @@ -40,6 +45,7 @@ class FlakyTestsSearchFilter # @!visibility private def self.attribute_map { + :'include_history' => :'include_history', :'query' => :'query' } end @@ -48,6 +54,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { + :'include_history' => :'Boolean', :'query' => :'String' } end @@ -70,6 +77,10 @@ def initialize(attributes = {}) end } + if attributes.key?(:'include_history') + self.include_history = attributes[:'include_history'] + end + if attributes.key?(:'query') self.query = attributes[:'query'] end @@ -101,6 +112,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && + include_history == o.include_history && query == o.query && additional_properties == o.additional_properties end @@ -109,7 +121,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [query, additional_properties].hash + [include_history, query, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/flaky_tests_search_request_attributes.rb b/lib/datadog_api_client/v2/models/flaky_tests_search_request_attributes.rb index 6123d48bf891..8dfed991364a 100644 --- a/lib/datadog_api_client/v2/models/flaky_tests_search_request_attributes.rb +++ b/lib/datadog_api_client/v2/models/flaky_tests_search_request_attributes.rb @@ -24,11 +24,6 @@ class FlakyTestsSearchRequestAttributes # Search filter settings. attr_accessor :filter - # Whether to include the status change history for each flaky test in the response. - # When set to true, each test will include a `history` array with chronological status changes. - # Defaults to false. - attr_accessor :include_history - # Pagination attributes for listing flaky tests. attr_accessor :page @@ -42,7 +37,6 @@ class FlakyTestsSearchRequestAttributes def self.attribute_map { :'filter' => :'filter', - :'include_history' => :'include_history', :'page' => :'page', :'sort' => :'sort' } @@ -53,7 +47,6 @@ def self.attribute_map def self.openapi_types { :'filter' => :'FlakyTestsSearchFilter', - :'include_history' => :'Boolean', :'page' => :'FlakyTestsSearchPageOptions', :'sort' => :'FlakyTestsSearchSort' } @@ -81,10 +74,6 @@ def initialize(attributes = {}) self.filter = attributes[:'filter'] end - if attributes.key?(:'include_history') - self.include_history = attributes[:'include_history'] - end - if attributes.key?(:'page') self.page = attributes[:'page'] end @@ -121,7 +110,6 @@ def ==(o) return true if self.equal?(o) self.class == o.class && filter == o.filter && - include_history == o.include_history && page == o.page && sort == o.sort && additional_properties == o.additional_properties @@ -131,7 +119,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [filter, include_history, page, sort, additional_properties].hash + [filter, page, sort, additional_properties].hash end end end