Skip to content
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-08 20:00:50.397113",
"spec_repo_commit": "3e2afa30"
"regenerated": "2025-04-08 20:55:42.262152",
"spec_repo_commit": "21cf6edb"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-04-08 20:00:50.413019",
"spec_repo_commit": "3e2afa30"
"regenerated": "2025-04-08 20:55:42.277778",
"spec_repo_commit": "21cf6edb"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17271,6 +17271,14 @@ components:
example: 0
format: int64
type: integer
ip_addresses:
description: The interface IP addresses
example:
- 1.1.1.1
- 1.1.1.2
items:
type: string
type: array
mac_address:
description: The interface MAC address
example: 00:00:00:00:00:00
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions features/v2/network_device_monitoring.feature
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Feature: Network Device Monitoring
And the response "data[0].attributes.name" is equal to "if99"
And the response "data[0].attributes.description" is equal to "a network interface"
And the response "data[0].attributes.mac_address" is equal to "00:00:00:00:00:00"
And the response "data[0].attributes.ip_addresses" is equal to ["1.1.1.1","1.1.1.2"]
And the response "data[0].attributes.alias" is equal to "interface_99"
And the response "data[0].attributes.index" is equal to 99
And the response "data[0].attributes.status" is equal to "up"
Expand Down
14 changes: 13 additions & 1 deletion lib/datadog_api_client/v2/models/interface_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class InterfaceAttributes
# The interface index
attr_accessor :index

# The interface IP addresses
attr_accessor :ip_addresses

# The interface MAC address
attr_accessor :mac_address

Expand All @@ -48,6 +51,7 @@ def self.attribute_map
:'_alias' => :'alias',
:'description' => :'description',
:'index' => :'index',
:'ip_addresses' => :'ip_addresses',
:'mac_address' => :'mac_address',
:'name' => :'name',
:'status' => :'status'
Expand All @@ -61,6 +65,7 @@ def self.openapi_types
:'_alias' => :'String',
:'description' => :'String',
:'index' => :'Integer',
:'ip_addresses' => :'Array<String>',
:'mac_address' => :'String',
:'name' => :'String',
:'status' => :'InterfaceAttributesStatus'
Expand Down Expand Up @@ -97,6 +102,12 @@ def initialize(attributes = {})
self.index = attributes[:'index']
end

if attributes.key?(:'ip_addresses')
if (value = attributes[:'ip_addresses']).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.ip_addresses = value
end
end

if attributes.key?(:'mac_address')
self.mac_address = attributes[:'mac_address']
end
Expand Down Expand Up @@ -139,6 +150,7 @@ def ==(o)
_alias == o._alias &&
description == o.description &&
index == o.index &&
ip_addresses == o.ip_addresses &&
mac_address == o.mac_address &&
name == o.name &&
status == o.status &&
Expand All @@ -149,7 +161,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[_alias, description, index, mac_address, name, status, additional_properties].hash
[_alias, description, index, ip_addresses, mac_address, name, status, additional_properties].hash
end
end
end
Loading