=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'date' require 'time' module DatadogAPIClient::V1 # A `metric` based SLO history response. # # This is not included in responses for `monitor` based SLOs. class SLOHistoryMetrics include BaseGenericModel # A representation of `metric` based SLO time series for the provided queries. # This is the same response type from `batch_query` endpoint. attr_reader :denominator # The aggregated query interval for the series data. It's implicit based on the query time window. attr_reader :interval # Optional message if there are specific query issues/warnings. attr_accessor :message # A representation of `metric` based SLO time series for the provided queries. # This is the same response type from `batch_query` endpoint. attr_reader :numerator # The combined numerator and denominator query CSV. attr_reader :query # The series result type. This mimics `batch_query` response type. attr_reader :res_type # The series response version type. This mimics `batch_query` response type. attr_reader :resp_version # An array of query timestamps in EPOCH milliseconds. attr_reader :times # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { :'denominator' => :'denominator', :'interval' => :'interval', :'message' => :'message', :'numerator' => :'numerator', :'query' => :'query', :'res_type' => :'res_type', :'resp_version' => :'resp_version', :'times' => :'times' } end # Attribute type mapping. # @!visibility private def self.openapi_types { :'denominator' => :'SLOHistoryMetricsSeries', :'interval' => :'Integer', :'message' => :'String', :'numerator' => :'SLOHistoryMetricsSeries', :'query' => :'String', :'res_type' => :'String', :'resp_version' => :'Integer', :'times' => :'Array' } end # Initializes the object # @param attributes [Hash] Model attributes in the form of hash # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::SLOHistoryMetrics` 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::SLOHistoryMetrics`. 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?(:'denominator') self.denominator = attributes[:'denominator'] end if attributes.key?(:'interval') self.interval = attributes[:'interval'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'numerator') self.numerator = attributes[:'numerator'] end if attributes.key?(:'query') self.query = attributes[:'query'] end if attributes.key?(:'res_type') self.res_type = attributes[:'res_type'] end if attributes.key?(:'resp_version') self.resp_version = attributes[:'resp_version'] end if attributes.key?(:'times') if (value = attributes[:'times']).is_a?(Array) self.times = 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 @denominator.nil? return false if @interval.nil? return false if @numerator.nil? return false if @query.nil? return false if @res_type.nil? return false if @resp_version.nil? return false if @times.nil? true end # Custom attribute writer method with validation # @param denominator [Object] Object to be assigned # @!visibility private def denominator=(denominator) if denominator.nil? fail ArgumentError, 'invalid value for "denominator", denominator cannot be nil.' end @denominator = denominator end # Custom attribute writer method with validation # @param interval [Object] Object to be assigned # @!visibility private def interval=(interval) if interval.nil? fail ArgumentError, 'invalid value for "interval", interval cannot be nil.' end @interval = interval end # Custom attribute writer method with validation # @param numerator [Object] Object to be assigned # @!visibility private def numerator=(numerator) if numerator.nil? fail ArgumentError, 'invalid value for "numerator", numerator cannot be nil.' end @numerator = numerator end # Custom attribute writer method with validation # @param query [Object] Object to be assigned # @!visibility private def query=(query) if query.nil? fail ArgumentError, 'invalid value for "query", query cannot be nil.' end @query = query end # Custom attribute writer method with validation # @param res_type [Object] Object to be assigned # @!visibility private def res_type=(res_type) if res_type.nil? fail ArgumentError, 'invalid value for "res_type", res_type cannot be nil.' end @res_type = res_type end # Custom attribute writer method with validation # @param resp_version [Object] Object to be assigned # @!visibility private def resp_version=(resp_version) if resp_version.nil? fail ArgumentError, 'invalid value for "resp_version", resp_version cannot be nil.' end @resp_version = resp_version end # Custom attribute writer method with validation # @param times [Object] Object to be assigned # @!visibility private def times=(times) if times.nil? fail ArgumentError, 'invalid value for "times", times cannot be nil.' end @times = times 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 && denominator == o.denominator && interval == o.interval && message == o.message && numerator == o.numerator && query == o.query && res_type == o.res_type && resp_version == o.resp_version && times == o.times end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash [denominator, interval, message, numerator, query, res_type, resp_version, times].hash end end end