Skip to content

dragse/proxmox-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

proxmox-api-go

The Proxmox API in golang. This Framework is still work in progress.

Features

Cluster

  • Version Endpoint
  • Get Next VM ID

Node

  • List all Nodes
  • List all VMs of the Node
  • Get Node Status of a specific Node
  • Get Time Configuration of a specific Node
  • Update Time Zone of a specific node

VM

  • Create VM
  • Create VNC TCP Proxy
  • Get VM Status
  • Update VM Status
  • Get Firewall Log
  • Get Firewall Options
  • Update Firewall Options
  • List IPSets
  • Create IPSets
  • Delete IPSets
  • Add CIDR to IPSet
  • Remove CIDR from IPSet
  • Copy a specific VM
  • Update the config of a VM
  • Resize a disk of a VM
  • Set CloudInitOptions

Pools

  • Create Pool
  • List All Pools
  • Show Pool Details

Installation

go get github.com/dragse/proxmox-api-go@v1.1.0

Usage

Create at first a client object. This objects manage and handle the http connections to the nodes

proxClient := client.NewProxmoxClient()

After that you need to add all Nodes you want to connect. It is recommended to connect to multiple nodes if you have a cluster and want high availability
The Cluster work with api tokens, you need to generate before.

session := client.ProxmoxSession{
    Hostname:  "hostname of the proxmox node",
    Username:  "username@pve!token-name",
    Token:     "apitoken",
}

err := proxClient.AddSession(&session)

if err != nil {
    log.Fatal(err)
}

The last step is to create the Cluster and init the information

proxCluster := proxmox.NewProxmoxCluster(proxClient)

err = proxCluster.InitInformation()

if err != nil {
    log.Fatal(err)
}

Now you can use the different methods to get or change Information of the cluster

Support

If you are having issues, please let us know. We have a mailing list located at: proxmox-apit@dragse.de

License

The project is licensed under the GPL-3.0 License.