Skip to content

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

Merged
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-02 19:55:38.978560",
"spec_repo_commit": "1cc45c45"
"regenerated": "2025-04-02 20:49:26.546832",
"spec_repo_commit": "9ea284b5"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-02 19:55:38.997117",
"spec_repo_commit": "1cc45c45"
"regenerated": "2025-04-02 20:49:26.563500",
"spec_repo_commit": "9ea284b5"
}
}
}
15 changes: 15 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12431,6 +12431,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Datastore Spec object.
properties:
componentOf:
description: A list of components the datastore is a part of
items:
type: string
type: array
lifecycle:
description: The lifecycle state of the datastore.
minLength: 1
Expand Down Expand Up @@ -12629,6 +12634,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Queue Spec object.
properties:
componentOf:
description: A list of components the queue is a part of
items:
type: string
type: array
lifecycle:
description: The lifecycle state of the queue.
minLength: 1
Expand Down Expand Up @@ -12694,6 +12704,11 @@ components:
additionalProperties: false
description: The definition of Entity V3 Service Spec object.
properties:
componentOf:
description: A list of components the service is a part of
items:
type: string
type: array
dependsOn:
description: A list of components the service depends on.
items:
Expand Down
1 change: 1 addition & 0 deletions examples/v2/software-catalog/UpsertCatalogEntity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
],
}),
spec: DatadogAPIClient::V2::EntityV3ServiceSpec.new({
component_of: [],
depends_on: [],
languages: [],
}),
Expand Down
4 changes: 2 additions & 2 deletions features/v2/software_catalog.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Feature: Software Catalog
@generated @skip @team:DataDog/service-catalog
Scenario: Create or update entities returns "ACCEPTED" response
Given new "UpsertCatalogEntity" request
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"componentOf": [], "dependsOn": [], "languages": []}}
When the request is sent
Then the response status is 202 ACCEPTED

@generated @skip @team:DataDog/service-catalog
Scenario: Create or update entities returns "Bad Request" response
Given new "UpsertCatalogEntity" request
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"componentOf": [], "dependsOn": [], "languages": []}}
When the request is sent
Then the response status is 400 Bad Request

Expand Down
14 changes: 13 additions & 1 deletion lib/datadog_api_client/v2/models/entity_v3_datastore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module DatadogAPIClient::V2
class EntityV3DatastoreSpec
include BaseGenericModel

# A list of components the datastore is a part of
attr_accessor :component_of

# The lifecycle state of the datastore.
attr_reader :lifecycle

Expand All @@ -34,6 +37,7 @@ class EntityV3DatastoreSpec
# @!visibility private
def self.attribute_map
{
:'component_of' => :'componentOf',
:'lifecycle' => :'lifecycle',
:'tier' => :'tier',
:'type' => :'type'
Expand All @@ -44,6 +48,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'component_of' => :'Array<String>',
:'lifecycle' => :'String',
:'tier' => :'String',
:'type' => :'String'
Expand All @@ -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)

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 that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.component_of = value
end
end

if attributes.key?(:'lifecycle')
self.lifecycle = attributes[:'lifecycle']
end
Expand Down Expand Up @@ -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
Expand All @@ -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
14 changes: 13 additions & 1 deletion lib/datadog_api_client/v2/models/entity_v3_queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -34,6 +37,7 @@ class EntityV3QueueSpec
# @!visibility private
def self.attribute_map
{
:'component_of' => :'componentOf',
:'lifecycle' => :'lifecycle',
:'tier' => :'tier',
:'type' => :'type'
Expand All @@ -44,6 +48,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'component_of' => :'Array<String>',
:'lifecycle' => :'String',
:'tier' => :'String',
:'type' => :'String'
Expand All @@ -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)

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 that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.component_of = value
end
end

if attributes.key?(:'lifecycle')
self.lifecycle = attributes[:'lifecycle']
end
Expand Down Expand Up @@ -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
Expand All @@ -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
14 changes: 13 additions & 1 deletion lib/datadog_api_client/v2/models/entity_v3_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -40,6 +43,7 @@ class EntityV3ServiceSpec
# @!visibility private
def self.attribute_map
{
:'component_of' => :'componentOf',
:'depends_on' => :'dependsOn',
:'languages' => :'languages',
:'lifecycle' => :'lifecycle',
Expand All @@ -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',
Expand All @@ -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)

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 that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.component_of = value
end
end

if attributes.key?(:'depends_on')
if (value = attributes[:'depends_on']).is_a?(Array)
self.depends_on = value
Expand Down Expand Up @@ -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 &&
Expand All @@ -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
Loading