From 793213260fe3607237f37577e8bf7f551492f7da Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 12 Feb 2026 21:16:43 +0000 Subject: [PATCH] Regenerate client from commit 91aa34e of spec repo --- .generator/schemas/v1/openapi.yaml | 66 ++++++- .generator/schemas/v2/openapi.yaml | 178 ++++++++---------- ...i-specification-returns-OK-response.frozen | 1 + ...-sli-specification-returns-OK-response.yml | 51 +++++ ...h-if-tag-exists-returns-OK-response.frozen | 1 + ...with-if-tag-exists-returns-OK-response.yml | 28 +++ ...h-if-tag-exists-returns-OK-response.frozen | 1 + ...with-if-tag-exists-returns-OK-response.yml | 26 +++ .../CreateSLO_512760759.rb | 49 +++++ .../CreateTagPipelinesRuleset_1897535856.rb | 32 ++++ .../UpdateTagPipelinesRuleset.rb | 2 +- .../UpdateTagPipelinesRuleset_1964644735.rb | 32 ++++ features/v1/service_level_objectives.feature | 17 ++ features/v2/cloud_cost_management.feature | 17 ++ lib/datadog_api_client/inflector.rb | 7 +- .../v1/models/service_level_objective.rb | 4 +- .../models/service_level_objective_query.rb | 2 +- .../models/service_level_objective_request.rb | 4 +- .../models/slo_count_definition.rb} | 99 +++++----- .../v1/models/slo_count_spec.rb | 99 ++++++++++ .../v1/models/slo_response_data.rb | 4 +- .../v1/models/slo_sli_spec.rb | 5 +- ...set_request_data_attributes_rules_items.rb | 4 +- ...quest_data_attributes_rules_items_query.rb | 27 ++- ..._attributes_rules_items_reference_table.rb | 14 +- ...ta_attributes_rules_items_if_tag_exists.rb | 28 +++ ...=> data_attributes_rules_items_mapping.rb} | 33 ++-- ...uleset_resp_data_attributes_rules_items.rb | 4 +- ..._resp_data_attributes_rules_items_query.rb | 27 ++- ..._attributes_rules_items_reference_table.rb | 14 +- ...set_request_data_attributes_rules_items.rb | 4 +- ...est_data_attributes_rules_items_mapping.rb | 167 ---------------- ...quest_data_attributes_rules_items_query.rb | 27 ++- ..._attributes_rules_items_reference_table.rb | 14 +- 34 files changed, 686 insertions(+), 402 deletions(-) create mode 100644 cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.frozen create mode 100644 cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.yml create mode 100644 cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen create mode 100644 cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml create mode 100644 cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen create mode 100644 cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml create mode 100644 examples/v1/service-level-objectives/CreateSLO_512760759.rb create mode 100644 examples/v2/cloud-cost-management/CreateTagPipelinesRuleset_1897535856.rb create mode 100644 examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset_1964644735.rb rename lib/datadog_api_client/{v2/models/create_ruleset_request_data_attributes_rules_items_mapping.rb => v1/models/slo_count_definition.rb} (53%) create mode 100644 lib/datadog_api_client/v1/models/slo_count_spec.rb create mode 100644 lib/datadog_api_client/v2/models/data_attributes_rules_items_if_tag_exists.rb rename lib/datadog_api_client/v2/models/{ruleset_resp_data_attributes_rules_items_mapping.rb => data_attributes_rules_items_mapping.rb} (85%) delete mode 100644 lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_mapping.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index a38d274f9b8d..3e86f3a82c2d 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -11900,6 +11900,60 @@ components: example: UTC type: string type: object + SLOCountDefinition: + description: 'A count-based (metric) SLI specification, composed of three parts: + the good events formula, the total events formula, + + and the underlying queries.' + example: + good_events_formula: query1 - query2 + queries: + - data_source: metrics + name: query1 + query: sum:trace.servlet.request.hits{*} by {env}.as_count() + - data_source: metrics + name: query2 + query: sum:trace.servlet.request.errors{*} by {env}.as_count() + total_events_formula: query1 + properties: + good_events_formula: + $ref: '#/components/schemas/SLOFormula' + queries: + example: + - data_source: metrics + name: query1 + query: sum:trace.servlet.request.hits{*} by {env}.as_count() + items: + $ref: '#/components/schemas/SLODataSourceQueryDefinition' + minItems: 1 + type: array + total_events_formula: + $ref: '#/components/schemas/SLOFormula' + required: + - good_events_formula + - total_events_formula + - queries + type: object + SLOCountSpec: + additionalProperties: false + description: A metric SLI specification. + example: + count: + good_events_formula: query1 - query2 + queries: + - data_source: metrics + name: query1 + query: sum:trace.servlet.request.hits{*} by {env}.as_count() + - data_source: metrics + name: query2 + query: sum:trace.servlet.request.errors{*} by {env}.as_count() + total_events_formula: query1 + properties: + count: + $ref: '#/components/schemas/SLOCountDefinition' + required: + - count + type: object SLOCreator: description: The creator of the SLO nullable: true @@ -12747,8 +12801,12 @@ components: type: string query: $ref: '#/components/schemas/ServiceLevelObjectiveQuery' + description: The metric query used to define a count-based SLO as the ratio + of good events to total events. sli_specification: $ref: '#/components/schemas/SLOSliSpec' + description: A generic SLI specification. This is currently used for time-slice + and count-based (metric) SLOs only. tags: description: 'A list of tags associated with this service level objective. @@ -12804,10 +12862,11 @@ components: type: number type: object SLOSliSpec: - description: A generic SLI specification. This is currently used for time-slice - SLOs only. + description: A generic SLI specification. This is used for time-slice and count-based + (metric) SLOs only. oneOf: - $ref: '#/components/schemas/SLOTimeSliceSpec' + - $ref: '#/components/schemas/SLOCountSpec' SLOState: description: State of the SLO. enum: @@ -13959,7 +14018,8 @@ components: - type type: object ServiceLevelObjectiveQuery: - description: 'A metric-based SLO. **Required if type is `metric`**. Note that + description: 'A count-based (metric) SLO query. This field is superseded by + `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator to be used because this will sum up all request counts instead of averaging diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 83eb28817178..73c6d673719a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14428,7 +14428,7 @@ components: key: cost_center value: engineering case_insensitivity: false - if_not_exists: true + if_tag_exists: do_not_apply query: account_id:"123456789" AND service:"web-api" reference_table: null id: New Ruleset @@ -14473,7 +14473,7 @@ components: example: false type: boolean mapping: - $ref: '#/components/schemas/CreateRulesetRequestDataAttributesRulesItemsMapping' + $ref: '#/components/schemas/DataAttributesRulesItemsMapping' metadata: $ref: '#/components/schemas/RulesetItemMetadata' name: @@ -14488,31 +14488,6 @@ components: - enabled - name type: object - CreateRulesetRequestDataAttributesRulesItemsMapping: - description: The definition of `CreateRulesetRequestDataAttributesRulesItemsMapping` - object. - nullable: true - properties: - destination_key: - description: The `mapping` `destination_key`. - example: '' - type: string - if_not_exists: - description: The `mapping` `if_not_exists`. - example: false - type: boolean - source_keys: - description: The `mapping` `source_keys`. - example: - - '' - items: - type: string - type: array - required: - - destination_key - - if_not_exists - - source_keys - type: object CreateRulesetRequestDataAttributesRulesItemsQuery: description: The definition of `CreateRulesetRequestDataAttributesRulesItemsQuery` object. @@ -14524,16 +14499,17 @@ components: description: The `query` `case_insensitivity`. type: boolean if_not_exists: - description: The `query` `if_not_exists`. - example: false + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' query: description: The `query` `query`. example: '' type: string required: - addition - - if_not_exists - query type: object CreateRulesetRequestDataAttributesRulesItemsQueryAddition: @@ -14567,8 +14543,12 @@ components: $ref: '#/components/schemas/CreateRulesetRequestDataAttributesRulesItemsReferenceTableFieldPairsItems' type: array if_not_exists: - description: The `reference_table` `if_not_exists`. + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `reference_table` + `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' source_keys: description: The `reference_table` `source_keys`. example: @@ -18273,6 +18253,42 @@ components: - INTEGRATION_SCREENBOARD - INTEGRATION_TIMEBOARD - HOST_TIMEBOARD + DataAttributesRulesItemsIfTagExists: + description: The behavior when the tag already exists. + enum: + - append + - do_not_apply + - replace + type: string + x-enum-varnames: + - APPEND + - DO_NOT_APPLY + - REPLACE + DataAttributesRulesItemsMapping: + description: The definition of `DataAttributesRulesItemsMapping` object. + nullable: true + properties: + destination_key: + description: The `mapping` `destination_key`. + example: '' + type: string + if_not_exists: + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `mapping` `if_not_exists`. + type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' + source_keys: + description: The `mapping` `source_keys`. + example: + - '' + items: + type: string + type: array + required: + - destination_key + - source_keys + type: object DataDeletionResponseItem: description: The created data deletion request information. properties: @@ -50015,13 +50031,13 @@ components: key: abc value: ww case_insensitivity: false - if_not_exists: true + if_tag_exists: do_not_apply query: billingcurrency:"USD" AND account_name:"SZA96462" AND billingcurrency:"USD" reference_table: null - enabled: true mapping: destination_key: h - if_not_exists: true + if_tag_exists: do_not_apply source_keys: - accountname - accountownerid @@ -50041,7 +50057,7 @@ components: output_key: status - input_column: status_description output_key: dess - if_not_exists: false + if_tag_exists: append source_keys: - http_status - status_description @@ -50074,13 +50090,13 @@ components: key: environment value: production case_insensitivity: false - if_not_exists: true + if_tag_exists: do_not_apply query: billingcurrency:"USD" AND account_name:"prod-account" reference_table: null - enabled: true mapping: destination_key: team_owner - if_not_exists: true + if_tag_exists: do_not_apply source_keys: - account_name - service @@ -50100,7 +50116,7 @@ components: output_key: status - input_column: status_description output_key: dess - if_not_exists: false + if_tag_exists: append source_keys: - http_status - status_description @@ -50125,7 +50141,7 @@ components: key: cost_center value: engineering case_insensitivity: true - if_not_exists: true + if_tag_exists: do_not_apply query: account_name:"dev-*" reference_table: null version: 1 @@ -50236,7 +50252,7 @@ components: example: false type: boolean mapping: - $ref: '#/components/schemas/RulesetRespDataAttributesRulesItemsMapping' + $ref: '#/components/schemas/DataAttributesRulesItemsMapping' metadata: $ref: '#/components/schemas/RulesetItemMetadata' name: @@ -50251,31 +50267,6 @@ components: - enabled - name type: object - RulesetRespDataAttributesRulesItemsMapping: - description: The definition of `RulesetRespDataAttributesRulesItemsMapping` - object. - nullable: true - properties: - destination_key: - description: The `mapping` `destination_key`. - example: '' - type: string - if_not_exists: - description: The `mapping` `if_not_exists`. - example: false - type: boolean - source_keys: - description: The `mapping` `source_keys`. - example: - - '' - items: - type: string - type: array - required: - - destination_key - - if_not_exists - - source_keys - type: object RulesetRespDataAttributesRulesItemsQuery: description: The definition of `RulesetRespDataAttributesRulesItemsQuery` object. nullable: true @@ -50286,16 +50277,17 @@ components: description: The `query` `case_insensitivity`. type: boolean if_not_exists: - description: The `query` `if_not_exists`. - example: false + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' query: description: The `query` `query`. example: '' type: string required: - addition - - if_not_exists - query type: object RulesetRespDataAttributesRulesItemsQueryAddition: @@ -50329,8 +50321,12 @@ components: $ref: '#/components/schemas/RulesetRespDataAttributesRulesItemsReferenceTableFieldPairsItems' type: array if_not_exists: - description: The `reference_table` `if_not_exists`. + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `reference_table` + `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' source_keys: description: The `reference_table` `source_keys`. example: @@ -65276,13 +65272,13 @@ components: key: cost_center value: engineering case_insensitivity: false - if_not_exists: true + if_tag_exists: do_not_apply query: account_id:"123456789" AND service:"web-api" reference_table: null - enabled: true mapping: destination_key: team_owner - if_not_exists: true + if_tag_exists: do_not_apply source_keys: - account_name - account_id @@ -65302,7 +65298,7 @@ components: output_key: status - input_column: status_description output_key: dess - if_not_exists: false + if_tag_exists: append source_keys: - http_status - status_description @@ -65354,7 +65350,7 @@ components: example: false type: boolean mapping: - $ref: '#/components/schemas/UpdateRulesetRequestDataAttributesRulesItemsMapping' + $ref: '#/components/schemas/DataAttributesRulesItemsMapping' metadata: $ref: '#/components/schemas/RulesetItemMetadata' name: @@ -65369,31 +65365,6 @@ components: - enabled - name type: object - UpdateRulesetRequestDataAttributesRulesItemsMapping: - description: The definition of `UpdateRulesetRequestDataAttributesRulesItemsMapping` - object. - nullable: true - properties: - destination_key: - description: The `mapping` `destination_key`. - example: '' - type: string - if_not_exists: - description: The `mapping` `if_not_exists`. - example: false - type: boolean - source_keys: - description: The `mapping` `source_keys`. - example: - - '' - items: - type: string - type: array - required: - - destination_key - - if_not_exists - - source_keys - type: object UpdateRulesetRequestDataAttributesRulesItemsQuery: description: The definition of `UpdateRulesetRequestDataAttributesRulesItemsQuery` object. @@ -65405,16 +65376,17 @@ components: description: The `query` `case_insensitivity`. type: boolean if_not_exists: - description: The `query` `if_not_exists`. - example: false + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' query: description: The `query` `query`. example: '' type: string required: - addition - - if_not_exists - query type: object UpdateRulesetRequestDataAttributesRulesItemsQueryAddition: @@ -65448,8 +65420,12 @@ components: $ref: '#/components/schemas/UpdateRulesetRequestDataAttributesRulesItemsReferenceTableFieldPairsItems' type: array if_not_exists: - description: The `reference_table` `if_not_exists`. + deprecated: true + description: Deprecated. Use `if_tag_exists` instead. The `reference_table` + `if_not_exists`. type: boolean + if_tag_exists: + $ref: '#/components/schemas/DataAttributesRulesItemsIfTagExists' source_keys: description: The `reference_table` `source_keys`. example: diff --git a/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.frozen b/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.frozen new file mode 100644 index 000000000000..6f05e9c1d1d2 --- /dev/null +++ b/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-02-05T20:07:38.100Z \ No newline at end of file diff --git a/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.yml b/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.yml new file mode 100644 index 000000000000..659b9ec2012b --- /dev/null +++ b/cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-sli-specification-returns-OK-response.yml @@ -0,0 +1,51 @@ +http_interactions: +- recorded_at: Thu, 05 Feb 2026 20:07:38 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"Metric SLO using sli_specification","name":"Test-Create_a_new_metric_SLO_object_using_sli_specification_returns_OK_response-1770322058","sli_specification":{"count":{"good_events_formula":{"formula":"query1 + - query2"},"queries":[{"data_source":"metrics","name":"query1","query":"sum:httpservice.hits{*}.as_count()"},{"data_source":"metrics","name":"query2","query":"sum:httpservice.errors{*}.as_count()"}],"total_events_formula":{"formula":"query1"}}},"tags":["env:prod","type:count"],"target_threshold":99,"thresholds":[{"target":99,"target_display":"99.0","timeframe":"7d","warning":99.5,"warning_display":"99.5"}],"timeframe":"7d","type":"metric","warning_threshold":99.5}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/slo + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"6e49f8aa9883507dbc719f00eede5a5d","name":"Test-Create_a_new_metric_SLO_object_using_sli_specification_returns_OK_response-1770322058","tags":["env:prod","type:count"],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":99.0,"target_display":"99.","warning":99.5,"warning_display":"99.5"}],"type":"metric","type_id":1,"description":"Metric + SLO using sli_specification","timeframe":"7d","warning_threshold":99.5,"target_threshold":99,"query":{"numerator":"sum:httpservice.hits{*}.as_count() + - sum:httpservice.errors{*}.as_count()","denominator":"sum:httpservice.hits{*}.as_count()"},"creator":{"name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com"},"created_at":1770322058,"modified_at":1770322058,"sli_specification":{"count":{"good_events_formula":{"formula":"query1 + - query2"},"queries":[{"data_source":"metrics","name":"query1","query":"sum:httpservice.hits{*}.as_count()"},{"data_source":"metrics","name":"query2","query":"sum:httpservice.errors{*}.as_count()"}],"total_events_formula":{"formula":"query1"}}}}],"error":null} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 05 Feb 2026 20:07:38 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/slo/6e49f8aa9883507dbc719f00eede5a5d + response: + body: + encoding: UTF-8 + string: '{"data":["6e49f8aa9883507dbc719f00eede5a5d"],"error":null} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen b/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen new file mode 100644 index 000000000000..ed9c47c8e2d6 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-02-04T16:26:04.110Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml b/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml new file mode 100644 index 000000000000..0c371d90b60d --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Create-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml @@ -0,0 +1,28 @@ +http_interactions: +- recorded_at: Wed, 04 Feb 2026 16:26:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"enabled":true,"rules":[{"enabled":true,"mapping":null,"name":"Add + Cost Center Tag","query":{"addition":{"key":"cost_center","value":"engineering"},"case_insensitivity":false,"if_tag_exists":"replace","query":"account_id:\"123456789\" + AND service:\"web-api\""},"reference_table":null}]},"id":"New Ruleset","type":"create_ruleset"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/tags/enrichment + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ee10c3ff-312f-464c-b4f6-46adaa6d00a1","type":"ruleset","attributes":{"created":{"seconds":1759947966,"nanos":679638000},"enabled":true,"last_modified_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","modified":{"seconds":1759947966,"nanos":679638000},"name":"New + Ruleset","position":1,"rules":[{"name":"Add Cost Center Tag","enabled":true,"query":{"query":"account_id:\"123456789\" + AND service:\"web-api\"","addition":{"key":"cost_center","value":"engineering"},"if_tag_exists":"replace","case_insensitivity":false},"mapping":null,"reference_table":null,"metadata":null}],"version":3611102}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen b/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen new file mode 100644 index 000000000000..3de83d426811 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-10-08T19:15:10.916Z \ No newline at end of file diff --git a/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml b/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml new file mode 100644 index 000000000000..fcbfc0cf1469 --- /dev/null +++ b/cassettes/features/v2/cloud_cost_management/Update-tag-pipeline-ruleset-with-if-tag-exists-returns-OK-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Wed, 08 Oct 2025 19:15:10 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"enabled":true,"last_version":3611102,"rules":[{"enabled":true,"mapping":{"destination_key":"team_owner","if_tag_exists":"replace","source_keys":["account_name","account_id"]},"name":"Account + Name Mapping","query":null,"reference_table":null}]},"id":"New Ruleset","type":"update_ruleset"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/tags/enrichment/ee10c3ff-312f-464c-b4f6-46adaa6d00a1 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ee10c3ff-312f-464c-b4f6-46adaa6d00a1","type":"ruleset","attributes":{"created":{"seconds":1759950911,"nanos":31873000},"enabled":true,"last_modified_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","modified":{"seconds":1759950911,"nanos":31873000},"name":"New + Ruleset","position":1,"rules":[{"name":"Account Name Mapping","enabled":true,"query":null,"mapping":{"source_keys":["account_name","account_id"],"destination_key":"team_owner","if_tag_exists":"replace"},"reference_table":null,"metadata":null}],"version":3611113}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/service-level-objectives/CreateSLO_512760759.rb b/examples/v1/service-level-objectives/CreateSLO_512760759.rb new file mode 100644 index 000000000000..7a441ecb5a1e --- /dev/null +++ b/examples/v1/service-level-objectives/CreateSLO_512760759.rb @@ -0,0 +1,49 @@ +# Create a new metric SLO object using sli_specification returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new + +body = DatadogAPIClient::V1::ServiceLevelObjectiveRequest.new({ + type: DatadogAPIClient::V1::SLOType::METRIC, + description: "Metric SLO using sli_specification", + name: "Example-Service-Level-Objective", + sli_specification: DatadogAPIClient::V1::SLOCountSpec.new({ + count: DatadogAPIClient::V1::SLOCountDefinition.new({ + good_events_formula: DatadogAPIClient::V1::SLOFormula.new({ + formula: "query1 - query2", + }), + total_events_formula: DatadogAPIClient::V1::SLOFormula.new({ + formula: "query1", + }), + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "sum:httpservice.hits{*}.as_count()", + }), + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query2", + query: "sum:httpservice.errors{*}.as_count()", + }), + ], + }), + }), + tags: [ + "env:prod", + "type:count", + ], + thresholds: [ + DatadogAPIClient::V1::SLOThreshold.new({ + target: 99.0, + target_display: "99.0", + timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS, + warning: 99.5, + warning_display: "99.5", + }), + ], + timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS, + target_threshold: 99.0, + warning_threshold: 99.5, +}) +p api_instance.create_slo(body) diff --git a/examples/v2/cloud-cost-management/CreateTagPipelinesRuleset_1897535856.rb b/examples/v2/cloud-cost-management/CreateTagPipelinesRuleset_1897535856.rb new file mode 100644 index 000000000000..3bc3cce84103 --- /dev/null +++ b/examples/v2/cloud-cost-management/CreateTagPipelinesRuleset_1897535856.rb @@ -0,0 +1,32 @@ +# Create tag pipeline ruleset with if_tag_exists returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new + +body = DatadogAPIClient::V2::CreateRulesetRequest.new({ + data: DatadogAPIClient::V2::CreateRulesetRequestData.new({ + attributes: DatadogAPIClient::V2::CreateRulesetRequestDataAttributes.new({ + enabled: true, + rules: [ + DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItems.new({ + enabled: true, + mapping: nil, + name: "Add Cost Center Tag", + query: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQuery.new({ + addition: DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsQueryAddition.new({ + key: "cost_center", + value: "engineering", + }), + case_insensitivity: false, + if_tag_exists: DatadogAPIClient::V2::DataAttributesRulesItemsIfTagExists::REPLACE, + query: 'account_id:"123456789" AND service:"web-api"', + }), + reference_table: nil, + }), + ], + }), + id: "New Ruleset", + type: DatadogAPIClient::V2::CreateRulesetRequestDataType::CREATE_RULESET, + }), +}) +p api_instance.create_tag_pipelines_ruleset(body) diff --git a/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset.rb b/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset.rb index f3e4c36f07a3..e716348c4eff 100644 --- a/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset.rb +++ b/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset.rb @@ -11,7 +11,7 @@ rules: [ DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({ enabled: true, - mapping: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItemsMapping.new({ + mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({ destination_key: "team_owner", if_not_exists: true, source_keys: [ diff --git a/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset_1964644735.rb b/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset_1964644735.rb new file mode 100644 index 000000000000..1719bb9dedf2 --- /dev/null +++ b/examples/v2/cloud-cost-management/UpdateTagPipelinesRuleset_1964644735.rb @@ -0,0 +1,32 @@ +# Update tag pipeline ruleset with if_tag_exists returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::CloudCostManagementAPI.new + +body = DatadogAPIClient::V2::UpdateRulesetRequest.new({ + data: DatadogAPIClient::V2::UpdateRulesetRequestData.new({ + attributes: DatadogAPIClient::V2::UpdateRulesetRequestDataAttributes.new({ + enabled: true, + last_version: 3611102, + rules: [ + DatadogAPIClient::V2::UpdateRulesetRequestDataAttributesRulesItems.new({ + enabled: true, + mapping: DatadogAPIClient::V2::DataAttributesRulesItemsMapping.new({ + destination_key: "team_owner", + if_tag_exists: DatadogAPIClient::V2::DataAttributesRulesItemsIfTagExists::REPLACE, + source_keys: [ + "account_name", + "account_id", + ], + }), + name: "Account Name Mapping", + query: nil, + reference_table: nil, + }), + ], + }), + id: "New Ruleset", + type: DatadogAPIClient::V2::UpdateRulesetRequestDataType::UPDATE_RULESET, + }), +}) +p api_instance.update_tag_pipelines_ruleset("ee10c3ff-312f-464c-b4f6-46adaa6d00a1", body) diff --git a/features/v1/service_level_objectives.feature b/features/v1/service_level_objectives.feature index c5534618a73e..22c9d6cd3f91 100644 --- a/features/v1/service_level_objectives.feature +++ b/features/v1/service_level_objectives.feature @@ -48,6 +48,23 @@ Feature: Service Level Objectives When the request is sent Then the response status is 200 OK + @team:DataDog/slo-app + Scenario: Create a new metric SLO object using sli_specification returns "OK" response + Given new "CreateSLO" request + And body with value {"type":"metric","description":"Metric SLO using sli_specification","name":"{{ unique }}","sli_specification":{"count":{"good_events_formula":{"formula":"query1 - query2"},"total_events_formula":{"formula":"query1"},"queries":[{"data_source":"metrics","name":"query1","query":"sum:httpservice.hits{*}.as_count()"},{"data_source":"metrics","name":"query2","query":"sum:httpservice.errors{*}.as_count()"}]}},"tags":["env:prod","type:count"],"thresholds":[{"target":99.0,"target_display":"99.0","timeframe":"7d","warning":99.5,"warning_display":"99.5"}],"timeframe":"7d","target_threshold":99.0,"warning_threshold":99.5} + When the request is sent + Then the response status is 200 OK + And the response "data[0].timeframe" is equal to "7d" + And the response "data[0].target_threshold" is equal to 99.0 + And the response "data[0].warning_threshold" is equal to 99.5 + And the response "data[0]" has field "sli_specification" + And the response "data[0].sli_specification" has field "count" + And the response "data[0].sli_specification.count" has field "good_events_formula" + And the response "data[0].sli_specification.count" has field "total_events_formula" + And the response "data[0].sli_specification.count" has field "queries" + And the response "data[0].sli_specification.count.queries" has length 2 + And the response "data[0]" has field "query" + @team:DataDog/slo-app Scenario: Create a time-slice SLO object returns "OK" response Given new "CreateSLO" request diff --git a/features/v2/cloud_cost_management.feature b/features/v2/cloud_cost_management.feature index 66ccd680c236..312e05fb382e 100644 --- a/features/v2/cloud_cost_management.feature +++ b/features/v2/cloud_cost_management.feature @@ -97,6 +97,15 @@ Feature: Cloud Cost Management And the response "data.type" is equal to "ruleset" And the response "data.attributes.name" is equal to "New Ruleset" + @replay-only @team:DataDog/cloud-cost-management + Scenario: Create tag pipeline ruleset with if_tag_exists returns "OK" response + Given new "CreateTagPipelinesRuleset" request + And body with value {"data": {"attributes": {"enabled": true, "rules": [{"enabled": true, "mapping": null, "name": "Add Cost Center Tag", "query": {"addition": {"key": "cost_center", "value": "engineering"}, "case_insensitivity": false, "if_tag_exists": "replace", "query": "account_id:\"123456789\" AND service:\"web-api\""}, "reference_table": null}]}, "id": "New Ruleset", "type": "create_ruleset"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "ruleset" + And the response "data.attributes.name" is equal to "New Ruleset" + @generated @skip @team:DataDog/cloud-cost-management Scenario: Delete Cloud Cost Management AWS CUR config returns "Bad Request" response Given new "DeleteCostAWSCURConfig" request @@ -447,6 +456,14 @@ Feature: Cloud Cost Management When the request is sent Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management + Scenario: Update tag pipeline ruleset with if_tag_exists returns "OK" response + Given new "UpdateTagPipelinesRuleset" request + And request contains "ruleset_id" parameter with value "ee10c3ff-312f-464c-b4f6-46adaa6d00a1" + And body with value {"data": {"attributes": {"enabled": true, "last_version": 3611102, "rules": [{"enabled": true, "mapping": {"destination_key": "team_owner", "if_tag_exists": "replace", "source_keys": ["account_name", "account_id"]}, "name": "Account Name Mapping", "query": null, "reference_table": null}]}, "id": "New Ruleset", "type": "update_ruleset"}} + When the request is sent + Then the response status is 200 OK + @replay-only @team:DataDog/cloud-cost-management Scenario: Upload Custom Costs File returns "Accepted" response Given new "UploadCustomCostsFile" request diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index c22c80ca4271..4ee5a6461c44 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -538,6 +538,8 @@ def overrides "v1.slo_correction_update_data" => "SLOCorrectionUpdateData", "v1.slo_correction_update_request" => "SLOCorrectionUpdateRequest", "v1.slo_correction_update_request_attributes" => "SLOCorrectionUpdateRequestAttributes", + "v1.slo_count_definition" => "SLOCountDefinition", + "v1.slo_count_spec" => "SLOCountSpec", "v1.slo_creator" => "SLOCreator", "v1.slo_data_source_query_definition" => "SLODataSourceQueryDefinition", "v1.slo_delete_response" => "SLODeleteResponse", @@ -1817,7 +1819,6 @@ def overrides "v2.create_ruleset_request_data" => "CreateRulesetRequestData", "v2.create_ruleset_request_data_attributes" => "CreateRulesetRequestDataAttributes", "v2.create_ruleset_request_data_attributes_rules_items" => "CreateRulesetRequestDataAttributesRulesItems", - "v2.create_ruleset_request_data_attributes_rules_items_mapping" => "CreateRulesetRequestDataAttributesRulesItemsMapping", "v2.create_ruleset_request_data_attributes_rules_items_query" => "CreateRulesetRequestDataAttributesRulesItemsQuery", "v2.create_ruleset_request_data_attributes_rules_items_query_addition" => "CreateRulesetRequestDataAttributesRulesItemsQueryAddition", "v2.create_ruleset_request_data_attributes_rules_items_reference_table" => "CreateRulesetRequestDataAttributesRulesItemsReferenceTable", @@ -1992,6 +1993,8 @@ def overrides "v2.dashboard_list_update_items_response" => "DashboardListUpdateItemsResponse", "v2.dashboard_trigger_wrapper" => "DashboardTriggerWrapper", "v2.dashboard_type" => "DashboardType", + "v2.data_attributes_rules_items_if_tag_exists" => "DataAttributesRulesItemsIfTagExists", + "v2.data_attributes_rules_items_mapping" => "DataAttributesRulesItemsMapping", "v2.database_monitoring_trigger_wrapper" => "DatabaseMonitoringTriggerWrapper", "v2.data_deletion_response_item" => "DataDeletionResponseItem", "v2.data_deletion_response_item_attributes" => "DataDeletionResponseItemAttributes", @@ -4059,7 +4062,6 @@ def overrides "v2.ruleset_resp_data_attributes_created" => "RulesetRespDataAttributesCreated", "v2.ruleset_resp_data_attributes_modified" => "RulesetRespDataAttributesModified", "v2.ruleset_resp_data_attributes_rules_items" => "RulesetRespDataAttributesRulesItems", - "v2.ruleset_resp_data_attributes_rules_items_mapping" => "RulesetRespDataAttributesRulesItemsMapping", "v2.ruleset_resp_data_attributes_rules_items_query" => "RulesetRespDataAttributesRulesItemsQuery", "v2.ruleset_resp_data_attributes_rules_items_query_addition" => "RulesetRespDataAttributesRulesItemsQueryAddition", "v2.ruleset_resp_data_attributes_rules_items_reference_table" => "RulesetRespDataAttributesRulesItemsReferenceTable", @@ -5078,7 +5080,6 @@ def overrides "v2.update_ruleset_request_data" => "UpdateRulesetRequestData", "v2.update_ruleset_request_data_attributes" => "UpdateRulesetRequestDataAttributes", "v2.update_ruleset_request_data_attributes_rules_items" => "UpdateRulesetRequestDataAttributesRulesItems", - "v2.update_ruleset_request_data_attributes_rules_items_mapping" => "UpdateRulesetRequestDataAttributesRulesItemsMapping", "v2.update_ruleset_request_data_attributes_rules_items_query" => "UpdateRulesetRequestDataAttributesRulesItemsQuery", "v2.update_ruleset_request_data_attributes_rules_items_query_addition" => "UpdateRulesetRequestDataAttributesRulesItemsQueryAddition", "v2.update_ruleset_request_data_attributes_rules_items_reference_table" => "UpdateRulesetRequestDataAttributesRulesItemsReferenceTable", diff --git a/lib/datadog_api_client/v1/models/service_level_objective.rb b/lib/datadog_api_client/v1/models/service_level_objective.rb index bf18b9ab7e4d..f94381905487 100644 --- a/lib/datadog_api_client/v1/models/service_level_objective.rb +++ b/lib/datadog_api_client/v1/models/service_level_objective.rb @@ -68,12 +68,12 @@ class ServiceLevelObjective # The name of the service level objective object. attr_reader :name - # A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + # A count-based (metric) SLO query. This field is superseded by `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator # to be used because this will sum up all request counts instead of averaging them, or taking the max or # min of all of those requests. attr_accessor :query - # A generic SLI specification. This is currently used for time-slice SLOs only. + # A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. attr_accessor :sli_specification # A list of tags associated with this service level objective. diff --git a/lib/datadog_api_client/v1/models/service_level_objective_query.rb b/lib/datadog_api_client/v1/models/service_level_objective_query.rb index 354cf44c6038..d8cf0d938bd6 100644 --- a/lib/datadog_api_client/v1/models/service_level_objective_query.rb +++ b/lib/datadog_api_client/v1/models/service_level_objective_query.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V1 - # A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + # A count-based (metric) SLO query. This field is superseded by `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator # to be used because this will sum up all request counts instead of averaging them, or taking the max or # min of all of those requests. class ServiceLevelObjectiveQuery diff --git a/lib/datadog_api_client/v1/models/service_level_objective_request.rb b/lib/datadog_api_client/v1/models/service_level_objective_request.rb index c2415da8bd3f..56d31db45a2e 100644 --- a/lib/datadog_api_client/v1/models/service_level_objective_request.rb +++ b/lib/datadog_api_client/v1/models/service_level_objective_request.rb @@ -42,12 +42,12 @@ class ServiceLevelObjectiveRequest # The name of the service level objective object. attr_reader :name - # A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + # A count-based (metric) SLO query. This field is superseded by `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator # to be used because this will sum up all request counts instead of averaging them, or taking the max or # min of all of those requests. attr_accessor :query - # A generic SLI specification. This is currently used for time-slice SLOs only. + # A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. attr_accessor :sli_specification # A list of tags associated with this service level objective. diff --git a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_mapping.rb b/lib/datadog_api_client/v1/models/slo_count_definition.rb similarity index 53% rename from lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_mapping.rb rename to lib/datadog_api_client/v1/models/slo_count_definition.rb index 324c9dd611b2..ae35b276d728 100644 --- a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_mapping.rb +++ b/lib/datadog_api_client/v1/models/slo_count_definition.rb @@ -1,5 +1,5 @@ =begin -#Datadog API V2 Collection +#Datadog API V1 Collection #Collection of all Datadog Public endpoints. @@ -16,19 +16,20 @@ require 'date' require 'time' -module DatadogAPIClient::V2 - # The definition of `CreateRulesetRequestDataAttributesRulesItemsMapping` object. - class CreateRulesetRequestDataAttributesRulesItemsMapping +module DatadogAPIClient::V1 + # A count-based (metric) SLI specification, composed of three parts: the good events formula, the total events formula, + # and the underlying queries. + class SLOCountDefinition include BaseGenericModel - # The `mapping` `destination_key`. - attr_reader :destination_key + # A formula that specifies how to combine the results of multiple queries. + attr_reader :good_events_formula - # The `mapping` `if_not_exists`. - attr_reader :if_not_exists + # + attr_reader :queries - # The `mapping` `source_keys`. - attr_reader :source_keys + # A formula that specifies how to combine the results of multiple queries. + attr_reader :total_events_formula attr_accessor :additional_properties @@ -36,9 +37,9 @@ class CreateRulesetRequestDataAttributesRulesItemsMapping # @!visibility private def self.attribute_map { - :'destination_key' => :'destination_key', - :'if_not_exists' => :'if_not_exists', - :'source_keys' => :'source_keys' + :'good_events_formula' => :'good_events_formula', + :'queries' => :'queries', + :'total_events_formula' => :'total_events_formula' } end @@ -46,9 +47,9 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'destination_key' => :'String', - :'if_not_exists' => :'Boolean', - :'source_keys' => :'Array' + :'good_events_formula' => :'SLOFormula', + :'queries' => :'Array', + :'total_events_formula' => :'SLOFormula' } end @@ -57,7 +58,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateRulesetRequestDataAttributesRulesItemsMapping` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::SLOCountDefinition` initialize method" end self.additional_properties = {} @@ -70,18 +71,18 @@ def initialize(attributes = {}) end } - if attributes.key?(:'destination_key') - self.destination_key = attributes[:'destination_key'] + if attributes.key?(:'good_events_formula') + self.good_events_formula = attributes[:'good_events_formula'] end - if attributes.key?(:'if_not_exists') - self.if_not_exists = attributes[:'if_not_exists'] + if attributes.key?(:'queries') + if (value = attributes[:'queries']).is_a?(Array) + self.queries = value + end end - if attributes.key?(:'source_keys') - if (value = attributes[:'source_keys']).is_a?(Array) - self.source_keys = value - end + if attributes.key?(:'total_events_formula') + self.total_events_formula = attributes[:'total_events_formula'] end end @@ -89,40 +90,44 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @destination_key.nil? - return false if @if_not_exists.nil? - return false if @source_keys.nil? + return false if @good_events_formula.nil? + return false if @queries.nil? + return false if @queries.length < 1 + return false if @total_events_formula.nil? true end # Custom attribute writer method with validation - # @param destination_key [Object] Object to be assigned + # @param good_events_formula [Object] Object to be assigned # @!visibility private - def destination_key=(destination_key) - if destination_key.nil? - fail ArgumentError, 'invalid value for "destination_key", destination_key cannot be nil.' + def good_events_formula=(good_events_formula) + if good_events_formula.nil? + fail ArgumentError, 'invalid value for "good_events_formula", good_events_formula cannot be nil.' end - @destination_key = destination_key + @good_events_formula = good_events_formula end # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned + # @param queries [Object] Object to be assigned # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' + def queries=(queries) + if queries.nil? + fail ArgumentError, 'invalid value for "queries", queries cannot be nil.' + end + if queries.length < 1 + fail ArgumentError, 'invalid value for "queries", number of items must be greater than or equal to 1.' end - @if_not_exists = if_not_exists + @queries = queries end # Custom attribute writer method with validation - # @param source_keys [Object] Object to be assigned + # @param total_events_formula [Object] Object to be assigned # @!visibility private - def source_keys=(source_keys) - if source_keys.nil? - fail ArgumentError, 'invalid value for "source_keys", source_keys cannot be nil.' + def total_events_formula=(total_events_formula) + if total_events_formula.nil? + fail ArgumentError, 'invalid value for "total_events_formula", total_events_formula cannot be nil.' end - @source_keys = source_keys + @total_events_formula = total_events_formula end # Returns the object in the form of hash, with additionalProperties support. @@ -151,9 +156,9 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - destination_key == o.destination_key && - if_not_exists == o.if_not_exists && - source_keys == o.source_keys && + good_events_formula == o.good_events_formula && + queries == o.queries && + total_events_formula == o.total_events_formula && additional_properties == o.additional_properties end @@ -161,7 +166,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [destination_key, if_not_exists, source_keys, additional_properties].hash + [good_events_formula, queries, total_events_formula, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v1/models/slo_count_spec.rb b/lib/datadog_api_client/v1/models/slo_count_spec.rb new file mode 100644 index 000000000000..09986104d714 --- /dev/null +++ b/lib/datadog_api_client/v1/models/slo_count_spec.rb @@ -0,0 +1,99 @@ +=begin +#Datadog API V1 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::V1 + # A metric SLI specification. + class SLOCountSpec + include BaseGenericModel + + # A count-based (metric) SLI specification, composed of three parts: the good events formula, the total events formula, + # and the underlying queries. + attr_reader :count + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count' => :'count' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count' => :'SLOCountDefinition' + } + 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::V1::SLOCountSpec` initialize method" + end + + # 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)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::SLOCountSpec`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'count') + self.count = attributes[:'count'] + 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 @count.nil? + true + end + + # Custom attribute writer method with validation + # @param count [Object] Object to be assigned + # @!visibility private + def count=(count) + if count.nil? + fail ArgumentError, 'invalid value for "count", count cannot be nil.' + end + @count = count + 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 && + count == o.count + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/slo_response_data.rb b/lib/datadog_api_client/v1/models/slo_response_data.rb index 5b010d33bbed..bc6cdfae7500 100644 --- a/lib/datadog_api_client/v1/models/slo_response_data.rb +++ b/lib/datadog_api_client/v1/models/slo_response_data.rb @@ -71,12 +71,12 @@ class SLOResponseData # The name of the service level objective object. attr_accessor :name - # A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator + # A count-based (metric) SLO query. This field is superseded by `sli_specification` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator # to be used because this will sum up all request counts instead of averaging them, or taking the max or # min of all of those requests. attr_accessor :query - # A generic SLI specification. This is currently used for time-slice SLOs only. + # A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. attr_accessor :sli_specification # A list of tags associated with this service level objective. diff --git a/lib/datadog_api_client/v1/models/slo_sli_spec.rb b/lib/datadog_api_client/v1/models/slo_sli_spec.rb index 4c15c69a6ded..76ce31b44ee6 100644 --- a/lib/datadog_api_client/v1/models/slo_sli_spec.rb +++ b/lib/datadog_api_client/v1/models/slo_sli_spec.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V1 - # A generic SLI specification. This is currently used for time-slice SLOs only. + # A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only. module SLOSliSpec class << self include BaseOneOfModel @@ -26,7 +26,8 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'SLOTimeSliceSpec' + :'SLOTimeSliceSpec', + :'SLOCountSpec' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items.rb b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items.rb index 66ff2ef9784d..5832b8013755 100644 --- a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items.rb +++ b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items.rb @@ -24,7 +24,7 @@ class CreateRulesetRequestDataAttributesRulesItems # The `items` `enabled`. attr_reader :enabled - # The definition of `CreateRulesetRequestDataAttributesRulesItemsMapping` object. + # The definition of `DataAttributesRulesItemsMapping` object. attr_accessor :mapping # The `items` `metadata`. @@ -59,7 +59,7 @@ def self.attribute_map def self.openapi_types { :'enabled' => :'Boolean', - :'mapping' => :'CreateRulesetRequestDataAttributesRulesItemsMapping', + :'mapping' => :'DataAttributesRulesItemsMapping', :'metadata' => :'Hash', :'name' => :'String', :'query' => :'CreateRulesetRequestDataAttributesRulesItemsQuery', diff --git a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_query.rb b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_query.rb index 26ce1a32631e..44122e06ebe5 100644 --- a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_query.rb +++ b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_query.rb @@ -27,8 +27,11 @@ class CreateRulesetRequestDataAttributesRulesItemsQuery # The `query` `case_insensitivity`. attr_accessor :case_insensitivity - # The `query` `if_not_exists`. - attr_reader :if_not_exists + # Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. + attr_accessor :if_not_exists + + # The behavior when the tag already exists. + attr_accessor :if_tag_exists # The `query` `query`. attr_reader :query @@ -42,6 +45,7 @@ def self.attribute_map :'addition' => :'addition', :'case_insensitivity' => :'case_insensitivity', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'query' => :'query' } end @@ -53,6 +57,7 @@ def self.openapi_types :'addition' => :'CreateRulesetRequestDataAttributesRulesItemsQueryAddition', :'case_insensitivity' => :'Boolean', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'query' => :'String' } end @@ -95,6 +100,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'query') self.query = attributes[:'query'] end @@ -104,21 +113,10 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @if_not_exists.nil? return false if @query.nil? true end - # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned - # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' - end - @if_not_exists = if_not_exists - end - # Custom attribute writer method with validation # @param query [Object] Object to be assigned # @!visibility private @@ -158,6 +156,7 @@ def ==(o) addition == o.addition && case_insensitivity == o.case_insensitivity && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && query == o.query && additional_properties == o.additional_properties end @@ -166,7 +165,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [addition, case_insensitivity, if_not_exists, query, additional_properties].hash + [addition, case_insensitivity, if_not_exists, if_tag_exists, query, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_reference_table.rb b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_reference_table.rb index 5dd736b6b0a3..426b2a4322fa 100644 --- a/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_reference_table.rb +++ b/lib/datadog_api_client/v2/models/create_ruleset_request_data_attributes_rules_items_reference_table.rb @@ -27,9 +27,12 @@ class CreateRulesetRequestDataAttributesRulesItemsReferenceTable # The `reference_table` `field_pairs`. attr_reader :field_pairs - # The `reference_table` `if_not_exists`. + # Deprecated. Use `if_tag_exists` instead. The `reference_table` `if_not_exists`. attr_accessor :if_not_exists + # The behavior when the tag already exists. + attr_accessor :if_tag_exists + # The `reference_table` `source_keys`. attr_reader :source_keys @@ -45,6 +48,7 @@ def self.attribute_map :'case_insensitivity' => :'case_insensitivity', :'field_pairs' => :'field_pairs', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'source_keys' => :'source_keys', :'table_name' => :'table_name' } @@ -57,6 +61,7 @@ def self.openapi_types :'case_insensitivity' => :'Boolean', :'field_pairs' => :'Array', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'source_keys' => :'Array', :'table_name' => :'String' } @@ -94,6 +99,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'source_keys') if (value = attributes[:'source_keys']).is_a?(Array) self.source_keys = value @@ -174,6 +183,7 @@ def ==(o) case_insensitivity == o.case_insensitivity && field_pairs == o.field_pairs && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && source_keys == o.source_keys && table_name == o.table_name && additional_properties == o.additional_properties @@ -183,7 +193,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [case_insensitivity, field_pairs, if_not_exists, source_keys, table_name, additional_properties].hash + [case_insensitivity, field_pairs, if_not_exists, if_tag_exists, source_keys, table_name, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/data_attributes_rules_items_if_tag_exists.rb b/lib/datadog_api_client/v2/models/data_attributes_rules_items_if_tag_exists.rb new file mode 100644 index 000000000000..2dec4a36cc0a --- /dev/null +++ b/lib/datadog_api_client/v2/models/data_attributes_rules_items_if_tag_exists.rb @@ -0,0 +1,28 @@ +=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 behavior when the tag already exists. + class DataAttributesRulesItemsIfTagExists + include BaseEnumModel + + APPEND = "append".freeze + DO_NOT_APPLY = "do_not_apply".freeze + REPLACE = "replace".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_mapping.rb b/lib/datadog_api_client/v2/models/data_attributes_rules_items_mapping.rb similarity index 85% rename from lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_mapping.rb rename to lib/datadog_api_client/v2/models/data_attributes_rules_items_mapping.rb index 4fe9606ec4b6..c5d2ebf38f34 100644 --- a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_mapping.rb +++ b/lib/datadog_api_client/v2/models/data_attributes_rules_items_mapping.rb @@ -17,15 +17,18 @@ require 'time' module DatadogAPIClient::V2 - # The definition of `RulesetRespDataAttributesRulesItemsMapping` object. - class RulesetRespDataAttributesRulesItemsMapping + # The definition of `DataAttributesRulesItemsMapping` object. + class DataAttributesRulesItemsMapping include BaseGenericModel # The `mapping` `destination_key`. attr_reader :destination_key - # The `mapping` `if_not_exists`. - attr_reader :if_not_exists + # Deprecated. Use `if_tag_exists` instead. The `mapping` `if_not_exists`. + attr_accessor :if_not_exists + + # The behavior when the tag already exists. + attr_accessor :if_tag_exists # The `mapping` `source_keys`. attr_reader :source_keys @@ -38,6 +41,7 @@ def self.attribute_map { :'destination_key' => :'destination_key', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'source_keys' => :'source_keys' } end @@ -48,6 +52,7 @@ def self.openapi_types { :'destination_key' => :'String', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'source_keys' => :'Array' } end @@ -57,7 +62,7 @@ def self.openapi_types # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RulesetRespDataAttributesRulesItemsMapping` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DataAttributesRulesItemsMapping` initialize method" end self.additional_properties = {} @@ -78,6 +83,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'source_keys') if (value = attributes[:'source_keys']).is_a?(Array) self.source_keys = value @@ -90,7 +99,6 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @destination_key.nil? - return false if @if_not_exists.nil? return false if @source_keys.nil? true end @@ -105,16 +113,6 @@ def destination_key=(destination_key) @destination_key = destination_key end - # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned - # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' - end - @if_not_exists = if_not_exists - end - # Custom attribute writer method with validation # @param source_keys [Object] Object to be assigned # @!visibility private @@ -153,6 +151,7 @@ def ==(o) self.class == o.class && destination_key == o.destination_key && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && source_keys == o.source_keys && additional_properties == o.additional_properties end @@ -161,7 +160,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [destination_key, if_not_exists, source_keys, additional_properties].hash + [destination_key, if_not_exists, if_tag_exists, source_keys, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items.rb b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items.rb index acd70d4bbdeb..a785d364f3f6 100644 --- a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items.rb +++ b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items.rb @@ -24,7 +24,7 @@ class RulesetRespDataAttributesRulesItems # The `items` `enabled`. attr_reader :enabled - # The definition of `RulesetRespDataAttributesRulesItemsMapping` object. + # The definition of `DataAttributesRulesItemsMapping` object. attr_accessor :mapping # The `items` `metadata`. @@ -59,7 +59,7 @@ def self.attribute_map def self.openapi_types { :'enabled' => :'Boolean', - :'mapping' => :'RulesetRespDataAttributesRulesItemsMapping', + :'mapping' => :'DataAttributesRulesItemsMapping', :'metadata' => :'Hash', :'name' => :'String', :'query' => :'RulesetRespDataAttributesRulesItemsQuery', diff --git a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_query.rb b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_query.rb index 88dc95509a97..eb2399cd3c0f 100644 --- a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_query.rb +++ b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_query.rb @@ -27,8 +27,11 @@ class RulesetRespDataAttributesRulesItemsQuery # The `query` `case_insensitivity`. attr_accessor :case_insensitivity - # The `query` `if_not_exists`. - attr_reader :if_not_exists + # Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. + attr_accessor :if_not_exists + + # The behavior when the tag already exists. + attr_accessor :if_tag_exists # The `query` `query`. attr_reader :query @@ -42,6 +45,7 @@ def self.attribute_map :'addition' => :'addition', :'case_insensitivity' => :'case_insensitivity', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'query' => :'query' } end @@ -53,6 +57,7 @@ def self.openapi_types :'addition' => :'RulesetRespDataAttributesRulesItemsQueryAddition', :'case_insensitivity' => :'Boolean', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'query' => :'String' } end @@ -95,6 +100,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'query') self.query = attributes[:'query'] end @@ -104,21 +113,10 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @if_not_exists.nil? return false if @query.nil? true end - # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned - # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' - end - @if_not_exists = if_not_exists - end - # Custom attribute writer method with validation # @param query [Object] Object to be assigned # @!visibility private @@ -158,6 +156,7 @@ def ==(o) addition == o.addition && case_insensitivity == o.case_insensitivity && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && query == o.query && additional_properties == o.additional_properties end @@ -166,7 +165,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [addition, case_insensitivity, if_not_exists, query, additional_properties].hash + [addition, case_insensitivity, if_not_exists, if_tag_exists, query, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_reference_table.rb b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_reference_table.rb index aa5cfbdccc83..59facc028c71 100644 --- a/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_reference_table.rb +++ b/lib/datadog_api_client/v2/models/ruleset_resp_data_attributes_rules_items_reference_table.rb @@ -27,9 +27,12 @@ class RulesetRespDataAttributesRulesItemsReferenceTable # The `reference_table` `field_pairs`. attr_reader :field_pairs - # The `reference_table` `if_not_exists`. + # Deprecated. Use `if_tag_exists` instead. The `reference_table` `if_not_exists`. attr_accessor :if_not_exists + # The behavior when the tag already exists. + attr_accessor :if_tag_exists + # The `reference_table` `source_keys`. attr_reader :source_keys @@ -45,6 +48,7 @@ def self.attribute_map :'case_insensitivity' => :'case_insensitivity', :'field_pairs' => :'field_pairs', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'source_keys' => :'source_keys', :'table_name' => :'table_name' } @@ -57,6 +61,7 @@ def self.openapi_types :'case_insensitivity' => :'Boolean', :'field_pairs' => :'Array', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'source_keys' => :'Array', :'table_name' => :'String' } @@ -94,6 +99,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'source_keys') if (value = attributes[:'source_keys']).is_a?(Array) self.source_keys = value @@ -174,6 +183,7 @@ def ==(o) case_insensitivity == o.case_insensitivity && field_pairs == o.field_pairs && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && source_keys == o.source_keys && table_name == o.table_name && additional_properties == o.additional_properties @@ -183,7 +193,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [case_insensitivity, field_pairs, if_not_exists, source_keys, table_name, additional_properties].hash + [case_insensitivity, field_pairs, if_not_exists, if_tag_exists, source_keys, table_name, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items.rb b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items.rb index 831b1228aa81..e074cc680033 100644 --- a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items.rb +++ b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items.rb @@ -24,7 +24,7 @@ class UpdateRulesetRequestDataAttributesRulesItems # The `items` `enabled`. attr_reader :enabled - # The definition of `UpdateRulesetRequestDataAttributesRulesItemsMapping` object. + # The definition of `DataAttributesRulesItemsMapping` object. attr_accessor :mapping # The `items` `metadata`. @@ -59,7 +59,7 @@ def self.attribute_map def self.openapi_types { :'enabled' => :'Boolean', - :'mapping' => :'UpdateRulesetRequestDataAttributesRulesItemsMapping', + :'mapping' => :'DataAttributesRulesItemsMapping', :'metadata' => :'Hash', :'name' => :'String', :'query' => :'UpdateRulesetRequestDataAttributesRulesItemsQuery', diff --git a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_mapping.rb b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_mapping.rb deleted file mode 100644 index 5e74cc22f75c..000000000000 --- a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_mapping.rb +++ /dev/null @@ -1,167 +0,0 @@ -=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 definition of `UpdateRulesetRequestDataAttributesRulesItemsMapping` object. - class UpdateRulesetRequestDataAttributesRulesItemsMapping - include BaseGenericModel - - # The `mapping` `destination_key`. - attr_reader :destination_key - - # The `mapping` `if_not_exists`. - attr_reader :if_not_exists - - # The `mapping` `source_keys`. - attr_reader :source_keys - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'destination_key' => :'destination_key', - :'if_not_exists' => :'if_not_exists', - :'source_keys' => :'source_keys' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'destination_key' => :'String', - :'if_not_exists' => :'Boolean', - :'source_keys' => :'Array' - } - 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::UpdateRulesetRequestDataAttributesRulesItemsMapping` 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?(:'destination_key') - self.destination_key = attributes[:'destination_key'] - end - - if attributes.key?(:'if_not_exists') - self.if_not_exists = attributes[:'if_not_exists'] - end - - if attributes.key?(:'source_keys') - if (value = attributes[:'source_keys']).is_a?(Array) - self.source_keys = 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 @destination_key.nil? - return false if @if_not_exists.nil? - return false if @source_keys.nil? - true - end - - # Custom attribute writer method with validation - # @param destination_key [Object] Object to be assigned - # @!visibility private - def destination_key=(destination_key) - if destination_key.nil? - fail ArgumentError, 'invalid value for "destination_key", destination_key cannot be nil.' - end - @destination_key = destination_key - end - - # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned - # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' - end - @if_not_exists = if_not_exists - end - - # Custom attribute writer method with validation - # @param source_keys [Object] Object to be assigned - # @!visibility private - def source_keys=(source_keys) - if source_keys.nil? - fail ArgumentError, 'invalid value for "source_keys", source_keys cannot be nil.' - end - @source_keys = source_keys - 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 && - destination_key == o.destination_key && - if_not_exists == o.if_not_exists && - source_keys == o.source_keys && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [destination_key, if_not_exists, source_keys, additional_properties].hash - end - end -end diff --git a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_query.rb b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_query.rb index d00b3d2c3056..c6fe3e933546 100644 --- a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_query.rb +++ b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_query.rb @@ -27,8 +27,11 @@ class UpdateRulesetRequestDataAttributesRulesItemsQuery # The `query` `case_insensitivity`. attr_accessor :case_insensitivity - # The `query` `if_not_exists`. - attr_reader :if_not_exists + # Deprecated. Use `if_tag_exists` instead. The `query` `if_not_exists`. + attr_accessor :if_not_exists + + # The behavior when the tag already exists. + attr_accessor :if_tag_exists # The `query` `query`. attr_reader :query @@ -42,6 +45,7 @@ def self.attribute_map :'addition' => :'addition', :'case_insensitivity' => :'case_insensitivity', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'query' => :'query' } end @@ -53,6 +57,7 @@ def self.openapi_types :'addition' => :'UpdateRulesetRequestDataAttributesRulesItemsQueryAddition', :'case_insensitivity' => :'Boolean', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'query' => :'String' } end @@ -95,6 +100,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'query') self.query = attributes[:'query'] end @@ -104,21 +113,10 @@ def initialize(attributes = {}) # @return true if the model is valid # @!visibility private def valid? - return false if @if_not_exists.nil? return false if @query.nil? true end - # Custom attribute writer method with validation - # @param if_not_exists [Object] Object to be assigned - # @!visibility private - def if_not_exists=(if_not_exists) - if if_not_exists.nil? - fail ArgumentError, 'invalid value for "if_not_exists", if_not_exists cannot be nil.' - end - @if_not_exists = if_not_exists - end - # Custom attribute writer method with validation # @param query [Object] Object to be assigned # @!visibility private @@ -158,6 +156,7 @@ def ==(o) addition == o.addition && case_insensitivity == o.case_insensitivity && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && query == o.query && additional_properties == o.additional_properties end @@ -166,7 +165,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [addition, case_insensitivity, if_not_exists, query, additional_properties].hash + [addition, case_insensitivity, if_not_exists, if_tag_exists, query, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_reference_table.rb b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_reference_table.rb index ff56a52c119a..d267abb659f5 100644 --- a/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_reference_table.rb +++ b/lib/datadog_api_client/v2/models/update_ruleset_request_data_attributes_rules_items_reference_table.rb @@ -27,9 +27,12 @@ class UpdateRulesetRequestDataAttributesRulesItemsReferenceTable # The `reference_table` `field_pairs`. attr_reader :field_pairs - # The `reference_table` `if_not_exists`. + # Deprecated. Use `if_tag_exists` instead. The `reference_table` `if_not_exists`. attr_accessor :if_not_exists + # The behavior when the tag already exists. + attr_accessor :if_tag_exists + # The `reference_table` `source_keys`. attr_reader :source_keys @@ -45,6 +48,7 @@ def self.attribute_map :'case_insensitivity' => :'case_insensitivity', :'field_pairs' => :'field_pairs', :'if_not_exists' => :'if_not_exists', + :'if_tag_exists' => :'if_tag_exists', :'source_keys' => :'source_keys', :'table_name' => :'table_name' } @@ -57,6 +61,7 @@ def self.openapi_types :'case_insensitivity' => :'Boolean', :'field_pairs' => :'Array', :'if_not_exists' => :'Boolean', + :'if_tag_exists' => :'DataAttributesRulesItemsIfTagExists', :'source_keys' => :'Array', :'table_name' => :'String' } @@ -94,6 +99,10 @@ def initialize(attributes = {}) self.if_not_exists = attributes[:'if_not_exists'] end + if attributes.key?(:'if_tag_exists') + self.if_tag_exists = attributes[:'if_tag_exists'] + end + if attributes.key?(:'source_keys') if (value = attributes[:'source_keys']).is_a?(Array) self.source_keys = value @@ -174,6 +183,7 @@ def ==(o) case_insensitivity == o.case_insensitivity && field_pairs == o.field_pairs && if_not_exists == o.if_not_exists && + if_tag_exists == o.if_tag_exists && source_keys == o.source_keys && table_name == o.table_name && additional_properties == o.additional_properties @@ -183,7 +193,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [case_insensitivity, field_pairs, if_not_exists, source_keys, table_name, additional_properties].hash + [case_insensitivity, field_pairs, if_not_exists, if_tag_exists, source_keys, table_name, additional_properties].hash end end end