pve-go

module
v0.0.0-...-4cf3db6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: MIT

README

pve: Go client library for Proxmox VE APIs

Go Reference

pve-go is intended to be a client library for Proxmox VE v7.x.

The project is still in early phase of development and it's not considered ready for production.

Installation

go get github.com/federicoantoniazzi/pve-go@latest

Example

package main

import (
	"fmt"
	"log"
	"time"

	"github.com/FedericoAntoniazzi/pve-go/pve"
)

func main() {
	// Create a new client
	pveClient := pve.NewClient(
		"https://pve.example.com/api2/json",
		pve.WithApiToken("token-id", "super-secret-key"),
		pve.AllowInsecureConnection(),
	)

	// List all nodes
	nodes, err := pveClient.Node.List()
	if err != nil {
		log.Fatal("Error while listing nodes: ", err)
	}

	// Print all nodes info
	for _, node := range nodes {
		uptime := time.Duration(node.Uptime) * time.Second
		fmt.Println(node.Node, node.IP, uptime)
	}
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

References

Acknowledgements

Directories

Path Synopsis
internal
log
pve
Package pve is a module for the ProxmoxVE APIs
Package pve is a module for the ProxmoxVE APIs
schema
Package schema contains the definitions of the Proxmox API objects
Package schema contains the definitions of the Proxmox API objects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL