All Projects → Corsinvest → cv4pve-api-php

Corsinvest / cv4pve-api-php

Licence: GPL-3.0 license
Proxmox VE Client API for PHP

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to cv4pve-api-php

cv4pve-api-dotnet
Proxmox VE Client API .Net C#
Stars: ✭ 25 (-44.44%)
Mutual labels:  enterprise, api-gateway, api-client, lxc, qemu, api-rest, proxmox, proxmox-cluster, proxmox-ve, pve, proxmox-apis, proxmoxve
cv4pve-botgram
Telegram Bot for Proxmox VE
Stars: ✭ 26 (-42.22%)
Mutual labels:  cluster, lxc, qemu, proxmox, proxmox-cluster, proxmox-ve
Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (-62.22%)
Mutual labels:  api-gateway, cluster, api-client, lxc, qemu, api-rest
ProxmoxVE PHP API
ProxmoxVE PHP API
Stars: ✭ 78 (+73.33%)
Mutual labels:  lxc, qemu, proxmox, pve, proxmoxve
proxmox-tools
📦 A collection of stuff that I and others wrote for Proxmox 📦
Stars: ✭ 112 (+148.89%)
Mutual labels:  cluster, proxmox, proxmox-cluster, proxmox-ve, proxmox-apis
Cv4pve Autosnap
Automatic snapshot tool for Proxmox VE
Stars: ✭ 123 (+173.33%)
Mutual labels:  cluster, lxc, qemu
cv4pve-metrics
Metrics for Proxmox VE, Grafana with dasboard, InfluxDb
Stars: ✭ 38 (-15.56%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
cv4pve-pepper
Launching SPICE remote-viewer for Proxmox VE
Stars: ✭ 48 (+6.67%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
ans-pve-win-templ
Ansible playbook to create Proxmox Windows VM templates
Stars: ✭ 49 (+8.89%)
Mutual labels:  proxmox, proxmox-ve, pve
Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+1875.56%)
Mutual labels:  enterprise, api-gateway, cluster
ansible role proxmox
Ansible role to provision containers in Proxmox VE virtualization
Stars: ✭ 42 (-6.67%)
Mutual labels:  proxmox, proxmox-cluster, proxmox-ve
Cv4pve Barc
Backup And Restore Ceph for Proxmox VE
Stars: ✭ 74 (+64.44%)
Mutual labels:  cluster, lxc, qemu
pve exporter
Prometheus exporter for Proxmox VE.
Stars: ✭ 31 (-31.11%)
Mutual labels:  proxmox, proxmox-ve, proxmox-apis
django-api-bouncer
Simple Django app to provide API Gateways for micro-services
Stars: ✭ 18 (-60%)
Mutual labels:  api-gateway, api-rest
dubbo-go-pixiu
Based on the proxy gateway service of dubbo-go, it solves the problem that the external protocol calls the internal Dubbo cluster. At present, it supports HTTP and gRPC[developing].
Stars: ✭ 385 (+755.56%)
Mutual labels:  api-gateway, api-rest
Scalecube Services
ScaleCube Services is a high throughput, low latency reactive microservices library built to scale. it features: API-Gateways, service-discovery, service-load-balancing, the architecture supports plug-and-play service communication modules and features. built to provide performance and low-latency real-time stream-processing. its open and designed to accommodate changes. (no sidecar in a form of broker or any kind)
Stars: ✭ 482 (+971.11%)
Mutual labels:  api-gateway, cluster
Dubbo Go Pixiu
Based on the proxy gateway service of dubbo-go, it solves the problem that the external protocol calls the internal Dubbo cluster. At present, it supports HTTP and gRPC[developing].
Stars: ✭ 124 (+175.56%)
Mutual labels:  api-gateway, api-rest
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (+302.22%)
Mutual labels:  api-gateway, api-rest
Diplomat
A HTTP Ruby API for Consul
Stars: ✭ 358 (+695.56%)
Mutual labels:  cluster, api-client
python-sonarqube-api
Python wrapper for the SonarQube (Community Edition and Enterprise Edition) and SonarCloud API.
Stars: ✭ 107 (+137.78%)
Mutual labels:  enterprise, api-client

cv4pve-api-php

License Packagist Version

Proxmox VE Client API PHP

Proxmox VE Api

   ______                _                      __
  / ____/___  __________(_)___ _   _____  _____/ /_
 / /   / __ \/ ___/ ___/ / __ \ | / / _ \/ ___/ __/
/ /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_
\____/\____/_/  /____/_/_/ /_/|___/\___/____/\__/

Corsinvest for Proxmox VE Api Client  (Made in Italy)

Copyright and License

Copyright: Corsinvest Srl For licensing details please visit LICENSE.md

Commercial Support

This software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the site

General

The client is generated from a JSON Api on Proxmox VE.

This PHP 5.4+ library allows you to interact with your Proxmox server via API. The client is generated from a JSON Api on Proxmox VE.

Result

The result is class Result and contain methods:

  • getResponse() returned from Proxmox VE (data,errors,...) Object/Array
  • responseInError (bool) : Contains errors from Proxmox VE.
  • getStatusCode() (int) : Status code of the HTTP response.
  • getReasonPhrase() (string): The reason phrase which typically is sent by servers together with the status code.
  • isSuccessStatusCode() (bool) : Gets a value that indicates if the HTTP response was successful.
  • getError() (string) : Get error.

Main features

  • Easy to learn
  • No dependency external library only native curl
  • Implementation respect the Api structure of Proxmox VE
  • Method named
  • Set ResponseType json, png
  • Full method generated from documentation
  • Comment any method and parameters
  • Parameters indexed eg [n] is structured in array index and value
  • Tree structure
    • $client->getNodes()->get("pve1")->getQemu()->get(100)->getSnapshot()->snapshotList()->getResponse()->data
  • Return data proxmox
  • Return result
    • Request
    • Response
    • Status
  • Wait task finish task
    • waitForTaskToFinish
    • taskIsRunning
    • getExitStatusTask
  • Method direct access
    • get
    • set
    • create
    • delete
  • Login return bool if access
  • Return Result class more information
  • Return object/array data
    • default object disable from client.setResultIsObject(false)
  • ClientBase lite function
  • Form Proxmox VE 6.2 support Api Token for user

Api token

From version 6.2 of Proxmox VE is possible to use Api token. This feature permit execute Api without using user and password. If using Privilege Separation when create api token remember specify in permission. Format USER@REALM!TOKENID=UUID

Installation

Recommended installation is using [Composer], if you do not have [Composer] what are you waiting?

In the root of your project execute the following:

composer require Corsinvest/cv4pve-api-php

Or add this to your composer.json

Usage

<?php

// Require the autoloader
require_once 'vendor/autoload.php';

//if you want use lite version only get/set/create/delete use PveClientBase

$client = new Corsinvest\ProxmoxVE\Api\PveClient("192.168.0.24");

//login check bool
if($client->login('root','password','pam')){
  //get version from get method
  var_dump($client->get('/version')->getResponse());

  // $client->put
  // $client->post
  // $client->delete

  $retPippo=$client->get("/pippo");
  echo "\n" . $retPippo->getStatusCode();
  echo "\n" . $retPippo->getReasonPhrase();

  //loop nodes
  foreach ($client->getNodes()->Index()->getResponse()->data as $node) {
    echo "\n" . $node->id;
  }

  //loop vm
  foreach ($client->getNodes()->get("pve1")->getQemu()->Vmlist()->getResponse()->data as $vm) {
      echo "\n" . $vm->vmid ." - " .$vm->name;
  }

  //loop snapshots
  foreach ($client->getNodes()->get("pve1")->getQemu()->get(100)->getSnapshot()->snapshotList()->getResponse()->data as $snap) {
    echo "\n" . $snap->name;
  }

  //return object
  var_dump($client->getVersion()->version()->getResponse());

  //disable return object
  $client->setResultIsObject(false);
  //return array
  $retArr = $client->getVersion()->version()->getResponse();
  var_dump($retArr);
  echo "\n" . $retArr['data']['release'];

  //enable return objet
  $client->setResultIsObject(true);

  //image rrd
  $client->setResponseType('png');
  echo "<img src='{$client->getNodes()->get("pve1")->getRrd()->rrd('cpu','day')->getResponse()}' \>";

  //result json result
  $client->setResponseType('json');
  var_dump($client->get('/version')->getResponse());
}

Sample output version request:

//object result
var_dump($client->getVersion()->Version()->getResponse());

object(stdClass)#9 (1) {
  ["data"]=>
  object(stdClass)#32 (4) {
    ["version"]=>
    string(3) "5.0"
    ["release"]=>
    string(2) "31"
    ["keyboard"]=>
    string(2) "it"
    ["repoid"]=>
    string(8) "27769b1f"
  }
}

//disable return object
$client->setResultIsObject(false);

//array result
var_dump($client->getVersion()->Version());

array(1) {
  ["data"]=>
  array(4) {
    ["repoid"]=>
    string(8) "2560e073"
    ["release"]=>
    string(2) "32"
    ["version"]=>
    string(3) "5.0"
    ["keyboard"]=>
    string(2) "it"
  }
}

The parameter indexed end with '[n]' in documentation (method createVM in Qemu parameter ide) require array whit key and value

[
  1 => "....",
  3 => "....",
]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].