From eff5c27f2573ad7f6a20961be55039873bd87ccd Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 26 Sep 2024 16:24:16 +0000 Subject: [PATCH] Regenerate client from commit 507d0354 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 143 +++++++++++++++ ...-multiple-tests-returns-OK-response.frozen | 1 + ...for-multiple-tests-returns-OK-response.yml | 27 +++ examples/v1/synthetics/FetchUptimes.rb | 13 ++ features/scenarios_model_mapping.rb | 3 + features/v1/synthetics.feature | 17 ++ features/v1/undo.json | 6 + lib/datadog_api_client/inflector.rb | 3 + .../v1/api/synthetics_api.rb | 67 +++++++ .../synthetics_fetch_uptimes_payload.rb | 167 ++++++++++++++++++ .../v1/models/synthetics_test_uptime.rb | 135 ++++++++++++++ .../v1/models/synthetics_uptime.rb | 161 +++++++++++++++++ 13 files changed, 747 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.frozen create mode 100644 cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.yml create mode 100644 examples/v1/synthetics/FetchUptimes.rb create mode 100644 lib/datadog_api_client/v1/models/synthetics_fetch_uptimes_payload.rb create mode 100644 lib/datadog_api_client/v1/models/synthetics_test_uptime.rb create mode 100644 lib/datadog_api_client/v1/models/synthetics_uptime.rb diff --git a/.apigentools-info b/.apigentools-info index 0beb3e098e0d..63772859c5d3 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-25 18:54:10.257631", - "spec_repo_commit": "1fa8186c" + "regenerated": "2024-09-26 16:23:52.142020", + "spec_repo_commit": "507d0354" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-25 18:54:10.272586", - "spec_repo_commit": "1fa8186c" + "regenerated": "2024-09-26 16:23:52.156380", + "spec_repo_commit": "507d0354" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 6dd7512869d5..4c72c9b41673 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -15182,6 +15182,32 @@ components: - EDGE_LAPTOP_LARGE - EDGE_TABLET - EDGE_MOBILE_SMALL + SyntheticsFetchUptimesPayload: + description: Object containing IDs of Synthetic tests and a timeframe. + properties: + from_ts: + description: Timestamp in seconds (Unix epoch) for the start of uptime. + example: 0 + format: int64 + type: integer + public_ids: + description: An array of Synthetic test IDs you want to delete. + example: [] + items: + description: A Synthetic test ID. + example: abc-def-123 + type: string + type: array + to_ts: + description: Timestamp in seconds (Unix epoch) for the end of uptime. + example: 0 + format: int64 + type: integer + required: + - from_ts + - to_ts + - public_ids + type: object SyntheticsGetAPITestLatestResultsResponse: description: Object with the latest Synthetic API test run. properties: @@ -16481,6 +16507,24 @@ components: description: String Port number to use when performing the test. Supports templated variables. type: string + SyntheticsTestUptime: + description: Object containing the uptime for a Synthetic test ID. + properties: + from_ts: + description: Timestamp in seconds for the start of uptime. + format: int64 + type: integer + overall: + $ref: '#/components/schemas/SyntheticsUptime' + public_id: + description: A Synthetic test ID. + example: abc-def-123 + type: string + to_ts: + description: Timestamp in seconds for the end of uptime. + format: int64 + type: integer + type: object SyntheticsTiming: description: 'Object containing all metrics and their values collected for a Synthetic API test. @@ -16604,6 +16648,62 @@ components: new_status: $ref: '#/components/schemas/SyntheticsTestPauseStatus' type: object + SyntheticsUptime: + description: Object containing the uptime information. + properties: + errors: + description: An array of error objects returned while querying the history + data for the service level objective. + items: + $ref: '#/components/schemas/SLOHistoryResponseErrorWithType' + nullable: true + type: array + group: + description: The location name + example: name + type: string + history: + description: 'The state transition history for the monitor, represented + as an array of + + pairs. Each pair is an array where the first element is the transition + timestamp + + in Unix epoch format (integer) and the second element is the state (integer). + + For the state, an integer value of `0` indicates uptime, `1` indicates + downtime, + + and `2` indicates no data.' + example: + - - 1579212382 + - 0 + items: + description: An array of transitions + example: + - 1579212382 + - 0 + items: + description: A timeseries data point which is a tuple of (timestamp, + value). + format: double + type: number + maxItems: 2 + minItems: 2 + type: array + type: array + span_precision: + description: The number of decimal places to which the SLI value is accurate + for the given from-to timestamps. + example: 2.0 + format: double + type: number + uptime: + description: The overall uptime. + example: 99.99 + format: double + type: number + type: object SyntheticsVariableParser: description: Details of the parser to use for the global variable. example: @@ -31950,6 +32050,49 @@ paths: operator: OR permissions: - synthetics_write + /api/v1/synthetics/tests/uptimes: + post: + description: Fetch uptime for multiple Synthetic tests by ID. + operationId: FetchUptimes + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsFetchUptimesPayload' + description: Public ID list of the Synthetic tests and timeframe. + required: true + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/SyntheticsTestUptime' + type: array + description: OK. + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: '- JSON format is wrong' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_read + summary: Fetch uptime for multiple tests + tags: + - Synthetics + x-codegen-request-body-name: body /api/v1/synthetics/tests/{public_id}: get: description: Get the detailed configuration associated with a Synthetic test. diff --git a/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.frozen b/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.frozen new file mode 100644 index 000000000000..87f1a868b8d5 --- /dev/null +++ b/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.frozen @@ -0,0 +1 @@ +2024-09-11T13:09:28.349Z \ No newline at end of file diff --git a/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.yml b/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.yml new file mode 100644 index 000000000000..6516bb3c2857 --- /dev/null +++ b/cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Wed, 11 Sep 2024 13:09:28 GMT + request: + body: + encoding: UTF-8 + string: '{"from_ts":1726041488,"public_ids":["p8m-9gw-nte"],"to_ts":1726055954}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/synthetics/tests/uptimes + response: + body: + encoding: UTF-8 + string: '[{"from_ts":1726041488,"to_ts":1726055954,"overall":{"name":"[Synthetics] + Synthetics test","preview":false,"monitor_type":"synthetics alert","monitor_modified":1726060063,"errors":null,"span_precision":0,"history":[[1726004543,0],[1726053503,1]],"uptime":83.05682373046875},"public_id":"p8m-9gw-nte","groups":[]}] + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/synthetics/FetchUptimes.rb b/examples/v1/synthetics/FetchUptimes.rb new file mode 100644 index 000000000000..c9a4c9fd8c0a --- /dev/null +++ b/examples/v1/synthetics/FetchUptimes.rb @@ -0,0 +1,13 @@ +# Fetch uptime for multiple tests returns "OK." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::SyntheticsAPI.new + +body = DatadogAPIClient::V1::SyntheticsFetchUptimesPayload.new({ + from_ts: 1726041488, + public_ids: [ + "p8m-9gw-nte", + ], + to_ts: 1726055954, +}) +p api_instance.fetch_uptimes(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 958e882dee50..7b99e8390eaf 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -746,6 +746,9 @@ "v1.TriggerCITests" => { "body" => "SyntheticsCITestBody", }, + "v1.FetchUptimes" => { + "body" => "SyntheticsFetchUptimesPayload", + }, "v1.GetTest" => { "public_id" => "String", }, diff --git a/features/v1/synthetics.feature b/features/v1/synthetics.feature index 943f0f655889..db66fbf39559 100644 --- a/features/v1/synthetics.feature +++ b/features/v1/synthetics.feature @@ -413,6 +413,23 @@ Feature: Synthetics Then the response status is 200 OK And the response "name" is equal to "{{ synthetics_api_test.name }}-updated" + @generated @skip @team:DataDog/synthetics-ct + Scenario: Fetch uptime for multiple tests returns "- JSON format is wrong" response + Given new "FetchUptimes" request + And body with value {"from_ts": 0, "public_ids": [], "to_ts": 0} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @replay-only @team:DataDog/synthetics-ct + Scenario: Fetch uptime for multiple tests returns "OK." response + Given new "FetchUptimes" request + And body with value {"from_ts": 1726041488, "public_ids": ["p8m-9gw-nte"], "to_ts": 1726055954} + When the request is sent + Then the response status is 200 OK + And the response "[0].public_id" is equal to "p8m-9gw-nte" + And the response "[0].overall.uptime" is equal to 83.05682373046875 + And the response "[0].overall.history" has length 2 + @generated @skip @team:DataDog/synthetics-ct Scenario: Get a browser test result returns "- Synthetic Monitoring is not activated for the user" response Given new "GetBrowserTestResult" request diff --git a/features/v1/undo.json b/features/v1/undo.json index 16982e7aa549..a39d7c991046 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -1208,6 +1208,12 @@ "type": "idempotent" } }, + "FetchUptimes": { + "tag": "Synthetics", + "undo": { + "type": "idempotent" + } + }, "GetTest": { "tag": "Synthetics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index efe584555aa0..fe88315f1b7e 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -619,6 +619,7 @@ def overrides "v1.synthetics_delete_tests_response" => "SyntheticsDeleteTestsResponse", "v1.synthetics_device" => "SyntheticsDevice", "v1.synthetics_device_id" => "SyntheticsDeviceID", + "v1.synthetics_fetch_uptimes_payload" => "SyntheticsFetchUptimesPayload", "v1.synthetics_get_api_test_latest_results_response" => "SyntheticsGetAPITestLatestResultsResponse", "v1.synthetics_get_browser_test_latest_results_response" => "SyntheticsGetBrowserTestLatestResultsResponse", "v1.synthetics_global_variable" => "SyntheticsGlobalVariable", @@ -678,6 +679,7 @@ def overrides "v1.synthetics_test_request_certificate_item" => "SyntheticsTestRequestCertificateItem", "v1.synthetics_test_request_port" => "SyntheticsTestRequestPort", "v1.synthetics_test_request_proxy" => "SyntheticsTestRequestProxy", + "v1.synthetics_test_uptime" => "SyntheticsTestUptime", "v1.synthetics_timing" => "SyntheticsTiming", "v1.synthetics_trigger_body" => "SyntheticsTriggerBody", "v1.synthetics_trigger_ci_test_location" => "SyntheticsTriggerCITestLocation", @@ -685,6 +687,7 @@ def overrides "v1.synthetics_trigger_ci_tests_response" => "SyntheticsTriggerCITestsResponse", "v1.synthetics_trigger_test" => "SyntheticsTriggerTest", "v1.synthetics_update_test_pause_status_payload" => "SyntheticsUpdateTestPauseStatusPayload", + "v1.synthetics_uptime" => "SyntheticsUptime", "v1.synthetics_variable_parser" => "SyntheticsVariableParser", "v1.synthetics_warning_type" => "SyntheticsWarningType", "v1.table_widget_cell_display_mode" => "TableWidgetCellDisplayMode", diff --git a/lib/datadog_api_client/v1/api/synthetics_api.rb b/lib/datadog_api_client/v1/api/synthetics_api.rb index d77deee0e8ac..e207237f0dce 100644 --- a/lib/datadog_api_client/v1/api/synthetics_api.rb +++ b/lib/datadog_api_client/v1/api/synthetics_api.rb @@ -560,6 +560,73 @@ def edit_global_variable_with_http_info(variable_id, body, opts = {}) return data, status_code, headers end + # Fetch uptime for multiple tests. + # + # @see #fetch_uptimes_with_http_info + def fetch_uptimes(body, opts = {}) + data, _status_code, _headers = fetch_uptimes_with_http_info(body, opts) + data + end + + # Fetch uptime for multiple tests. + # + # Fetch uptime for multiple Synthetic tests by ID. + # + # @param body [SyntheticsFetchUptimesPayload] Public ID list of the Synthetic tests and timeframe. + # @param opts [Hash] the optional parameters + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def fetch_uptimes_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.fetch_uptimes ...' + 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 SyntheticsAPI.fetch_uptimes" + end + # resource path + local_var_path = '/api/v1/synthetics/tests/uptimes' + + # 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']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # 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] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :fetch_uptimes, + :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 => "V1" + ) + + 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: SyntheticsAPI#fetch_uptimes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get an API test. # # @see #get_api_test_with_http_info diff --git a/lib/datadog_api_client/v1/models/synthetics_fetch_uptimes_payload.rb b/lib/datadog_api_client/v1/models/synthetics_fetch_uptimes_payload.rb new file mode 100644 index 000000000000..a26503743f64 --- /dev/null +++ b/lib/datadog_api_client/v1/models/synthetics_fetch_uptimes_payload.rb @@ -0,0 +1,167 @@ +=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 + # Object containing IDs of Synthetic tests and a timeframe. + class SyntheticsFetchUptimesPayload + include BaseGenericModel + + # Timestamp in seconds (Unix epoch) for the start of uptime. + attr_reader :from_ts + + # An array of Synthetic test IDs you want to delete. + attr_reader :public_ids + + # Timestamp in seconds (Unix epoch) for the end of uptime. + attr_reader :to_ts + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from_ts' => :'from_ts', + :'public_ids' => :'public_ids', + :'to_ts' => :'to_ts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from_ts' => :'Integer', + :'public_ids' => :'Array', + :'to_ts' => :'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::V1::SyntheticsFetchUptimesPayload` 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?(:'from_ts') + self.from_ts = attributes[:'from_ts'] + end + + if attributes.key?(:'public_ids') + if (value = attributes[:'public_ids']).is_a?(Array) + self.public_ids = value + end + end + + if attributes.key?(:'to_ts') + self.to_ts = attributes[:'to_ts'] + 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 @from_ts.nil? + return false if @public_ids.nil? + return false if @to_ts.nil? + true + end + + # Custom attribute writer method with validation + # @param from_ts [Object] Object to be assigned + # @!visibility private + def from_ts=(from_ts) + if from_ts.nil? + fail ArgumentError, 'invalid value for "from_ts", from_ts cannot be nil.' + end + @from_ts = from_ts + end + + # Custom attribute writer method with validation + # @param public_ids [Object] Object to be assigned + # @!visibility private + def public_ids=(public_ids) + if public_ids.nil? + fail ArgumentError, 'invalid value for "public_ids", public_ids cannot be nil.' + end + @public_ids = public_ids + end + + # Custom attribute writer method with validation + # @param to_ts [Object] Object to be assigned + # @!visibility private + def to_ts=(to_ts) + if to_ts.nil? + fail ArgumentError, 'invalid value for "to_ts", to_ts cannot be nil.' + end + @to_ts = to_ts + 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 && + from_ts == o.from_ts && + public_ids == o.public_ids && + to_ts == o.to_ts + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from_ts, public_ids, to_ts].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/synthetics_test_uptime.rb b/lib/datadog_api_client/v1/models/synthetics_test_uptime.rb new file mode 100644 index 000000000000..fe565399ac46 --- /dev/null +++ b/lib/datadog_api_client/v1/models/synthetics_test_uptime.rb @@ -0,0 +1,135 @@ +=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 + # Object containing the uptime for a Synthetic test ID. + class SyntheticsTestUptime + include BaseGenericModel + + # Timestamp in seconds for the start of uptime. + attr_accessor :from_ts + + # Object containing the uptime information. + attr_accessor :overall + + # A Synthetic test ID. + attr_accessor :public_id + + # Timestamp in seconds for the end of uptime. + attr_accessor :to_ts + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from_ts' => :'from_ts', + :'overall' => :'overall', + :'public_id' => :'public_id', + :'to_ts' => :'to_ts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from_ts' => :'Integer', + :'overall' => :'SyntheticsUptime', + :'public_id' => :'String', + :'to_ts' => :'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::V1::SyntheticsTestUptime` 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?(:'from_ts') + self.from_ts = attributes[:'from_ts'] + end + + if attributes.key?(:'overall') + self.overall = attributes[:'overall'] + end + + if attributes.key?(:'public_id') + self.public_id = attributes[:'public_id'] + end + + if attributes.key?(:'to_ts') + self.to_ts = attributes[:'to_ts'] + 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 && + from_ts == o.from_ts && + overall == o.overall && + public_id == o.public_id && + to_ts == o.to_ts + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from_ts, overall, public_id, to_ts].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/synthetics_uptime.rb b/lib/datadog_api_client/v1/models/synthetics_uptime.rb new file mode 100644 index 000000000000..caa9d7f85dd5 --- /dev/null +++ b/lib/datadog_api_client/v1/models/synthetics_uptime.rb @@ -0,0 +1,161 @@ +=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 + # Object containing the uptime information. + class SyntheticsUptime + include BaseGenericModel + + # An array of error objects returned while querying the history data for the service level objective. + attr_accessor :errors + + # The location name + attr_accessor :group + + # The state transition history for the monitor, represented as an array of + # pairs. Each pair is an array where the first element is the transition timestamp + # in Unix epoch format (integer) and the second element is the state (integer). + # For the state, an integer value of `0` indicates uptime, `1` indicates downtime, + # and `2` indicates no data. + attr_accessor :history + + # The number of decimal places to which the SLI value is accurate for the given from-to timestamps. + attr_accessor :span_precision + + # The overall uptime. + attr_accessor :uptime + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'errors' => :'errors', + :'group' => :'group', + :'history' => :'history', + :'span_precision' => :'span_precision', + :'uptime' => :'uptime' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'errors' => :'Array', + :'group' => :'String', + :'history' => :'Array>', + :'span_precision' => :'Float', + :'uptime' => :'Float' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'errors', + ]) + 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::SyntheticsUptime` 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?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + + if attributes.key?(:'group') + self.group = attributes[:'group'] + end + + if attributes.key?(:'history') + if (value = attributes[:'history']).is_a?(Array) + self.history = value + end + end + + if attributes.key?(:'span_precision') + self.span_precision = attributes[:'span_precision'] + end + + if attributes.key?(:'uptime') + self.uptime = attributes[:'uptime'] + 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 && + errors == o.errors && + group == o.group && + history == o.history && + span_precision == o.span_precision && + uptime == o.uptime + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [errors, group, history, span_precision, uptime].hash + end + end +end