Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,50 @@ components:
type: string
x-enum-varnames:
- COHORT
ComparisonCustomTimeframe:
description: Fixed time range for a `custom_timeframe` comparison.
properties:
from:
description: Start time in milliseconds since epoch.
example: 1779290190000
format: int64
type: integer
to:
description: End time in milliseconds since epoch.
example: 1779894990000
format: int64
type: integer
required:
- from
- to
type: object
ComparisonDuration:
description: The comparison period. Use a preset `type` value or set `type` to `custom_timeframe` and provide `custom_timeframe` with explicit Unix timestamp bounds.
properties:
custom_timeframe:
$ref: "#/components/schemas/ComparisonCustomTimeframe"
description: Required when `type` is `custom_timeframe`. Fixed time range to compare against.
type:
$ref: "#/components/schemas/ComparisonDurationType"
required:
- type
type: object
ComparisonDurationType:
description: "Comparison window: `previous_timeframe` (same-length window immediately before current), `previous_day`, `previous_week`, `previous_month`, or `custom_timeframe` (set this to enable the `custom_timeframe` field)."
enum:
- previous_timeframe
- custom_timeframe
- previous_day
- previous_week
- previous_month
example: previous_timeframe
type: string
x-enum-varnames:
- PREVIOUS_TIMEFRAME
- CUSTOM_TIMEFRAME
- PREVIOUS_DAY
- PREVIOUS_WEEK
- PREVIOUS_MONTH
ContentEncoding:
description: HTTP header used to compress the media-type.
enum:
Expand Down Expand Up @@ -12028,6 +12072,45 @@ components:
x-enum-varnames:
- ASC
- DESC
QueryValueWidgetComparison:
description: A change indicator that compares the current value to a historical period.
properties:
directionality:
$ref: "#/components/schemas/QueryValueWidgetComparisonDirectionality"
description: Which direction of change is considered an improvement, determining the indicator color.
duration:
$ref: "#/components/schemas/ComparisonDuration"
description: The historical period to compare the current value against.
type:
$ref: "#/components/schemas/QueryValueWidgetComparisonType"
description: "How the delta is shown: as an absolute difference, a percentage, or both."
required:
- duration
type: object
QueryValueWidgetComparisonDirectionality:
default: neutral
description: "Color-coding direction: `increase_better` (green on rise), `decrease_better` (green on drop), or `neutral` (no color)."
enum:
- increase_better
- decrease_better
- neutral
type: string
x-enum-varnames:
- INCREASE_BETTER
- DECREASE_BETTER
- NEUTRAL
QueryValueWidgetComparisonType:
default: absolute
description: "How the delta is expressed: `absolute` (raw difference), `relative` (percentage), or `both`."
enum:
- absolute
- relative
- both
type: string
x-enum-varnames:
- ABSOLUTE
- RELATIVE
- BOTH
QueryValueWidgetDefinition:
description: Query values display the current value of a given metric, APM, or log query.
properties:
Expand Down Expand Up @@ -12099,6 +12182,9 @@ components:
$ref: "#/components/schemas/LogQueryDefinition"
deprecated: true
description: Deprecated - Use `queries` and `formulas` instead.
comparison:
$ref: "#/components/schemas/QueryValueWidgetComparison"
description: Displays a change indicator showing a delta against a historical baseline.
conditional_formats:
description: List of conditional formats.
items:
Expand Down
6 changes: 6 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def overrides
"v1.check_status_widget_definition_type" => "CheckStatusWidgetDefinitionType",
"v1.cohort_widget_definition" => "CohortWidgetDefinition",
"v1.cohort_widget_definition_type" => "CohortWidgetDefinitionType",
"v1.comparison_custom_timeframe" => "ComparisonCustomTimeframe",
"v1.comparison_duration" => "ComparisonDuration",
"v1.comparison_duration_type" => "ComparisonDurationType",
"v1.content_encoding" => "ContentEncoding",
"v1.creator" => "Creator",
"v1.dashboard" => "Dashboard",
Expand Down Expand Up @@ -533,6 +536,9 @@ def overrides
"v1.product_analytics_funnel_request_type" => "ProductAnalyticsFunnelRequestType",
"v1.product_analytics_funnel_widget_definition" => "ProductAnalyticsFunnelWidgetDefinition",
"v1.query_sort_order" => "QuerySortOrder",
"v1.query_value_widget_comparison" => "QueryValueWidgetComparison",
"v1.query_value_widget_comparison_directionality" => "QueryValueWidgetComparisonDirectionality",
"v1.query_value_widget_comparison_type" => "QueryValueWidgetComparisonType",
"v1.query_value_widget_definition" => "QueryValueWidgetDefinition",
"v1.query_value_widget_definition_type" => "QueryValueWidgetDefinitionType",
"v1.query_value_widget_request" => "QueryValueWidgetRequest",
Expand Down
144 changes: 144 additions & 0 deletions lib/datadog_api_client/v1/models/comparison_custom_timeframe.rb
Original file line number Diff line number Diff line change
@@ -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
# Fixed time range for a `custom_timeframe` comparison.
class ComparisonCustomTimeframe
include BaseGenericModel

# Start time in milliseconds since epoch.
attr_reader :from

# End time in milliseconds since epoch.
attr_reader :to

attr_accessor :additional_properties

# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.attribute_map
{
:'from' => :'from',
:'to' => :'to'
}
end

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'from' => :'Integer',
:'to' => :'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::ComparisonCustomTimeframe` 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')
self.from = attributes[:'from']
end

if attributes.key?(:'to')
self.to = attributes[:'to']
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.nil?
return false if @to.nil?
true
end

# Custom attribute writer method with validation
# @param from [Object] Object to be assigned
# @!visibility private
def from=(from)
if from.nil?
fail ArgumentError, 'invalid value for "from", from cannot be nil.'
end
@from = from
end

# Custom attribute writer method with validation
# @param to [Object] Object to be assigned
# @!visibility private
def to=(to)
if to.nil?
fail ArgumentError, 'invalid value for "to", to cannot be nil.'
end
@to = to
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 == o.from &&
to == o.to &&
additional_properties == o.additional_properties
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[from, to, additional_properties].hash
end
end
end
Loading
Loading