-
Notifications
You must be signed in to change notification settings - Fork 21
Add componentOf field to Service, Queue, and Datastore V3 Software Catalog definitions #2308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,9 @@ module DatadogAPIClient::V2 | |
class EntityV3QueueSpec | ||
include BaseGenericModel | ||
|
||
# A list of components the queue is a part of | ||
attr_accessor :component_of | ||
|
||
# The lifecycle state of the queue. | ||
attr_reader :lifecycle | ||
|
||
|
@@ -34,6 +37,7 @@ class EntityV3QueueSpec | |
# @!visibility private | ||
def self.attribute_map | ||
{ | ||
:'component_of' => :'componentOf', | ||
:'lifecycle' => :'lifecycle', | ||
:'tier' => :'tier', | ||
:'type' => :'type' | ||
|
@@ -44,6 +48,7 @@ def self.attribute_map | |
# @!visibility private | ||
def self.openapi_types | ||
{ | ||
:'component_of' => :'Array<String>', | ||
:'lifecycle' => :'String', | ||
:'tier' => :'String', | ||
:'type' => :'String' | ||
|
@@ -66,6 +71,12 @@ def initialize(attributes = {}) | |
h[k.to_sym] = v | ||
} | ||
|
||
if attributes.key?(:'component_of') | ||
if (value = attributes[:'component_of']).is_a?(Array) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality ViolationConsider using Array() to ensure the type is that of an array (...read more)The rule "Use The By using |
||
self.component_of = value | ||
end | ||
end | ||
|
||
if attributes.key?(:'lifecycle') | ||
self.lifecycle = attributes[:'lifecycle'] | ||
end | ||
|
@@ -114,6 +125,7 @@ def tier=(tier) | |
def ==(o) | ||
return true if self.equal?(o) | ||
self.class == o.class && | ||
component_of == o.component_of && | ||
lifecycle == o.lifecycle && | ||
tier == o.tier && | ||
type == o.type | ||
|
@@ -123,7 +135,7 @@ def ==(o) | |
# @return [Integer] Hash code | ||
# @!visibility private | ||
def hash | ||
[lifecycle, tier, type].hash | ||
[component_of, lifecycle, tier, type].hash | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,9 @@ module DatadogAPIClient::V2 | |
class EntityV3ServiceSpec | ||
include BaseGenericModel | ||
|
||
# A list of components the service is a part of | ||
attr_accessor :component_of | ||
|
||
# A list of components the service depends on. | ||
attr_accessor :depends_on | ||
|
||
|
@@ -40,6 +43,7 @@ class EntityV3ServiceSpec | |
# @!visibility private | ||
def self.attribute_map | ||
{ | ||
:'component_of' => :'componentOf', | ||
:'depends_on' => :'dependsOn', | ||
:'languages' => :'languages', | ||
:'lifecycle' => :'lifecycle', | ||
|
@@ -52,6 +56,7 @@ def self.attribute_map | |
# @!visibility private | ||
def self.openapi_types | ||
{ | ||
:'component_of' => :'Array<String>', | ||
:'depends_on' => :'Array<String>', | ||
:'languages' => :'Array<String>', | ||
:'lifecycle' => :'String', | ||
|
@@ -76,6 +81,12 @@ def initialize(attributes = {}) | |
h[k.to_sym] = v | ||
} | ||
|
||
if attributes.key?(:'component_of') | ||
if (value = attributes[:'component_of']).is_a?(Array) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality ViolationConsider using Array() to ensure the type is that of an array (...read more)The rule "Use The By using |
||
self.component_of = value | ||
end | ||
end | ||
|
||
if attributes.key?(:'depends_on') | ||
if (value = attributes[:'depends_on']).is_a?(Array) | ||
self.depends_on = value | ||
|
@@ -136,6 +147,7 @@ def tier=(tier) | |
def ==(o) | ||
return true if self.equal?(o) | ||
self.class == o.class && | ||
component_of == o.component_of && | ||
depends_on == o.depends_on && | ||
languages == o.languages && | ||
lifecycle == o.lifecycle && | ||
|
@@ -147,7 +159,7 @@ def ==(o) | |
# @return [Integer] Hash code | ||
# @!visibility private | ||
def hash | ||
[depends_on, languages, lifecycle, tier, type].hash | ||
[component_of, depends_on, languages, lifecycle, tier, type].hash | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
Consider using Array() to ensure the type is that of an array (...read more)
The rule "Use
Array()
to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.The
Array()
method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.By using
Array(foos)
, you can ensure thatfoos
is an array before you try to iterate over it witheach
. This prevents the need to check iffoos
is an array withfoos.is_a?(Array)
and makes your code cleaner and easier to understand.