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
43 changes: 43 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27920,6 +27920,42 @@ components:
WidgetBackgroundColor:
description: "Background color of the widget. Supported values are `white`, `blue`, `purple`, `pink`, `orange`, `yellow`, `green`, `gray`, `vivid_blue`, `vivid_purple`, `vivid_pink`, `vivid_orange`, `vivid_yellow`, `vivid_green`, and `transparent`."
type: string
WidgetCalendarAlignedSpan:
description: Used for calendar-aligned time spans, such as the current month or previous year.
properties:
hide_incomplete_cost_data:
description: Whether to hide incomplete cost data in the widget.
type: boolean
offset:
description: Number of completed periods before the current period. 0 represents the current period.
example: 1
format: int64
minimum: 0
type: integer
timezone:
description: Time zone used to align the calendar period.
example: UTC
type: string
type:
$ref: "#/components/schemas/WidgetCalendarAlignedSpanType"
required:
- type
- offset
type: object
WidgetCalendarAlignedSpanType:
description: Calendar-aligned time span type.
enum:
- daily
- weekly
- monthly
- yearly
example: daily
type: string
x-enum-varnames:
- DAILY
- WEEKLY
- MONTHLY
- YEARLY
WidgetChangeType:
description: Show the absolute or the relative change.
enum:
Expand Down Expand Up @@ -28381,6 +28417,9 @@ components:
- month_to_date
- 1y
- alert
- full_week
- full_month
- year_to_date
example: 5m
type: string
x-enum-varnames:
Expand All @@ -28401,6 +28440,9 @@ components:
- MONTH_TO_DATE
- PAST_ONE_YEAR
- ALERT
- FULL_WEEK
- FULL_MONTH
- YEAR_TO_DATE
WidgetLiveSpanUnit:
description: Unit of the time span.
enum:
Expand Down Expand Up @@ -28784,6 +28826,7 @@ components:
- $ref: "#/components/schemas/WidgetLegacyLiveSpan"
- $ref: "#/components/schemas/WidgetNewLiveSpan"
- $ref: "#/components/schemas/WidgetNewFixedSpan"
- $ref: "#/components/schemas/WidgetCalendarAlignedSpan"
WidgetTimeWindows:
description: Define a time window.
enum:
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,8 @@ def overrides
"v1.widget" => "Widget",
"v1.widget_aggregator" => "WidgetAggregator",
"v1.widget_axis" => "WidgetAxis",
"v1.widget_calendar_aligned_span" => "WidgetCalendarAlignedSpan",
"v1.widget_calendar_aligned_span_type" => "WidgetCalendarAlignedSpanType",
"v1.widget_change_type" => "WidgetChangeType",
"v1.widget_color_preference" => "WidgetColorPreference",
"v1.widget_comparator" => "WidgetComparator",
Expand Down
168 changes: 168 additions & 0 deletions lib/datadog_api_client/v1/models/widget_calendar_aligned_span.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
=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
# Used for calendar-aligned time spans, such as the current month or previous year.
class WidgetCalendarAlignedSpan
include BaseGenericModel

# Whether to hide incomplete cost data in the widget.
attr_accessor :hide_incomplete_cost_data

# Number of completed periods before the current period. 0 represents the current period.
attr_reader :offset

# Time zone used to align the calendar period.
attr_accessor :timezone

# Calendar-aligned time span type.
attr_reader :type

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'hide_incomplete_cost_data' => :'Boolean',
:'offset' => :'Integer',
:'timezone' => :'String',
:'type' => :'WidgetCalendarAlignedSpanType'
}
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::WidgetCalendarAlignedSpan` 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?(:'hide_incomplete_cost_data')
self.hide_incomplete_cost_data = attributes[:'hide_incomplete_cost_data']
end

if attributes.key?(:'offset')
self.offset = attributes[:'offset']
end

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

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

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[hide_incomplete_cost_data, offset, timezone, type, additional_properties].hash
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
=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
# Calendar-aligned time span type.
class WidgetCalendarAlignedSpanType
include BaseEnumModel

DAILY = "daily".freeze
WEEKLY = "weekly".freeze
MONTHLY = "monthly".freeze
YEARLY = "yearly".freeze
end
end
3 changes: 3 additions & 0 deletions lib/datadog_api_client/v1/models/widget_live_span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ class WidgetLiveSpan
MONTH_TO_DATE = "month_to_date".freeze
PAST_ONE_YEAR = "1y".freeze
ALERT = "alert".freeze
FULL_WEEK = "full_week".freeze
FULL_MONTH = "full_month".freeze
YEAR_TO_DATE = "year_to_date".freeze
end
end
3 changes: 2 additions & 1 deletion lib/datadog_api_client/v1/models/widget_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def openapi_one_of
[
:'WidgetLegacyLiveSpan',
:'WidgetNewLiveSpan',
:'WidgetNewFixedSpan'
:'WidgetNewFixedSpan',
:'WidgetCalendarAlignedSpan'
]
end
# Builds the object
Expand Down
Loading