Skip to content

Commit 594cd43

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update NDM GetInterfaces documentation to add ip_addresses attribute (#3022)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 436dc07 commit 594cd43

5 files changed

Lines changed: 50 additions & 6 deletions

File tree

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-04-08 20:00:49.295140",
8-
"spec_repo_commit": "3e2afa30"
7+
"regenerated": "2025-04-08 20:55:39.006253",
8+
"spec_repo_commit": "21cf6edb"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-08 20:00:49.311343",
13-
"spec_repo_commit": "3e2afa30"
12+
"regenerated": "2025-04-08 20:55:39.023219",
13+
"spec_repo_commit": "21cf6edb"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17271,6 +17271,14 @@ components:
1727117271
example: 0
1727217272
format: int64
1727317273
type: integer
17274+
ip_addresses:
17275+
description: The interface IP addresses
17276+
example:
17277+
- 1.1.1.1
17278+
- 1.1.1.2
17279+
items:
17280+
type: string
17281+
type: array
1727417282
mac_address:
1727517283
description: The interface MAC address
1727617284
example: 00:00:00:00:00:00

api/datadogV2/model_interface_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type InterfaceAttributes struct {
1616
Description *string `json:"description,omitempty"`
1717
// The interface index
1818
Index *int64 `json:"index,omitempty"`
19+
// The interface IP addresses
20+
IpAddresses []string `json:"ip_addresses,omitempty"`
1921
// The interface MAC address
2022
MacAddress *string `json:"mac_address,omitempty"`
2123
// The interface name
@@ -128,6 +130,34 @@ func (o *InterfaceAttributes) SetIndex(v int64) {
128130
o.Index = &v
129131
}
130132

133+
// GetIpAddresses returns the IpAddresses field value if set, zero value otherwise.
134+
func (o *InterfaceAttributes) GetIpAddresses() []string {
135+
if o == nil || o.IpAddresses == nil {
136+
var ret []string
137+
return ret
138+
}
139+
return o.IpAddresses
140+
}
141+
142+
// GetIpAddressesOk returns a tuple with the IpAddresses field value if set, nil otherwise
143+
// and a boolean to check if the value has been set.
144+
func (o *InterfaceAttributes) GetIpAddressesOk() (*[]string, bool) {
145+
if o == nil || o.IpAddresses == nil {
146+
return nil, false
147+
}
148+
return &o.IpAddresses, true
149+
}
150+
151+
// HasIpAddresses returns a boolean if a field has been set.
152+
func (o *InterfaceAttributes) HasIpAddresses() bool {
153+
return o != nil && o.IpAddresses != nil
154+
}
155+
156+
// SetIpAddresses gets a reference to the given []string and assigns it to the IpAddresses field.
157+
func (o *InterfaceAttributes) SetIpAddresses(v []string) {
158+
o.IpAddresses = v
159+
}
160+
131161
// GetMacAddress returns the MacAddress field value if set, zero value otherwise.
132162
func (o *InterfaceAttributes) GetMacAddress() string {
133163
if o == nil || o.MacAddress == nil {
@@ -227,6 +257,9 @@ func (o InterfaceAttributes) MarshalJSON() ([]byte, error) {
227257
if o.Index != nil {
228258
toSerialize["index"] = o.Index
229259
}
260+
if o.IpAddresses != nil {
261+
toSerialize["ip_addresses"] = o.IpAddresses
262+
}
230263
if o.MacAddress != nil {
231264
toSerialize["mac_address"] = o.MacAddress
232265
}
@@ -249,6 +282,7 @@ func (o *InterfaceAttributes) UnmarshalJSON(bytes []byte) (err error) {
249282
Alias *string `json:"alias,omitempty"`
250283
Description *string `json:"description,omitempty"`
251284
Index *int64 `json:"index,omitempty"`
285+
IpAddresses []string `json:"ip_addresses,omitempty"`
252286
MacAddress *string `json:"mac_address,omitempty"`
253287
Name *string `json:"name,omitempty"`
254288
Status *InterfaceAttributesStatus `json:"status,omitempty"`
@@ -258,7 +292,7 @@ func (o *InterfaceAttributes) UnmarshalJSON(bytes []byte) (err error) {
258292
}
259293
additionalProperties := make(map[string]interface{})
260294
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
261-
datadog.DeleteKeys(additionalProperties, &[]string{"alias", "description", "index", "mac_address", "name", "status"})
295+
datadog.DeleteKeys(additionalProperties, &[]string{"alias", "description", "index", "ip_addresses", "mac_address", "name", "status"})
262296
} else {
263297
return err
264298
}
@@ -267,6 +301,7 @@ func (o *InterfaceAttributes) UnmarshalJSON(bytes []byte) (err error) {
267301
o.Alias = all.Alias
268302
o.Description = all.Description
269303
o.Index = all.Index
304+
o.IpAddresses = all.IpAddresses
270305
o.MacAddress = all.MacAddress
271306
o.Name = all.Name
272307
if all.Status != nil && !all.Status.IsValid() {

tests/scenarios/cassettes/TestScenarios/v2/Feature_Network_Device_Monitoring/Scenario_Get_the_list_of_interfaces_of_the_device_returns_OK_response.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interactions:
1010
url: https://api.datadoghq.com/api/v2/ndm/interfaces?device_id=default:1.2.3.4
1111
response:
1212
body: '{"data":[{"id":"default:1.2.3.4:99","type":"interface","attributes":{"name":"if99","status":"up","description":"a
13-
network interface","mac_address":"00:00:00:00:00:00","alias":"interface_99","index":99}},{"id":"default:1.2.3.4:999","type":"interface","attributes":{"name":"if999","status":"down","description":"another
13+
network interface","mac_address":"00:00:00:00:00:00","ip_addresses":["1.1.1.1","1.1.1.2"],"alias":"interface_99","index":99}},{"id":"default:1.2.3.4:999","type":"interface","attributes":{"name":"if999","status":"down","description":"another
1414
network interface","mac_address":"99:99:99:99:99:99","alias":"interface_999","index":999}}]}'
1515
code: 200
1616
duration: 0ms

tests/scenarios/features/v2/network_device_monitoring.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Feature: Network Device Monitoring
8686
And the response "data[0].attributes.name" is equal to "if99"
8787
And the response "data[0].attributes.description" is equal to "a network interface"
8888
And the response "data[0].attributes.mac_address" is equal to "00:00:00:00:00:00"
89+
And the response "data[0].attributes.ip_addresses" is equal to ["1.1.1.1","1.1.1.2"]
8990
And the response "data[0].attributes.alias" is equal to "interface_99"
9091
And the response "data[0].attributes.index" is equal to 99
9192
And the response "data[0].attributes.status" is equal to "up"

0 commit comments

Comments
 (0)