VM::consoleTicket()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
4
namespace FNDEV\vShpare\Api\VM;
5
use FNDEV\vShpare\Api\VM\ConsoleTickets\ConsoleTickets;
6
use FNDEV\vShpare\Api\VM\GuestPower\GuestPower;
7
use FNDEV\vShpare\Api\VM\Hardware\Hardware;
8
use FNDEV\vShpare\Api\VM\Power\Power;
9
use FNDEV\vShpare\Api\VM\Tools\Tools;
10
use GuzzleHttp\Client;
11
12
class VM
13
{
14
    public Client $HttpClient;
15
    public function __construct(Client $client)
16
    {
17
        $this->HttpClient=$client;
18
    }
19
    public function power(){
20
        return new Power($this->HttpClient);
21
    }
22
    public function guestPower(){
23
        return new GuestPower($this->HttpClient);
24
    }
25
    public function tools(){
26
        return new Tools($this->HttpClient);
27
    }
28
    public function consoleTicket(){
29
        return new ConsoleTickets($this->HttpClient);
30
    }
31
    public function hardWare(){
32
        return new Hardware($this->HttpClient);
33
    }
34
    public function all(array $query=null){
35
        $response=$this->HttpClient->get("vcenter/vm",[
36
            "query"=>$query
37
        ]);
38
        return new ManageVms(json_decode($response->getBody()),$this->HttpClient);
39
    }
40
    public function byMoId($moid, array $query=[]){
41
        $response=$this->HttpClient->get("vcenter/vm/$moid",[
42
            "query"=>$query
43
        ]);
44
        return new VmSource($this->HttpClient,json_decode($response->getBody()),$moid);
45
    }
46
}