mirror of
https://github.com/luthermonson/go-proxmox.git
synced 2026-04-26 17:35:48 +03:00
[GH-ISSUE #33] Ping() return current state #9
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-proxmox#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alebeta90 on GitHub (May 9, 2022).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/33
Hi friends,
I had been trying this module and it is great.
I just have a question regarding the Ping() method. As far as I can see it returns an error if occurred.
But I had in mind that i could be useful(for me) to get the actual current information from the VM. Is there another method similar to ping that can bring the current state with its full body?
I had a look at the endpoint we are sending the request and it has different kind of information I would like to use
https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/status/current
or is there a way to get the body of that request?
hope my question is understandable and if you need more info I can provide it
thanks in advance!
@luthermonson commented on GitHub (May 9, 2022):
I'm glad you enjoy the library!
https://github.com/luthermonson/go-proxmox/blob/main/virtual_machines.go#L16
the last element passed to Get is a pointer to the struct you're currently calling Ping on, this will unmarshall directly into it so the contents of the struct you are working with will be updated when you call Ping. I'm trying to avoid giving full access to returned JSON data from the API and instead using native go structs for everything.
Look at the struct https://github.com/luthermonson/go-proxmox/blob/main/types.go#L194-L218 to see what could be updated from the response sent from the status/current endpoint and if we are missing something you are expecting you can add more members.
@alebeta90 commented on GitHub (May 10, 2022):
Thanks for the great explanation I will have a look at it! and come back to you