From 08af4af1e21b8833418b39f4eef9463da5e8d64f Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:18:28 +0000 Subject: [PATCH 1/3] Add apm_metrics query support to dashboard OpenAPI spec (#3116) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v1/openapi.yaml | 118 ++++++++ ...w-dashboard-with-apm-metrics-widget.frozen | 1 + ...-new-dashboard-with-apm-metrics-widget.yml | 42 +++ .../dashboards/CreateDashboard_2252738813.rb | 43 +++ features/v1/dashboards.feature | 14 + lib/datadog_api_client/inflector.rb | 4 + ...rmula_and_function_apm_metric_stat_name.rb | 41 +++ ...la_and_function_apm_metrics_data_source.rb | 26 ++ ...d_function_apm_metrics_query_definition.rb | 259 ++++++++++++++++++ ...mula_and_function_apm_metrics_span_kind.rb | 30 ++ .../formula_and_function_query_definition.rb | 1 + 11 files changed, 579 insertions(+) create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.frozen create mode 100644 cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.yml create mode 100644 examples/v1/dashboards/CreateDashboard_2252738813.rb create mode 100644 lib/datadog_api_client/v1/models/formula_and_function_apm_metric_stat_name.rb create mode 100644 lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_data_source.rb create mode 100644 lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_query_definition.rb create mode 100644 lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_span_kind.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index ede89abbaaef..419af73cfbe7 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -2709,6 +2709,123 @@ components: - service - name type: object + FormulaAndFunctionApmMetricStatName: + description: APM metric stat name. + enum: + - errors + - error_rate + - errors_per_second + - latency_avg + - latency_max + - latency_p50 + - latency_p75 + - latency_p90 + - latency_p95 + - latency_p99 + - latency_p999 + - latency_distribution + - hits + - hits_per_second + - total_time + - apdex + example: "hits" + type: string + x-enum-varnames: + - ERRORS + - ERROR_RATE + - ERRORS_PER_SECOND + - LATENCY_AVG + - LATENCY_MAX + - LATENCY_P50 + - LATENCY_P75 + - LATENCY_P90 + - LATENCY_P95 + - LATENCY_P99 + - LATENCY_P999 + - LATENCY_DISTRIBUTION + - HITS + - HITS_PER_SECOND + - TOTAL_TIME + - APDEX + FormulaAndFunctionApmMetricsDataSource: + description: Data source for APM metrics queries. + enum: + - apm_metrics + example: apm_metrics + type: string + x-enum-varnames: + - APM_METRICS + FormulaAndFunctionApmMetricsQueryDefinition: + description: A formula and functions APM metrics query. + properties: + data_source: + $ref: "#/components/schemas/FormulaAndFunctionApmMetricsDataSource" + group_by: + description: Optional fields to group the query results by. + items: + description: A field to group results by. + example: "resource_name" + type: string + type: array + name: + description: Name of this query to use in formulas. + example: "query_errors" + type: string + operation_mode: + description: Optional operation mode to aggregate across operation names. + example: "primary" + type: string + operation_name: + description: Name of operation on service. If not provided, the primary operation name is used. + example: "web.request" + type: string + peer_tags: + description: Tags to query for a specific downstream entity (peer.service, peer.db_instance, peer.s3, peer.s3.bucket, etc.). + items: + example: "peer.service:my-service" + type: string + type: array + query_filter: + description: Additional filters for the query using metrics query syntax (e.g., env, primary_tag). + example: "env:prod" + type: string + resource_hash: + description: The hash of a specific resource to filter by. + example: "abc123" + type: string + resource_name: + description: The full name of a specific resource to filter by. + example: "GET /api/v1/users" + type: string + service: + description: APM service name. + example: "web-store" + type: string + span_kind: + $ref: "#/components/schemas/FormulaAndFunctionApmMetricsSpanKind" + stat: + $ref: "#/components/schemas/FormulaAndFunctionApmMetricStatName" + required: + - data_source + - name + - stat + type: object + FormulaAndFunctionApmMetricsSpanKind: + description: Describes the relationship between the span, its parents, and its children in a trace. + enum: + - consumer + - server + - client + - producer + - internal + example: "server" + type: string + x-enum-varnames: + - CONSUMER + - SERVER + - CLIENT + - PRODUCER + - INTERNAL FormulaAndFunctionApmResourceStatName: description: APM resource stat name. enum: @@ -3138,6 +3255,7 @@ components: - $ref: "#/components/schemas/FormulaAndFunctionProcessQueryDefinition" - $ref: "#/components/schemas/FormulaAndFunctionApmDependencyStatsQueryDefinition" - $ref: "#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition" + - $ref: "#/components/schemas/FormulaAndFunctionApmMetricsQueryDefinition" - $ref: "#/components/schemas/FormulaAndFunctionSLOQueryDefinition" - $ref: "#/components/schemas/FormulaAndFunctionCloudCostQueryDefinition" FormulaAndFunctionResponseFormat: diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.frozen new file mode 100644 index 000000000000..75b84eafed74 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.frozen @@ -0,0 +1 @@ +2025-02-20T10:00:00.000Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.yml new file mode 100644 index 000000000000..6dd0e490b242 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-apm-metrics-widget.yml @@ -0,0 +1,42 @@ +http_interactions: +- recorded_at: Thu, 20 Feb 2025 10:00:00 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_apm_metrics_widget-1740045600","widgets":[{"definition":{"requests":[{"queries":[{"data_source":"apm_metrics","group_by":["resource_name"],"name":"query1","query_filter":"env:prod","service":"web-store","stat":"hits"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"apm-met-ric","title":"Test-Create_a_new_dashboard_with_apm_metrics_widget-1740045600","description":null,"author_handle":"test@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/apm-met-ric/testcreateanewdashboardwithapmmetricswidget1740045600","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"queries":[{"data_source":"apm_metrics","group_by":["resource_name"],"name":"query1","query_filter":"env:prod","service":"web-store","stat":"hits"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":1234567890123456}],"notify_list":null,"created_at":"2025-02-20T10:00:01.000000+00:00","modified_at":"2025-02-20T10:00:01.000000+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 20 Feb 2025 10:00:00 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/apm-met-ric + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"apm-met-ric"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_2252738813.rb b/examples/v1/dashboards/CreateDashboard_2252738813.rb new file mode 100644 index 000000000000..fb8dd6f7a855 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2252738813.rb @@ -0,0 +1,43 @@ +# Create a new dashboard with apm metrics widget + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::TableWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + type: DatadogAPIClient::V1::TableWidgetDefinitionType::QUERY_TABLE, + requests: [ + DatadogAPIClient::V1::TableWidgetRequest.new({ + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionApmMetricsQueryDefinition.new({ + stat: DatadogAPIClient::V1::FormulaAndFunctionApmMetricStatName::HITS, + name: "query1", + service: "web-store", + data_source: DatadogAPIClient::V1::FormulaAndFunctionApmMetricsDataSource::APM_METRICS, + query_filter: "env:prod", + group_by: [ + "resource_name", + ], + }), + ], + }), + ], + }), + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 4, + height: 4, + }), + }), + ], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, +}) +p api_instance.create_dashboard(body) diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index bf8e47ce3b67..2541faab2d19 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -329,6 +329,20 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].primary_tag_name" is equal to "datacenter" And the response "widgets[0].definition.requests[0].queries[0].operation_name" is equal to "cassandra.query" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with apm metrics widget + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "query_table", "requests": [ { "response_format": "scalar", "queries": [ { "stat": "hits", "name": "query1", "service": "web-store", "data_source": "apm_metrics", "query_filter": "env:prod", "group_by": ["resource_name"] } ] } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" + And the response "widgets[0].definition.requests[0].queries[0].stat" is equal to "hits" + And the response "widgets[0].definition.requests[0].queries[0].group_by[0]" is equal to "resource_name" + And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1" + And the response "widgets[0].definition.requests[0].queries[0].service" is equal to "web-store" + And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "apm_metrics" + And the response "widgets[0].definition.requests[0].queries[0].query_filter" is equal to "env:prod" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with apm resource stats widget Given new "CreateDashboard" request diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index f42e819d682d..595aa63f3572 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -132,6 +132,10 @@ def overrides "v1.formula_and_function_apm_dependency_stat_name" => "FormulaAndFunctionApmDependencyStatName", "v1.formula_and_function_apm_dependency_stats_data_source" => "FormulaAndFunctionApmDependencyStatsDataSource", "v1.formula_and_function_apm_dependency_stats_query_definition" => "FormulaAndFunctionApmDependencyStatsQueryDefinition", + "v1.formula_and_function_apm_metrics_data_source" => "FormulaAndFunctionApmMetricsDataSource", + "v1.formula_and_function_apm_metrics_query_definition" => "FormulaAndFunctionApmMetricsQueryDefinition", + "v1.formula_and_function_apm_metrics_span_kind" => "FormulaAndFunctionApmMetricsSpanKind", + "v1.formula_and_function_apm_metric_stat_name" => "FormulaAndFunctionApmMetricStatName", "v1.formula_and_function_apm_resource_stat_name" => "FormulaAndFunctionApmResourceStatName", "v1.formula_and_function_apm_resource_stats_data_source" => "FormulaAndFunctionApmResourceStatsDataSource", "v1.formula_and_function_apm_resource_stats_query_definition" => "FormulaAndFunctionApmResourceStatsQueryDefinition", diff --git a/lib/datadog_api_client/v1/models/formula_and_function_apm_metric_stat_name.rb b/lib/datadog_api_client/v1/models/formula_and_function_apm_metric_stat_name.rb new file mode 100644 index 000000000000..05e8c0e827ed --- /dev/null +++ b/lib/datadog_api_client/v1/models/formula_and_function_apm_metric_stat_name.rb @@ -0,0 +1,41 @@ +=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 + # APM metric stat name. + class FormulaAndFunctionApmMetricStatName + include BaseEnumModel + + ERRORS = "errors".freeze + ERROR_RATE = "error_rate".freeze + ERRORS_PER_SECOND = "errors_per_second".freeze + LATENCY_AVG = "latency_avg".freeze + LATENCY_MAX = "latency_max".freeze + LATENCY_P50 = "latency_p50".freeze + LATENCY_P75 = "latency_p75".freeze + LATENCY_P90 = "latency_p90".freeze + LATENCY_P95 = "latency_p95".freeze + LATENCY_P99 = "latency_p99".freeze + LATENCY_P999 = "latency_p999".freeze + LATENCY_DISTRIBUTION = "latency_distribution".freeze + HITS = "hits".freeze + HITS_PER_SECOND = "hits_per_second".freeze + TOTAL_TIME = "total_time".freeze + APDEX = "apdex".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_data_source.rb b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_data_source.rb new file mode 100644 index 000000000000..3616cbb8029d --- /dev/null +++ b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_data_source.rb @@ -0,0 +1,26 @@ +=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 + # Data source for APM metrics queries. + class FormulaAndFunctionApmMetricsDataSource + include BaseEnumModel + + APM_METRICS = "apm_metrics".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_query_definition.rb b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_query_definition.rb new file mode 100644 index 000000000000..7cdf28bd23f1 --- /dev/null +++ b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_query_definition.rb @@ -0,0 +1,259 @@ +=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 formula and functions APM metrics query. + class FormulaAndFunctionApmMetricsQueryDefinition + include BaseGenericModel + + # Data source for APM metrics queries. + attr_reader :data_source + + # Optional fields to group the query results by. + attr_accessor :group_by + + # Name of this query to use in formulas. + attr_reader :name + + # Optional operation mode to aggregate across operation names. + attr_accessor :operation_mode + + # Name of operation on service. If not provided, the primary operation name is used. + attr_accessor :operation_name + + # Tags to query for a specific downstream entity (peer.service, peer.db_instance, peer.s3, peer.s3.bucket, etc.). + attr_accessor :peer_tags + + # Additional filters for the query using metrics query syntax (e.g., env, primary_tag). + attr_accessor :query_filter + + # The hash of a specific resource to filter by. + attr_accessor :resource_hash + + # The full name of a specific resource to filter by. + attr_accessor :resource_name + + # APM service name. + attr_accessor :service + + # Describes the relationship between the span, its parents, and its children in a trace. + attr_accessor :span_kind + + # APM metric stat name. + attr_reader :stat + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data_source' => :'data_source', + :'group_by' => :'group_by', + :'name' => :'name', + :'operation_mode' => :'operation_mode', + :'operation_name' => :'operation_name', + :'peer_tags' => :'peer_tags', + :'query_filter' => :'query_filter', + :'resource_hash' => :'resource_hash', + :'resource_name' => :'resource_name', + :'service' => :'service', + :'span_kind' => :'span_kind', + :'stat' => :'stat' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data_source' => :'FormulaAndFunctionApmMetricsDataSource', + :'group_by' => :'Array', + :'name' => :'String', + :'operation_mode' => :'String', + :'operation_name' => :'String', + :'peer_tags' => :'Array', + :'query_filter' => :'String', + :'resource_hash' => :'String', + :'resource_name' => :'String', + :'service' => :'String', + :'span_kind' => :'FormulaAndFunctionApmMetricsSpanKind', + :'stat' => :'FormulaAndFunctionApmMetricStatName' + } + 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::FormulaAndFunctionApmMetricsQueryDefinition` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data_source') + self.data_source = attributes[:'data_source'] + end + + if attributes.key?(:'group_by') + if (value = attributes[:'group_by']).is_a?(Array) + self.group_by = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'operation_mode') + self.operation_mode = attributes[:'operation_mode'] + end + + if attributes.key?(:'operation_name') + self.operation_name = attributes[:'operation_name'] + end + + if attributes.key?(:'peer_tags') + if (value = attributes[:'peer_tags']).is_a?(Array) + self.peer_tags = value + end + end + + if attributes.key?(:'query_filter') + self.query_filter = attributes[:'query_filter'] + end + + if attributes.key?(:'resource_hash') + self.resource_hash = attributes[:'resource_hash'] + end + + if attributes.key?(:'resource_name') + self.resource_name = attributes[:'resource_name'] + end + + if attributes.key?(:'service') + self.service = attributes[:'service'] + end + + if attributes.key?(:'span_kind') + self.span_kind = attributes[:'span_kind'] + end + + if attributes.key?(:'stat') + self.stat = attributes[:'stat'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data_source.nil? + return false if @name.nil? + return false if @stat.nil? + true + end + + # Custom attribute writer method with validation + # @param data_source [Object] Object to be assigned + # @!visibility private + def data_source=(data_source) + if data_source.nil? + fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.' + end + @data_source = data_source + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param stat [Object] Object to be assigned + # @!visibility private + def stat=(stat) + if stat.nil? + fail ArgumentError, 'invalid value for "stat", stat cannot be nil.' + end + @stat = stat + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data_source == o.data_source && + group_by == o.group_by && + name == o.name && + operation_mode == o.operation_mode && + operation_name == o.operation_name && + peer_tags == o.peer_tags && + query_filter == o.query_filter && + resource_hash == o.resource_hash && + resource_name == o.resource_name && + service == o.service && + span_kind == o.span_kind && + stat == o.stat && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data_source, group_by, name, operation_mode, operation_name, peer_tags, query_filter, resource_hash, resource_name, service, span_kind, stat, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_span_kind.rb b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_span_kind.rb new file mode 100644 index 000000000000..e72c6e3ee796 --- /dev/null +++ b/lib/datadog_api_client/v1/models/formula_and_function_apm_metrics_span_kind.rb @@ -0,0 +1,30 @@ +=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 + # Describes the relationship between the span, its parents, and its children in a trace. + class FormulaAndFunctionApmMetricsSpanKind + include BaseEnumModel + + CONSUMER = "consumer".freeze + SERVER = "server".freeze + CLIENT = "client".freeze + PRODUCER = "producer".freeze + INTERNAL = "internal".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb b/lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb index 49fa5577b4e9..7b050225df10 100644 --- a/lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb +++ b/lib/datadog_api_client/v1/models/formula_and_function_query_definition.rb @@ -31,6 +31,7 @@ def openapi_one_of :'FormulaAndFunctionProcessQueryDefinition', :'FormulaAndFunctionApmDependencyStatsQueryDefinition', :'FormulaAndFunctionApmResourceStatsQueryDefinition', + :'FormulaAndFunctionApmMetricsQueryDefinition', :'FormulaAndFunctionSLOQueryDefinition', :'FormulaAndFunctionCloudCostQueryDefinition' ] From 52944367062f36ac8894d19ed30d82f9add12a0c Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 09:35:41 -0400 Subject: [PATCH 2/3] Regenerate client from commit b951844 of spec repo (#3136) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v1/openapi.yaml | 76 ++++++ lib/datadog_api_client/inflector.rb | 5 + .../v1/models/widget_definition.rb | 3 +- .../v1/models/wildcard_widget_definition.rb | 219 ++++++++++++++++++ .../models/wildcard_widget_definition_type.rb | 26 +++ .../v1/models/wildcard_widget_request.rb | 65 ++++++ .../models/wildcard_widget_specification.rb | 144 ++++++++++++ .../wildcard_widget_specification_type.rb | 27 +++ 8 files changed, 564 insertions(+), 1 deletion(-) create mode 100644 lib/datadog_api_client/v1/models/wildcard_widget_definition.rb create mode 100644 lib/datadog_api_client/v1/models/wildcard_widget_definition_type.rb create mode 100644 lib/datadog_api_client/v1/models/wildcard_widget_request.rb create mode 100644 lib/datadog_api_client/v1/models/wildcard_widget_specification.rb create mode 100644 lib/datadog_api_client/v1/models/wildcard_widget_specification_type.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 419af73cfbe7..4b8fb50414e5 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -24274,6 +24274,7 @@ components: - $ref: "#/components/schemas/ToplistWidgetDefinition" - $ref: "#/components/schemas/TopologyMapWidgetDefinition" - $ref: "#/components/schemas/TreeMapWidgetDefinition" + - $ref: "#/components/schemas/WildcardWidgetDefinition" WidgetDisplayType: description: Type of display to use for the request. enum: @@ -25045,6 +25046,81 @@ components: x-enum-varnames: - TIMESERIES - TOPLIST + WildcardWidgetDefinition: + description: >- + Custom visualization widget using Vega or Vega-Lite specifications. Combines standard Datadog data requests with a Vega or Vega-Lite JSON specification for flexible, custom visualizations. + properties: + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + requests: + description: List of data requests for the wildcard widget. + example: [{"formulas": ["formula": "query1"], "queries": [{"aggregator": "avg", "data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {env}"}], "response_format": "scalar"}] + items: + $ref: "#/components/schemas/WildcardWidgetRequest" + type: array + specification: + $ref: "#/components/schemas/WildcardWidgetSpecification" + time: + $ref: "#/components/schemas/WidgetTime" + title: + description: Title of the widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/WildcardWidgetDefinitionType" + required: + - type + - requests + - specification + type: object + WildcardWidgetDefinitionType: + default: wildcard + description: Type of the wildcard widget. + enum: + - wildcard + example: wildcard + type: string + x-enum-varnames: + - WILDCARD + WildcardWidgetRequest: + description: >- + Request object for the wildcard widget. Each variant represents a distinct data-fetching pattern: scalar formulas, timeseries formulas, list streams, and histograms. + oneOf: + - $ref: "#/components/schemas/TreeMapWidgetRequest" + - $ref: "#/components/schemas/TimeseriesWidgetRequest" + - $ref: "#/components/schemas/ListStreamWidgetRequest" + - $ref: "#/components/schemas/DistributionWidgetRequest" + WildcardWidgetSpecification: + description: >- + Vega or Vega-Lite specification for custom visualization rendering. See https://vega.github.io/vega-lite/ for the full grammar reference. + properties: + contents: + description: The Vega or Vega-Lite JSON specification object. + example: {"$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": {"name": "table1"}, "description": "A simple bar chart", "encoding": {"x": {"field": "env", "sort": "-y", "type": "nominal"}, "y": {"field": "query1", "type": "quantitative"}}, "mark": "bar"} + type: object + type: + $ref: "#/components/schemas/WildcardWidgetSpecificationType" + required: + - type + - contents + type: object + WildcardWidgetSpecificationType: + description: Type of specification used by the wildcard widget. + enum: + - vega + - vega-lite + example: vega-lite + type: string + x-enum-varnames: + - VEGA + - VEGA_LITE securitySchemes: AuthZ: description: This API uses OAuth 2 with the implicit grant flow. diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 595aa63f3572..e203df18ba9a 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1030,6 +1030,11 @@ def overrides "v1.widget_vertical_align" => "WidgetVerticalAlign", "v1.widget_view_mode" => "WidgetViewMode", "v1.widget_viz_type" => "WidgetVizType", + "v1.wildcard_widget_definition" => "WildcardWidgetDefinition", + "v1.wildcard_widget_definition_type" => "WildcardWidgetDefinitionType", + "v1.wildcard_widget_request" => "WildcardWidgetRequest", + "v1.wildcard_widget_specification" => "WildcardWidgetSpecification", + "v1.wildcard_widget_specification_type" => "WildcardWidgetSpecificationType", "v2.account_filtering_config" => "AccountFilteringConfig", "v2.action_connection_attributes" => "ActionConnectionAttributes", "v2.action_connection_attributes_update" => "ActionConnectionAttributesUpdate", diff --git a/lib/datadog_api_client/v1/models/widget_definition.rb b/lib/datadog_api_client/v1/models/widget_definition.rb index c7c3f6f992e4..44abec34681d 100644 --- a/lib/datadog_api_client/v1/models/widget_definition.rb +++ b/lib/datadog_api_client/v1/models/widget_definition.rb @@ -61,7 +61,8 @@ def openapi_one_of :'TimeseriesWidgetDefinition', :'ToplistWidgetDefinition', :'TopologyMapWidgetDefinition', - :'TreeMapWidgetDefinition' + :'TreeMapWidgetDefinition', + :'WildcardWidgetDefinition' ] end # Builds the object diff --git a/lib/datadog_api_client/v1/models/wildcard_widget_definition.rb b/lib/datadog_api_client/v1/models/wildcard_widget_definition.rb new file mode 100644 index 000000000000..7b32b7aeca5a --- /dev/null +++ b/lib/datadog_api_client/v1/models/wildcard_widget_definition.rb @@ -0,0 +1,219 @@ +=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 + # Custom visualization widget using Vega or Vega-Lite specifications. Combines standard Datadog data requests with a Vega or Vega-Lite JSON specification for flexible, custom visualizations. + class WildcardWidgetDefinition + include BaseGenericModel + + # List of custom links. + attr_accessor :custom_links + + # List of data requests for the wildcard widget. + attr_reader :requests + + # Vega or Vega-Lite specification for custom visualization rendering. See https://vega.github.io/vega-lite/ for the full grammar reference. + attr_reader :specification + + # Time setting for the widget. + attr_accessor :time + + # Title of the widget. + attr_accessor :title + + # How to align the text on the widget. + attr_accessor :title_align + + # Size of the title. + attr_accessor :title_size + + # Type of the wildcard widget. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'custom_links' => :'custom_links', + :'requests' => :'requests', + :'specification' => :'specification', + :'time' => :'time', + :'title' => :'title', + :'title_align' => :'title_align', + :'title_size' => :'title_size', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'custom_links' => :'Array', + :'requests' => :'Array', + :'specification' => :'WildcardWidgetSpecification', + :'time' => :'WidgetTime', + :'title' => :'String', + :'title_align' => :'WidgetTextAlign', + :'title_size' => :'String', + :'type' => :'WildcardWidgetDefinitionType' + } + 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::WildcardWidgetDefinition` 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?(:'custom_links') + if (value = attributes[:'custom_links']).is_a?(Array) + self.custom_links = value + end + end + + if attributes.key?(:'requests') + if (value = attributes[:'requests']).is_a?(Array) + self.requests = value + end + end + + if attributes.key?(:'specification') + self.specification = attributes[:'specification'] + end + + if attributes.key?(:'time') + self.time = attributes[:'time'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'title_align') + self.title_align = attributes[:'title_align'] + end + + if attributes.key?(:'title_size') + self.title_size = attributes[:'title_size'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @requests.nil? + return false if @specification.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param requests [Object] Object to be assigned + # @!visibility private + def requests=(requests) + if requests.nil? + fail ArgumentError, 'invalid value for "requests", requests cannot be nil.' + end + @requests = requests + end + + # Custom attribute writer method with validation + # @param specification [Object] Object to be assigned + # @!visibility private + def specification=(specification) + if specification.nil? + fail ArgumentError, 'invalid value for "specification", specification cannot be nil.' + end + @specification = specification + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + custom_links == o.custom_links && + requests == o.requests && + specification == o.specification && + time == o.time && + title == o.title && + title_align == o.title_align && + title_size == o.title_size && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [custom_links, requests, specification, time, title, title_align, title_size, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/wildcard_widget_definition_type.rb b/lib/datadog_api_client/v1/models/wildcard_widget_definition_type.rb new file mode 100644 index 000000000000..85f1816add71 --- /dev/null +++ b/lib/datadog_api_client/v1/models/wildcard_widget_definition_type.rb @@ -0,0 +1,26 @@ +=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 + # Type of the wildcard widget. + class WildcardWidgetDefinitionType + include BaseEnumModel + + WILDCARD = "wildcard".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/wildcard_widget_request.rb b/lib/datadog_api_client/v1/models/wildcard_widget_request.rb new file mode 100644 index 000000000000..1c85ea35edf0 --- /dev/null +++ b/lib/datadog_api_client/v1/models/wildcard_widget_request.rb @@ -0,0 +1,65 @@ +=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 + # Request object for the wildcard widget. Each variant represents a distinct data-fetching pattern: scalar formulas, timeseries formulas, list streams, and histograms. + module WildcardWidgetRequest + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'TreeMapWidgetRequest', + :'TimeseriesWidgetRequest', + :'ListStreamWidgetRequest', + :'DistributionWidgetRequest' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/wildcard_widget_specification.rb b/lib/datadog_api_client/v1/models/wildcard_widget_specification.rb new file mode 100644 index 000000000000..1329fc8b3628 --- /dev/null +++ b/lib/datadog_api_client/v1/models/wildcard_widget_specification.rb @@ -0,0 +1,144 @@ +=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 + # Vega or Vega-Lite specification for custom visualization rendering. See https://vega.github.io/vega-lite/ for the full grammar reference. + class WildcardWidgetSpecification + include BaseGenericModel + + # The Vega or Vega-Lite JSON specification object. + attr_reader :contents + + # Type of specification used by the wildcard widget. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'contents' => :'contents', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'contents' => :'Object', + :'type' => :'WildcardWidgetSpecificationType' + } + 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::WildcardWidgetSpecification` 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?(:'contents') + self.contents = attributes[:'contents'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @contents.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param contents [Object] Object to be assigned + # @!visibility private + def contents=(contents) + if contents.nil? + fail ArgumentError, 'invalid value for "contents", contents cannot be nil.' + end + @contents = contents + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + contents == o.contents && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [contents, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/wildcard_widget_specification_type.rb b/lib/datadog_api_client/v1/models/wildcard_widget_specification_type.rb new file mode 100644 index 000000000000..51dc261fa43d --- /dev/null +++ b/lib/datadog_api_client/v1/models/wildcard_widget_specification_type.rb @@ -0,0 +1,27 @@ +=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 + # Type of specification used by the wildcard widget. + class WildcardWidgetSpecificationType + include BaseEnumModel + + VEGA = "vega".freeze + VEGA_LITE = "vega-lite".freeze + end +end From 80a165645667de63a09f6d2960e10aa4c007cbf3 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 15:42:42 +0100 Subject: [PATCH 3/3] Regenerate client from commit ff181ed of spec repo (#3170) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 252 +++++++++++++++ .../synthetics/GetSyntheticsFastTestResult.rb | 5 + features/scenarios_model_mapping.rb | 3 + features/v2/synthetics.feature | 14 + features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 9 + .../v2/api/synthetics_api.rb | 62 ++++ .../v2/models/synthetics_fast_test_result.rb | 106 +++++++ .../synthetics_fast_test_result_attributes.rb | 156 ++++++++++ .../synthetics_fast_test_result_data.rb | 125 ++++++++ .../synthetics_fast_test_result_detail.rb | 292 ++++++++++++++++++ .../synthetics_fast_test_result_device.rb | 115 +++++++ .../synthetics_fast_test_result_failure.rb | 115 +++++++ .../synthetics_fast_test_result_location.rb | 135 ++++++++ .../synthetics_fast_test_result_type.rb | 26 ++ .../models/synthetics_fast_test_sub_type.rb | 35 +++ 16 files changed, 1456 insertions(+) create mode 100644 examples/v2/synthetics/GetSyntheticsFastTestResult.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_data.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_detail.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_device.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_failure.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_location.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_result_type.rb create mode 100644 lib/datadog_api_client/v2/models/synthetics_fast_test_sub_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4613e9536254..4b32533f7350 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -64486,6 +64486,214 @@ components: description: The direction and type of synchronization for this property. type: string type: object + SyntheticsFastTestAssertionResult: + additionalProperties: {} + description: Result of a single assertion evaluated during a fast test run. + type: object + SyntheticsFastTestResult: + description: |- + Fast test result response. Returns `null` if the result is not yet available + (the test is still running or timed out before completing). + nullable: true + properties: + data: + $ref: "#/components/schemas/SyntheticsFastTestResultData" + type: object + SyntheticsFastTestResultAttributes: + description: Attributes of the fast test result. + properties: + device: + $ref: "#/components/schemas/SyntheticsFastTestResultDevice" + location: + $ref: "#/components/schemas/SyntheticsFastTestResultLocation" + result: + $ref: "#/components/schemas/SyntheticsFastTestResultDetail" + test_sub_type: + $ref: "#/components/schemas/SyntheticsFastTestSubType" + test_type: + description: The type of the Synthetic test that produced this result (for example, `api` or `browser`). + example: api + type: string + test_version: + description: Version of the test at the time the fast test was triggered. + format: int64 + type: integer + type: object + SyntheticsFastTestResultData: + description: Fast test result data object (JSON:API format). + properties: + attributes: + $ref: "#/components/schemas/SyntheticsFastTestResultAttributes" + id: + description: The UUID of the fast test, used as the result identifier. + example: abc12345-1234-1234-1234-abc123456789 + type: string + type: + $ref: "#/components/schemas/SyntheticsFastTestResultType" + type: object + SyntheticsFastTestResultDetail: + description: |- + Detailed result data for the fast test run. The exact shape of nested fields + (`request`, `response`, `assertions`, etc.) depends on the test subtype. + properties: + assertions: + description: Results of each assertion evaluated during the test. + items: + $ref: "#/components/schemas/SyntheticsFastTestAssertionResult" + type: array + call_type: + description: gRPC call type (for example, `unary`, `healthCheck`, or `reflection`). + type: string + cert: + additionalProperties: {} + description: TLS certificate details, present for SSL tests. + type: object + duration: + description: Total duration of the test in milliseconds. + format: double + type: number + failure: + $ref: "#/components/schemas/SyntheticsFastTestResultFailure" + finished_at: + description: Unix timestamp (ms) of when the test finished. + format: int64 + type: integer + id: + description: The result ID. Set to the fast test UUID because no persistent result ID exists for fast tests. + type: string + is_fast_retry: + description: Whether this result is from an automatic fast retry. + type: boolean + request: + additionalProperties: {} + description: Details of the outgoing request made during the test. + type: object + resolved_ip: + description: IP address resolved for the target host. + example: "1.2.3.4" + type: string + response: + additionalProperties: {} + description: Details of the response received during the test. + type: object + run_type: + description: Run type indicating how this test was triggered (for example, `fast`). + type: string + started_at: + description: Unix timestamp (ms) of when the test started. + format: int64 + type: integer + status: + description: Status of the test result (`passed` or `failed`). + example: passed + type: string + steps: + description: Step results for multistep API tests. + items: + $ref: "#/components/schemas/SyntheticsFastTestStepResult" + type: array + timings: + additionalProperties: {} + description: Timing breakdown of the test request phases (for example, DNS, TCP, TLS, first byte). + type: object + traceroute: + description: Traceroute hop results, present for ICMP and TCP tests. + items: + $ref: "#/components/schemas/SyntheticsFastTestTracerouteHop" + type: array + triggered_at: + description: Unix timestamp (ms) of when the test was triggered. + format: int64 + type: integer + tunnel: + description: Whether the test was run through a Synthetics tunnel. + type: boolean + type: object + SyntheticsFastTestResultDevice: + description: Device information for browser-based fast tests. + properties: + id: + description: Device identifier. + example: chrome.laptop_large + type: string + name: + description: Display name of the device. + example: Laptop Large + type: string + type: object + SyntheticsFastTestResultFailure: + description: Failure details if the fast test did not pass. + properties: + code: + description: Error code identifying the failure type. + example: TIMEOUT + type: string + message: + description: Human-readable description of the failure. + example: Connection timed out + type: string + type: object + SyntheticsFastTestResultLocation: + description: Location from which the fast test was executed. + properties: + id: + description: ID of the location. + example: aws:us-east-1 + type: string + name: + description: Display name of the location. + example: N. Virginia (AWS) + type: string + version: + description: Agent version running at this location. + type: string + worker_id: + description: Identifier of the specific worker that ran the test. + type: string + type: object + SyntheticsFastTestResultType: + default: result + description: JSON:API type for a fast test result. + enum: + - result + example: result + type: string + x-enum-varnames: + - RESULT + SyntheticsFastTestStepResult: + additionalProperties: {} + description: Result of a single step in a multistep fast test run. + type: object + SyntheticsFastTestSubType: + description: Subtype of the Synthetic test that produced this result. + enum: + - dns + - grpc + - http + - icmp + - mcp + - multi + - ssl + - tcp + - udp + - websocket + example: http + type: string + x-enum-varnames: + - DNS + - GRPC + - HTTP + - ICMP + - MCP + - MULTI + - SSL + - TCP + - UDP + - WEBSOCKET + SyntheticsFastTestTracerouteHop: + additionalProperties: {} + description: A single traceroute hop result from a fast test run. + type: object SyntheticsGlobalVariable: description: Synthetic global variable. properties: @@ -106234,6 +106442,50 @@ paths: operator: OR permissions: - synthetics_write + /api/v2/synthetics/tests/fast/{id}: + get: + operationId: GetSyntheticsFastTestResult + parameters: + - description: The UUID of the fast test to retrieve the result for. + in: path + name: id + required: true + schema: + example: abc12345-1234-1234-1234-abc123456789 + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsFastTestResult" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_read + summary: Get a fast test result + tags: + - Synthetics + x-permission: + operator: OR + permissions: + - synthetics_read /api/v2/synthetics/tests/network: post: operationId: CreateSyntheticsNetworkTest diff --git a/examples/v2/synthetics/GetSyntheticsFastTestResult.rb b/examples/v2/synthetics/GetSyntheticsFastTestResult.rb new file mode 100644 index 000000000000..173cbf37fee2 --- /dev/null +++ b/examples/v2/synthetics/GetSyntheticsFastTestResult.rb @@ -0,0 +1,5 @@ +# Get a fast test result returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new +p api_instance.get_synthetics_fast_test_result("abc12345-1234-1234-1234-abc123456789") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 29b67306d803..d0609933ade5 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3952,6 +3952,9 @@ "v2.DeleteSyntheticsTests" => { "body" => "DeletedTestsRequestDeleteRequest", }, + "v2.GetSyntheticsFastTestResult" => { + "id" => "String", + }, "v2.CreateSyntheticsNetworkTest" => { "body" => "SyntheticsNetworkTestEditRequest", }, diff --git a/features/v2/synthetics.feature b/features/v2/synthetics.feature index 16a842cff397..418dbf5fb3ad 100644 --- a/features/v2/synthetics.feature +++ b/features/v2/synthetics.feature @@ -119,6 +119,20 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get a fast test result returns "API error response." response + Given new "GetSyntheticsFastTestResult" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get a fast test result returns "OK" response + Given new "GetSyntheticsFastTestResult" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing Scenario: Get a suite returns "API error response." response Given new "GetSyntheticsSuite" request diff --git a/features/v2/undo.json b/features/v2/undo.json index 210d32399980..0406fd680e56 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5864,6 +5864,12 @@ "type": "idempotent" } }, + "GetSyntheticsFastTestResult": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, "CreateSyntheticsNetworkTest": { "tag": "Synthetics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index e203df18ba9a..ab346bc663c0 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5200,6 +5200,15 @@ def overrides "v2.suppression_versions" => "SuppressionVersions", "v2.sync_property" => "SyncProperty", "v2.sync_property_with_mapping" => "SyncPropertyWithMapping", + "v2.synthetics_fast_test_result" => "SyntheticsFastTestResult", + "v2.synthetics_fast_test_result_attributes" => "SyntheticsFastTestResultAttributes", + "v2.synthetics_fast_test_result_data" => "SyntheticsFastTestResultData", + "v2.synthetics_fast_test_result_detail" => "SyntheticsFastTestResultDetail", + "v2.synthetics_fast_test_result_device" => "SyntheticsFastTestResultDevice", + "v2.synthetics_fast_test_result_failure" => "SyntheticsFastTestResultFailure", + "v2.synthetics_fast_test_result_location" => "SyntheticsFastTestResultLocation", + "v2.synthetics_fast_test_result_type" => "SyntheticsFastTestResultType", + "v2.synthetics_fast_test_sub_type" => "SyntheticsFastTestSubType", "v2.synthetics_global_variable" => "SyntheticsGlobalVariable", "v2.synthetics_global_variable_attributes" => "SyntheticsGlobalVariableAttributes", "v2.synthetics_global_variable_options" => "SyntheticsGlobalVariableOptions", diff --git a/lib/datadog_api_client/v2/api/synthetics_api.rb b/lib/datadog_api_client/v2/api/synthetics_api.rb index e6eb7471c2a0..522309bf2f2f 100644 --- a/lib/datadog_api_client/v2/api/synthetics_api.rb +++ b/lib/datadog_api_client/v2/api/synthetics_api.rb @@ -408,6 +408,68 @@ def get_on_demand_concurrency_cap_with_http_info(opts = {}) return data, status_code, headers end + # Get a fast test result. + # + # @see #get_synthetics_fast_test_result_with_http_info + def get_synthetics_fast_test_result(id, opts = {}) + data, _status_code, _headers = get_synthetics_fast_test_result_with_http_info(id, opts) + data + end + + # Get a fast test result. + # @param id [String] The UUID of the fast test to retrieve the result for. + # @param opts [Hash] the optional parameters + # @return [Array<(SyntheticsFastTestResult, Integer, Hash)>] SyntheticsFastTestResult data, response status code and response headers + def get_synthetics_fast_test_result_with_http_info(id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.get_synthetics_fast_test_result ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SyntheticsAPI.get_synthetics_fast_test_result" + end + # resource path + local_var_path = '/api/v2/synthetics/tests/fast/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SyntheticsFastTestResult' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_synthetics_fast_test_result, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#get_synthetics_fast_test_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a Network Path test. # # @see #get_synthetics_network_test_with_http_info diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result.rb new file mode 100644 index 000000000000..6eea5d4db71a --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result.rb @@ -0,0 +1,106 @@ +=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 + # Fast test result response. Returns `null` if the result is not yet available + # (the test is still running or timed out before completing). + class SyntheticsFastTestResult + include BaseGenericModel + + # Fast test result data object (JSON:API format). + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'SyntheticsFastTestResultData' + } + 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::SyntheticsFastTestResult` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_attributes.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_attributes.rb new file mode 100644 index 000000000000..149f42b84c3e --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_attributes.rb @@ -0,0 +1,156 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the fast test result. + class SyntheticsFastTestResultAttributes + include BaseGenericModel + + # Device information for browser-based fast tests. + attr_accessor :device + + # Location from which the fast test was executed. + attr_accessor :location + + # Detailed result data for the fast test run. The exact shape of nested fields + # (`request`, `response`, `assertions`, etc.) depends on the test subtype. + attr_accessor :result + + # Subtype of the Synthetic test that produced this result. + attr_accessor :test_sub_type + + # The type of the Synthetic test that produced this result (for example, `api` or `browser`). + attr_accessor :test_type + + # Version of the test at the time the fast test was triggered. + attr_accessor :test_version + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'device' => :'device', + :'location' => :'location', + :'result' => :'result', + :'test_sub_type' => :'test_sub_type', + :'test_type' => :'test_type', + :'test_version' => :'test_version' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'device' => :'SyntheticsFastTestResultDevice', + :'location' => :'SyntheticsFastTestResultLocation', + :'result' => :'SyntheticsFastTestResultDetail', + :'test_sub_type' => :'SyntheticsFastTestSubType', + :'test_type' => :'String', + :'test_version' => :'Integer' + } + 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::SyntheticsFastTestResultAttributes` 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?(:'device') + self.device = attributes[:'device'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'test_sub_type') + self.test_sub_type = attributes[:'test_sub_type'] + end + + if attributes.key?(:'test_type') + self.test_type = attributes[:'test_type'] + end + + if attributes.key?(:'test_version') + self.test_version = attributes[:'test_version'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device && + location == o.location && + result == o.result && + test_sub_type == o.test_sub_type && + test_type == o.test_type && + test_version == o.test_version && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [device, location, result, test_sub_type, test_type, test_version, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_data.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_data.rb new file mode 100644 index 000000000000..72ef39d1b5a8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_data.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Fast test result data object (JSON:API format). + class SyntheticsFastTestResultData + include BaseGenericModel + + # Attributes of the fast test result. + attr_accessor :attributes + + # The UUID of the fast test, used as the result identifier. + attr_accessor :id + + # JSON:API type for a fast test result. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'SyntheticsFastTestResultAttributes', + :'id' => :'String', + :'type' => :'SyntheticsFastTestResultType' + } + 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::SyntheticsFastTestResultData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_detail.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_detail.rb new file mode 100644 index 000000000000..d8e60db5a592 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_detail.rb @@ -0,0 +1,292 @@ +=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 + # Detailed result data for the fast test run. The exact shape of nested fields + # (`request`, `response`, `assertions`, etc.) depends on the test subtype. + class SyntheticsFastTestResultDetail + include BaseGenericModel + + # Results of each assertion evaluated during the test. + attr_accessor :assertions + + # gRPC call type (for example, `unary`, `healthCheck`, or `reflection`). + attr_accessor :call_type + + # TLS certificate details, present for SSL tests. + attr_accessor :cert + + # Total duration of the test in milliseconds. + attr_accessor :duration + + # Failure details if the fast test did not pass. + attr_accessor :failure + + # Unix timestamp (ms) of when the test finished. + attr_accessor :finished_at + + # The result ID. Set to the fast test UUID because no persistent result ID exists for fast tests. + attr_accessor :id + + # Whether this result is from an automatic fast retry. + attr_accessor :is_fast_retry + + # Details of the outgoing request made during the test. + attr_accessor :request + + # IP address resolved for the target host. + attr_accessor :resolved_ip + + # Details of the response received during the test. + attr_accessor :response + + # Run type indicating how this test was triggered (for example, `fast`). + attr_accessor :run_type + + # Unix timestamp (ms) of when the test started. + attr_accessor :started_at + + # Status of the test result (`passed` or `failed`). + attr_accessor :status + + # Step results for multistep API tests. + attr_accessor :steps + + # Timing breakdown of the test request phases (for example, DNS, TCP, TLS, first byte). + attr_accessor :timings + + # Traceroute hop results, present for ICMP and TCP tests. + attr_accessor :traceroute + + # Unix timestamp (ms) of when the test was triggered. + attr_accessor :triggered_at + + # Whether the test was run through a Synthetics tunnel. + attr_accessor :tunnel + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'assertions' => :'assertions', + :'call_type' => :'call_type', + :'cert' => :'cert', + :'duration' => :'duration', + :'failure' => :'failure', + :'finished_at' => :'finished_at', + :'id' => :'id', + :'is_fast_retry' => :'is_fast_retry', + :'request' => :'request', + :'resolved_ip' => :'resolved_ip', + :'response' => :'response', + :'run_type' => :'run_type', + :'started_at' => :'started_at', + :'status' => :'status', + :'steps' => :'steps', + :'timings' => :'timings', + :'traceroute' => :'traceroute', + :'triggered_at' => :'triggered_at', + :'tunnel' => :'tunnel' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'assertions' => :'Array>', + :'call_type' => :'String', + :'cert' => :'Hash', + :'duration' => :'Float', + :'failure' => :'SyntheticsFastTestResultFailure', + :'finished_at' => :'Integer', + :'id' => :'String', + :'is_fast_retry' => :'Boolean', + :'request' => :'Hash', + :'resolved_ip' => :'String', + :'response' => :'Hash', + :'run_type' => :'String', + :'started_at' => :'Integer', + :'status' => :'String', + :'steps' => :'Array>', + :'timings' => :'Hash', + :'traceroute' => :'Array>', + :'triggered_at' => :'Integer', + :'tunnel' => :'Boolean' + } + 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::SyntheticsFastTestResultDetail` 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?(:'assertions') + if (value = attributes[:'assertions']).is_a?(Array) + self.assertions = value + end + end + + if attributes.key?(:'call_type') + self.call_type = attributes[:'call_type'] + end + + if attributes.key?(:'cert') + self.cert = attributes[:'cert'] + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + + if attributes.key?(:'failure') + self.failure = attributes[:'failure'] + end + + if attributes.key?(:'finished_at') + self.finished_at = attributes[:'finished_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'is_fast_retry') + self.is_fast_retry = attributes[:'is_fast_retry'] + end + + if attributes.key?(:'request') + self.request = attributes[:'request'] + end + + if attributes.key?(:'resolved_ip') + self.resolved_ip = attributes[:'resolved_ip'] + end + + if attributes.key?(:'response') + self.response = attributes[:'response'] + end + + if attributes.key?(:'run_type') + self.run_type = attributes[:'run_type'] + end + + if attributes.key?(:'started_at') + self.started_at = attributes[:'started_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'steps') + if (value = attributes[:'steps']).is_a?(Array) + self.steps = value + end + end + + if attributes.key?(:'timings') + self.timings = attributes[:'timings'] + end + + if attributes.key?(:'traceroute') + if (value = attributes[:'traceroute']).is_a?(Array) + self.traceroute = value + end + end + + if attributes.key?(:'triggered_at') + self.triggered_at = attributes[:'triggered_at'] + end + + if attributes.key?(:'tunnel') + self.tunnel = attributes[:'tunnel'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + assertions == o.assertions && + call_type == o.call_type && + cert == o.cert && + duration == o.duration && + failure == o.failure && + finished_at == o.finished_at && + id == o.id && + is_fast_retry == o.is_fast_retry && + request == o.request && + resolved_ip == o.resolved_ip && + response == o.response && + run_type == o.run_type && + started_at == o.started_at && + status == o.status && + steps == o.steps && + timings == o.timings && + traceroute == o.traceroute && + triggered_at == o.triggered_at && + tunnel == o.tunnel && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [assertions, call_type, cert, duration, failure, finished_at, id, is_fast_retry, request, resolved_ip, response, run_type, started_at, status, steps, timings, traceroute, triggered_at, tunnel, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_device.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_device.rb new file mode 100644 index 000000000000..a25820dfaea4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_device.rb @@ -0,0 +1,115 @@ +=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 + # Device information for browser-based fast tests. + class SyntheticsFastTestResultDevice + include BaseGenericModel + + # Device identifier. + attr_accessor :id + + # Display name of the device. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsFastTestResultDevice` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_failure.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_failure.rb new file mode 100644 index 000000000000..a7ffb0a28f1c --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_failure.rb @@ -0,0 +1,115 @@ +=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 + # Failure details if the fast test did not pass. + class SyntheticsFastTestResultFailure + include BaseGenericModel + + # Error code identifying the failure type. + attr_accessor :code + + # Human-readable description of the failure. + attr_accessor :message + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'code' => :'code', + :'message' => :'message' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'code' => :'String', + :'message' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsFastTestResultFailure` 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?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + message == o.message && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [code, message, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_location.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_location.rb new file mode 100644 index 000000000000..a955a8278156 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_location.rb @@ -0,0 +1,135 @@ +=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 + # Location from which the fast test was executed. + class SyntheticsFastTestResultLocation + include BaseGenericModel + + # ID of the location. + attr_accessor :id + + # Display name of the location. + attr_accessor :name + + # Agent version running at this location. + attr_accessor :version + + # Identifier of the specific worker that ran the test. + attr_accessor :worker_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'version' => :'version', + :'worker_id' => :'worker_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'version' => :'String', + :'worker_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsFastTestResultLocation` 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + + if attributes.key?(:'worker_id') + self.worker_id = attributes[:'worker_id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + version == o.version && + worker_id == o.worker_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, name, version, worker_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_result_type.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_type.rb new file mode 100644 index 000000000000..5bdae15c8fe2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_result_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API type for a fast test result. + class SyntheticsFastTestResultType + include BaseEnumModel + + RESULT = "result".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_fast_test_sub_type.rb b/lib/datadog_api_client/v2/models/synthetics_fast_test_sub_type.rb new file mode 100644 index 000000000000..cdb5dd4df12e --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_fast_test_sub_type.rb @@ -0,0 +1,35 @@ +=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 + # Subtype of the Synthetic test that produced this result. + class SyntheticsFastTestSubType + include BaseEnumModel + + DNS = "dns".freeze + GRPC = "grpc".freeze + HTTP = "http".freeze + ICMP = "icmp".freeze + MCP = "mcp".freeze + MULTI = "multi".freeze + SSL = "ssl".freeze + TCP = "tcp".freeze + UDP = "udp".freeze + WEBSOCKET = "websocket".freeze + end +end