for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace FNDEV\vShpare\Api\VM\Power;
use FNDEV\vShpare\Api\VM\Abstracts\InitClass;
use FNDEV\vShpare\Api\VM\Traits\MOID;
use FNDEV\vShpare\Api\VM\VmSource;
use FNDEV\vShpare\ApiResponse;
use GuzzleHttp\Client;
class Power extends InitClass
{
use MOID;
FNDEV\vShpare\Api\VM\Traits\MOID
$moid
FNDEV\vShpare\Api\VM\Power\Power
/**
* Returns the power state information of a virtual machine
*/
public function power($moid=null){
return ApiResponse::BodyResponse($this->HttpClient->get("vcenter/vm/{$this->getMoid($moid)}/power"));
}
public function powerOff($moid=null){
return !ApiResponse::HasError($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/power/stop"));
* Powers on a powered-off or suspended virtual machine
public function powerOn($moid=null){
return !ApiResponse::HasError($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/power/start"));
* Resets a powered-on virtual machine
public function reset($moid=null){
return !ApiResponse::HasError($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/power/reset"));
public function suspend($moid=null){
return !ApiResponse::HasError($this->HttpClient->post("vcenter/vm/{$this->getMoid($moid)}/power/suspend"));