[PR #201] [MERGED] Add listing of network interfaces by type #210

Closed
opened 2026-03-03 15:30:42 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/luthermonson/go-proxmox/pull/201
Author: @andyjsmith
Created: 6/10/2025
Status: Merged
Merged: 6/14/2025
Merged by: @luthermonson

Base: mainHead: main


📝 Commits (5)

  • 2c89d87 add listing of networks by type
  • 5e5eebd change NodeNetwork.Active to StringOrInt
  • 0ccf80f update NetworksOfType test to use string version of Active field
  • eb7b4ee switch network list filter to variadic arg on existing func
  • 232d049 switch Networks func to use net/url

📊 Changes

4 files changed (+69 additions, -10 deletions)

View changed files

📝 nodes_network.go (+15 -2)
📝 nodes_network_test.go (+18 -0)
📝 tests/mocks/pve8x/nodes.go (+28 -0)
📝 types.go (+8 -8)

📄 Description

See #200 for reasoning.

This PR adds a new function NetworksOfType to enable listing of networks by a specific type. Requesting a specific type can return more results than just requesting all networks, so this allows you to query all types of networks.

One caveat is that in NodeNetwork, I needed to change the Active field from int to StringOrInt since for some reason some of Proxmox's responses when specifying type are set to strings rather than ints. This may be a breaking change, although StringOrInt is an int under the hood so in most cases it should work as-is. Open to suggestions here.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/luthermonson/go-proxmox/pull/201 **Author:** [@andyjsmith](https://github.com/andyjsmith) **Created:** 6/10/2025 **Status:** ✅ Merged **Merged:** 6/14/2025 **Merged by:** [@luthermonson](https://github.com/luthermonson) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (5) - [`2c89d87`](https://github.com/luthermonson/go-proxmox/commit/2c89d87b952b8e6c8b8c15491bc9cd13976de73c) add listing of networks by type - [`5e5eebd`](https://github.com/luthermonson/go-proxmox/commit/5e5eebde102b46591868392b46259fcbe757ee7d) change NodeNetwork.Active to StringOrInt - [`0ccf80f`](https://github.com/luthermonson/go-proxmox/commit/0ccf80f90820995286d0ef2d76105a8634913b8d) update NetworksOfType test to use string version of Active field - [`eb7b4ee`](https://github.com/luthermonson/go-proxmox/commit/eb7b4ee083edb70a9e9bd45852d8f3f4038ab011) switch network list filter to variadic arg on existing func - [`232d049`](https://github.com/luthermonson/go-proxmox/commit/232d0493190db1258d71b756dc885a4630f93b55) switch Networks func to use net/url ### 📊 Changes **4 files changed** (+69 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `nodes_network.go` (+15 -2) 📝 `nodes_network_test.go` (+18 -0) 📝 `tests/mocks/pve8x/nodes.go` (+28 -0) 📝 `types.go` (+8 -8) </details> ### 📄 Description See #200 for reasoning. This PR adds a new function `NetworksOfType` to enable listing of networks by a specific type. Requesting a specific type can return more results than just requesting all networks, so this allows you to query all types of networks. One caveat is that in `NodeNetwork`, I needed to change the `Active` field from `int` to `StringOrInt` since for some reason some of Proxmox's responses when specifying type are set to strings rather than ints. This may be a breaking change, although StringOrInt is an int under the hood so in most cases it should work as-is. Open to suggestions here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 15:30:42 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-proxmox#210
No description provided.