From a4d40414b8087c162b7a92a651d232845028afa0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 9 Jun 2022 17:30:30 +0000 Subject: [PATCH] Regenerate client from commit 4569968f of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 158 ++++++++++++++++ .../v1/metrics/SubmitDistributionPoints.rb | 22 +++ .../SubmitDistributionPoints_3109558960.rb | 25 +++ features/v1/metrics.feature | 36 ++++ features/v1/undo.json | 6 + lib/datadog_api_client/v1.rb | 5 + lib/datadog_api_client/v1/api/metrics_api.rb | 81 ++++++++ .../v1/models/distribution_point_item.rb | 63 ++++++ .../distribution_points_content_encoding.rb | 26 +++ .../v1/models/distribution_points_payload.rb | 124 ++++++++++++ .../v1/models/distribution_points_series.rb | 179 ++++++++++++++++++ .../v1/models/distribution_points_type.rb | 26 +++ 13 files changed, 755 insertions(+), 4 deletions(-) create mode 100644 examples/v1/metrics/SubmitDistributionPoints.rb create mode 100644 examples/v1/metrics/SubmitDistributionPoints_3109558960.rb create mode 100644 lib/datadog_api_client/v1/models/distribution_point_item.rb create mode 100644 lib/datadog_api_client/v1/models/distribution_points_content_encoding.rb create mode 100644 lib/datadog_api_client/v1/models/distribution_points_payload.rb create mode 100644 lib/datadog_api_client/v1/models/distribution_points_series.rb create mode 100644 lib/datadog_api_client/v1/models/distribution_points_type.rb diff --git a/.apigentools-info b/.apigentools-info index 26beb5152758..af36d54f3e83 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-06-09 11:12:58.922194", - "spec_repo_commit": "b9e36dc8" + "regenerated": "2022-06-09 17:30:06.110434", + "spec_repo_commit": "4569968f" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-06-09 11:12:58.935757", - "spec_repo_commit": "b9e36dc8" + "regenerated": "2022-06-09 17:30:06.124282", + "spec_repo_commit": "4569968f" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 9ead9ed0bb88..db0fb4b0c533 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1299,6 +1299,96 @@ components: type: integer readOnly: true type: object + DistributionPoint: + description: Array of distribution points. + example: + - 1575317847.0 + - - 0.5 + - 1.0 + items: + description: List of distribution point. + oneOf: + - $ref: '#/components/schemas/DistributionPointTimestamp' + - $ref: '#/components/schemas/DistributionPointData' + maxItems: 2 + minItems: 2 + type: array + DistributionPointData: + description: Distribution point data. + items: + description: List of distribution point data. + format: double + type: number + type: array + DistributionPointTimestamp: + description: Distribution point timestamp. It should be in seconds and current. + format: double + type: number + DistributionPointsContentEncoding: + description: HTTP header used to compress the media-type. + enum: + - deflate + type: string + x-enum-varnames: + - DEFLATE + DistributionPointsPayload: + description: The distribution points payload. + properties: + series: + description: A list of distribution points series to submit to Datadog. + example: + - metric: system.load.1 + points: + - - 1475317847.0 + - - 1.0 + - 2.0 + items: + $ref: '#/components/schemas/DistributionPointsSeries' + type: array + required: + - series + type: object + DistributionPointsSeries: + description: A distribution points metric to submit to Datadog. + properties: + host: + description: The name of the host that produced the distribution point metric. + example: test.example.com + type: string + metric: + description: The name of the distribution points metric. + example: system.load.1 + type: string + points: + description: Points relating to the distribution point metric. All points + must be tuples with timestamp and a list of values (cannot be a string). + Timestamps should be in POSIX time in seconds. + items: + $ref: '#/components/schemas/DistributionPoint' + type: array + tags: + description: A list of tags associated with the distribution point metric. + example: + - environment:test + items: + description: Individual tags. + type: string + type: array + type: + $ref: '#/components/schemas/DistributionPointsType' + required: + - metric + - points + type: object + DistributionPointsType: + default: distribution + description: The type of the distribution point. + enum: + - distribution + example: distribution + type: string + x-enum-varnames: + - DISTRIBUTION DistributionWidgetDefinition: description: "The Distribution visualization is another way of showing metrics\naggregated across one or several tags, such as hosts.\nUnlike the heat map, a distribution @@ -18016,6 +18106,74 @@ paths: x-menu-order: 6 x-undo: type: idempotent + /api/v1/distribution_points: + post: + description: "The distribution points end-point allows you to post distribution + data that can be graphed on Datadog\u2019s dashboards." + operationId: SubmitDistributionPoints + parameters: + - description: HTTP header used to compress the media-type. + in: header + name: Content-Encoding + required: false + schema: + $ref: '#/components/schemas/DistributionPointsContentEncoding' + requestBody: + content: + text/json: + examples: + dynamic-points: + description: "Post time-series data that can be graphed on Datadog\u2019s + dashboards." + externalValue: examples/metrics/distribution-points.json.sh + summary: Dynamic Points + x-variables: + NOW: $(date +%s) + schema: + $ref: '#/components/schemas/DistributionPointsPayload' + required: true + responses: + '202': + content: + text/json: + schema: + $ref: '#/components/schemas/IntakePayloadAccepted' + description: Payload accepted + '400': + content: + text/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + text/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '408': + content: + text/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Request timeout + '413': + content: + text/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Payload too large + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + summary: Submit distribution points + tags: + - Metrics + x-codegen-request-body-name: body + x-menu-order: 1 + x-undo: + type: safe /api/v1/downtime: get: description: Get all scheduled downtimes. diff --git a/examples/v1/metrics/SubmitDistributionPoints.rb b/examples/v1/metrics/SubmitDistributionPoints.rb new file mode 100644 index 000000000000..1752ba40bc2b --- /dev/null +++ b/examples/v1/metrics/SubmitDistributionPoints.rb @@ -0,0 +1,22 @@ +# Submit distribution points returns "Payload accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::MetricsAPI.new + +body = DatadogAPIClient::V1::DistributionPointsPayload.new({ + series: [ + DatadogAPIClient::V1::DistributionPointsSeries.new({ + metric: "system.load.1.dist", + points: [ + [ + Time.now, + [ + 1.0, + 2.0, + ], + ], + ], + }), + ], +}) +p api_instance.submit_distribution_points(body) diff --git a/examples/v1/metrics/SubmitDistributionPoints_3109558960.rb b/examples/v1/metrics/SubmitDistributionPoints_3109558960.rb new file mode 100644 index 000000000000..a811a9d73740 --- /dev/null +++ b/examples/v1/metrics/SubmitDistributionPoints_3109558960.rb @@ -0,0 +1,25 @@ +# Submit deflate distribution points returns "Payload accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::MetricsAPI.new + +body = DatadogAPIClient::V1::DistributionPointsPayload.new({ + series: [ + DatadogAPIClient::V1::DistributionPointsSeries.new({ + metric: "system.load.1.dist", + points: [ + [ + Time.now, + [ + 1.0, + 2.0, + ], + ], + ], + }), + ], +}) +opts = { + content_encoding: DistributionPointsContentEncoding::DEFLATE, +} +p api_instance.submit_distribution_points(body, opts) diff --git a/features/v1/metrics.feature b/features/v1/metrics.feature index 83ce8b87d0f4..c4ba8c3c4581 100644 --- a/features/v1/metrics.feature +++ b/features/v1/metrics.feature @@ -108,6 +108,14 @@ Feature: Metrics When the request is sent Then the response status is 200 OK + @integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-aggregation + Scenario: Submit deflate distribution points returns "Payload accepted" response + Given new "SubmitDistributionPoints" request + And body with value {"series": [{"metric": "system.load.1.dist", "points": [[{{ timestamp("now") }}, [1.0, 2.0]]]}]} + And request contains "Content-Encoding" parameter with value "deflate" + When the request is sent + Then the response status is 202 Payload accepted + @integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-intake @team:DataDog/metrics-query Scenario: Submit deflate metrics returns "Payload accepted" response Given new "SubmitMetrics" request @@ -116,6 +124,34 @@ Feature: Metrics When the request is sent Then the response status is 202 Payload accepted + @integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-aggregation + Scenario: Submit distribution points returns "Bad Request" response + Given new "SubmitDistributionPoints" request + And body with value {"series": [{"metric": "system.load.1.dist", "points": [[1475317847.0, 1.0]]}]} + When the request is sent + Then the response status is 400 Bad Request + + @integration-only @skip-terraform-config @skip-validation @team:DataDog/metrics-aggregation + Scenario: Submit distribution points returns "Payload accepted" response + Given new "SubmitDistributionPoints" request + And body with value {"series": [{"metric": "system.load.1.dist", "points": [[{{ timestamp("now") }}, [1.0, 2.0]]]}]} + When the request is sent + Then the response status is 202 Payload accepted + + @generated @skip @team:DataDog/metrics-aggregation + Scenario: Submit distribution points returns "Payload too large" response + Given new "SubmitDistributionPoints" request + And body with value {"series": [{"metric": "system.load.1", "points": [[1475317847.0, [1.0, 2.0]]]}]} + When the request is sent + Then the response status is 413 Payload too large + + @generated @skip @team:DataDog/metrics-aggregation + Scenario: Submit distribution points returns "Request timeout" response + Given new "SubmitDistributionPoints" request + And body with value {"series": [{"metric": "system.load.1", "points": [[1475317847.0, [1.0, 2.0]]]}]} + When the request is sent + Then the response status is 408 Request timeout + @skip @team:DataDog/metrics-intake @team:DataDog/metrics-query Scenario: Submit metrics returns "Bad Request" response Given new "SubmitMetrics" request diff --git a/features/v1/undo.json b/features/v1/undo.json index 8beccafa24ea..5395670714a4 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -183,6 +183,12 @@ "type": "idempotent" } }, + "SubmitDistributionPoints": { + "tag": "Metrics", + "undo": { + "type": "safe" + } + }, "ListDowntimes": { "tag": "Downtimes", "undo": { diff --git a/lib/datadog_api_client/v1.rb b/lib/datadog_api_client/v1.rb index 76e7e8815619..467fa2e7b6d0 100644 --- a/lib/datadog_api_client/v1.rb +++ b/lib/datadog_api_client/v1.rb @@ -86,6 +86,11 @@ require 'datadog_api_client/v1/models/dashboard_template_variable_preset' require 'datadog_api_client/v1/models/dashboard_template_variable_preset_value' require 'datadog_api_client/v1/models/deleted_monitor' +require 'datadog_api_client/v1/models/distribution_point_item' +require 'datadog_api_client/v1/models/distribution_points_content_encoding' +require 'datadog_api_client/v1/models/distribution_points_payload' +require 'datadog_api_client/v1/models/distribution_points_series' +require 'datadog_api_client/v1/models/distribution_points_type' require 'datadog_api_client/v1/models/distribution_widget_definition' require 'datadog_api_client/v1/models/distribution_widget_definition_type' require 'datadog_api_client/v1/models/distribution_widget_request' diff --git a/lib/datadog_api_client/v1/api/metrics_api.rb b/lib/datadog_api_client/v1/api/metrics_api.rb index 1c857b4cfb8f..39b875518c84 100644 --- a/lib/datadog_api_client/v1/api/metrics_api.rb +++ b/lib/datadog_api_client/v1/api/metrics_api.rb @@ -334,6 +334,87 @@ def query_metrics_with_http_info(from, to, query, opts = {}) return data, status_code, headers end + # Submit distribution points. + # + # @see #submit_distribution_points_with_http_info + def submit_distribution_points(body, opts = {}) + data, _status_code, _headers = submit_distribution_points_with_http_info(body, opts) + data + end + + # Submit distribution points. + # + # The distribution points end-point allows you to post distribution data that can be graphed on Datadog’s dashboards. + # + # @param body [DistributionPointsPayload] + # @param opts [Hash] the optional parameters + # @option opts [DistributionPointsContentEncoding] :content_encoding HTTP header used to compress the media-type. + # @return [Array<(IntakePayloadAccepted, Integer, Hash)>] IntakePayloadAccepted data, response status code and response headers + def submit_distribution_points_with_http_info(body, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:submit_distribution_points) + unstable_enabled = @api_client.config.unstable_operations[:submit_distribution_points] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "submit_distribution_points") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "submit_distribution_points")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MetricsAPI.submit_distribution_points ...' + end + allowable_values = ['deflate'] + if @api_client.config.client_side_validation && opts[:'content_encoding'] && !allowable_values.include?(opts[:'content_encoding']) + fail ArgumentError, "invalid value for \"content_encoding\", must be one of #{allowable_values}" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MetricsAPI.submit_distribution_points" + end + # resource path + local_var_path = '/api/v1/distribution_points' + + # 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(['text/json', 'application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['text/json']) + header_params['Content-Encoding'] = opts[:'content_encoding'] if !opts[:'content_encoding'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IntakePayloadAccepted' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth] + + new_options = opts.merge( + :operation => :submit_distribution_points, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MetricsAPI#submit_distribution_points\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Submit metrics. # # @see #submit_metrics_with_http_info diff --git a/lib/datadog_api_client/v1/models/distribution_point_item.rb b/lib/datadog_api_client/v1/models/distribution_point_item.rb new file mode 100644 index 000000000000..643f51210237 --- /dev/null +++ b/lib/datadog_api_client/v1/models/distribution_point_item.rb @@ -0,0 +1,63 @@ +=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 + # List of distribution point. + module DistributionPointItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Float', + :'Array' + ] + end + # Builds the object + # @param [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._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::V1::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/distribution_points_content_encoding.rb b/lib/datadog_api_client/v1/models/distribution_points_content_encoding.rb new file mode 100644 index 000000000000..21198d9cce69 --- /dev/null +++ b/lib/datadog_api_client/v1/models/distribution_points_content_encoding.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 + # HTTP header used to compress the media-type. + class DistributionPointsContentEncoding + include BaseEnumModel + + DEFLATE = "deflate".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/distribution_points_payload.rb b/lib/datadog_api_client/v1/models/distribution_points_payload.rb new file mode 100644 index 000000000000..c6f7b77580f8 --- /dev/null +++ b/lib/datadog_api_client/v1/models/distribution_points_payload.rb @@ -0,0 +1,124 @@ +=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 + # The distribution points payload. + class DistributionPointsPayload + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # A list of distribution points series to submit to Datadog. + attr_accessor :series + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'series' => :'series' + } + end + + # Returns all the JSON keys this model knows about + # @!visibility private + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'series' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + ]) + 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::DistributionPointsPayload` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::DistributionPointsPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'series') + if (value = attributes[:'series']).is_a?(Array) + self.series = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @series.nil? + true + end + + # Custom attribute writer method with validation + # @param series [Object] Object to be assigned + # @!visibility private + def series=(series) + if series.nil? + fail ArgumentError, 'invalid value for "series", series cannot be nil.' + end + @series = series + 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 && + series == o.series + end + + # @see the `==` method + # @param o [Object] Object to be compared + # @!visibility private + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [series].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/distribution_points_series.rb b/lib/datadog_api_client/v1/models/distribution_points_series.rb new file mode 100644 index 000000000000..5c26abadb61c --- /dev/null +++ b/lib/datadog_api_client/v1/models/distribution_points_series.rb @@ -0,0 +1,179 @@ +=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 distribution points metric to submit to Datadog. + class DistributionPointsSeries + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # The name of the host that produced the distribution point metric. + attr_accessor :host + + # The name of the distribution points metric. + attr_accessor :metric + + # Points relating to the distribution point metric. All points must be tuples with timestamp and a list of values (cannot be a string). Timestamps should be in POSIX time in seconds. + attr_accessor :points + + # A list of tags associated with the distribution point metric. + attr_accessor :tags + + # The type of the distribution point. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'host' => :'host', + :'metric' => :'metric', + :'points' => :'points', + :'tags' => :'tags', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + # @!visibility private + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'host' => :'String', + :'metric' => :'String', + :'points' => :'Array>', + :'tags' => :'Array', + :'type' => :'DistributionPointsType' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + ]) + 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::DistributionPointsSeries` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::DistributionPointsSeries`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'host') + self.host = attributes[:'host'] + end + + if attributes.key?(:'metric') + self.metric = attributes[:'metric'] + end + + if attributes.key?(:'points') + if (value = attributes[:'points']).is_a?(Array) + self.points = value + end + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'distribution' + 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 @metric.nil? + return false if @points.nil? + true + end + + # Custom attribute writer method with validation + # @param metric [Object] Object to be assigned + # @!visibility private + def metric=(metric) + if metric.nil? + fail ArgumentError, 'invalid value for "metric", metric cannot be nil.' + end + @metric = metric + end + + # Custom attribute writer method with validation + # @param points [Object] Object to be assigned + # @!visibility private + def points=(points) + if points.nil? + fail ArgumentError, 'invalid value for "points", points cannot be nil.' + end + @points = points + 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 && + host == o.host && + metric == o.metric && + points == o.points && + tags == o.tags && + type == o.type + end + + # @see the `==` method + # @param o [Object] Object to be compared + # @!visibility private + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [host, metric, points, tags, type].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/distribution_points_type.rb b/lib/datadog_api_client/v1/models/distribution_points_type.rb new file mode 100644 index 000000000000..801d511e467d --- /dev/null +++ b/lib/datadog_api_client/v1/models/distribution_points_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 + # The type of the distribution point. + class DistributionPointsType + include BaseEnumModel + + DISTRIBUTION = "distribution".freeze + end +end