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
85 changes: 82 additions & 3 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11481,6 +11481,60 @@ components:
example: UTC
type: string
type: object
SLOCountCondition:
description: 'A metric SLI specification, composed of three parts: the good
events formula, the total events formula,

and the involved queries.'
example:
good_events_formula: query1 - query2
queries:
- data_source: metrics
name: query1
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
- data_source: metrics
name: query2
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
total_events_formula: query1
properties:
good_events_formula:
$ref: '#/components/schemas/SLOFormula'
queries:
example:
- data_source: metrics
name: query1
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
items:
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
minItems: 1
type: array
total_events_formula:
$ref: '#/components/schemas/SLOFormula'
required:
- good_events_formula
- total_events_formula
- queries
type: object
SLOCountSpec:
additionalProperties: false
description: A metric SLI specification.
example:
count:
good_events_formula: query1 - query2
queries:
- data_source: metrics
name: query1
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
- data_source: metrics
name: query2
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
total_events_formula: query1
properties:
count:
$ref: '#/components/schemas/SLOCountCondition'
required:
- count
type: object
SLOCreator:
description: The creator of the SLO
nullable: true
Expand Down Expand Up @@ -12328,8 +12382,16 @@ components:
type: string
query:
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
description: 'The metric query of good / total events. This is not allowed
if the `sli_specification` field

is used in the same request.'
sli_specification:
$ref: '#/components/schemas/SLOSliSpec'
description: 'A generic SLI specification. This is currently used for time-slice
and metric SLOs only.

This is not allowed if the `query` field is used in the same request.'
tags:
description: 'A list of tags associated with this service level objective.

Expand Down Expand Up @@ -12386,9 +12448,10 @@ components:
type: object
SLOSliSpec:
description: A generic SLI specification. This is currently used for time-slice
SLOs only.
and metric SLOs only.
oneOf:
- $ref: '#/components/schemas/SLOTimeSliceSpec'
- $ref: '#/components/schemas/SLOCountSpec'
SLOState:
description: State of the SLO.
enum:
Expand Down Expand Up @@ -13479,8 +13542,16 @@ components:
type: string
query:
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
description: 'The metric query of good / total events. This is not allowed
if the `sli_specification` field

is used in the same request.'
sli_specification:
$ref: '#/components/schemas/SLOSliSpec'
description: 'A generic SLI specification. This is currently used for time-slice
and metric SLOs only.

This is not allowed if the `query` field is used in the same request.'
tags:
description: 'A list of tags associated with this service level objective.

Expand Down Expand Up @@ -13540,8 +13611,8 @@ components:
- type
type: object
ServiceLevelObjectiveQuery:
description: 'A metric-based SLO. **Required if type is `metric`**. Note that
Datadog only allows the sum by aggregator
description: 'A now deprecated metric SLO. Note that Datadog only allows the
sum by aggregator

to be used because this will sum up all request counts instead of averaging
them, or taking the max or
Expand Down Expand Up @@ -13610,8 +13681,16 @@ components:
type: string
query:
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
description: 'The metric query of good / total events. This is not allowed
if the `sli_specification` field

is used in the same request.'
sli_specification:
$ref: '#/components/schemas/SLOSliSpec'
description: 'A generic SLI specification. This is currently used for time-slice
and metric SLOs only.

This is not allowed if the `query` field is used in the same request.'
tags:
description: 'A list of tags associated with this service level objective.

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 @@ -522,6 +522,8 @@ def overrides
"v1.slo_correction_update_data" => "SLOCorrectionUpdateData",
"v1.slo_correction_update_request" => "SLOCorrectionUpdateRequest",
"v1.slo_correction_update_request_attributes" => "SLOCorrectionUpdateRequestAttributes",
"v1.slo_count_condition" => "SLOCountCondition",
"v1.slo_count_spec" => "SLOCountSpec",
"v1.slo_creator" => "SLOCreator",
"v1.slo_data_source_query_definition" => "SLODataSourceQueryDefinition",
"v1.slo_delete_response" => "SLODeleteResponse",
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog_api_client/v1/models/service_level_objective.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ class ServiceLevelObjective
# The name of the service level objective object.
attr_reader :name

# A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
# A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
# to be used because this will sum up all request counts instead of averaging them, or taking the max or
# min of all of those requests.
attr_accessor :query

# A generic SLI specification. This is currently used for time-slice SLOs only.
# A generic SLI specification. This is currently used for time-slice and metric SLOs only.
attr_accessor :sli_specification

# A list of tags associated with this service level objective.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require 'time'

module DatadogAPIClient::V1
# A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
# A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
# to be used because this will sum up all request counts instead of averaging them, or taking the max or
# min of all of those requests.
class ServiceLevelObjectiveQuery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class ServiceLevelObjectiveRequest
# The name of the service level objective object.
attr_reader :name

# A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator
# A now deprecated metric SLO. Note that Datadog only allows the sum by aggregator
# to be used because this will sum up all request counts instead of averaging them, or taking the max or
# min of all of those requests.
attr_accessor :query

# A generic SLI specification. This is currently used for time-slice SLOs only.
# A generic SLI specification. This is currently used for time-slice and metric SLOs only.
attr_accessor :sli_specification

# A list of tags associated with this service level objective.
Expand Down
172 changes: 172 additions & 0 deletions lib/datadog_api_client/v1/models/slo_count_condition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
=begin
#Datadog API V1 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: [email protected]
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 SLI specification, composed of three parts: the good events formula, the total events formula,
# and the involved queries.
class SLOCountCondition
include BaseGenericModel

# A formula that specifies how to combine the results of multiple queries.
attr_reader :good_events_formula

#
attr_reader :queries

# A formula that specifies how to combine the results of multiple queries.
attr_reader :total_events_formula

attr_accessor :additional_properties

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

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'good_events_formula' => :'SLOFormula',
:'queries' => :'Array<SLODataSourceQueryDefinition>',
:'total_events_formula' => :'SLOFormula'
}
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::SLOCountCondition` 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?(:'good_events_formula')
self.good_events_formula = attributes[:'good_events_formula']
end

if attributes.key?(:'queries')
if (value = attributes[:'queries']).is_a?(Array)
self.queries = value
end
end

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

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

# Custom attribute writer method with validation
# @param queries [Object] Object to be assigned
# @!visibility private
def queries=(queries)
if queries.nil?
fail ArgumentError, 'invalid value for "queries", queries cannot be nil.'
end
if queries.length < 1
fail ArgumentError, 'invalid value for "queries", number of items must be greater than or equal to 1.'
end
@queries = queries
end

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

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