update sync vm
This commit is contained in:
@@ -77,6 +77,29 @@ class vCenter
|
||||
return "Login_Again";
|
||||
}
|
||||
|
||||
public function getAllVirtualMachine($datacenter = '')
|
||||
{
|
||||
$check = $this->checkApiExits();
|
||||
if ($check) {
|
||||
$params = [];
|
||||
if (!empty($datacenter)) {
|
||||
$params['filter.datacenters'] = $datacenter;
|
||||
}
|
||||
|
||||
$response = Http::withoutVerifying()
|
||||
->withHeaders([
|
||||
'vmware-api-session-id' => $this->token
|
||||
])
|
||||
->get("https://$this->apiUri/rest/vcenter/vm", $params)->json();
|
||||
|
||||
if (!isset($response['type'])) {
|
||||
return $response['value'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return "Login_Again";
|
||||
}
|
||||
|
||||
public function checkApiExits(): bool
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user