33 lines
784 B
PHP
33 lines
784 B
PHP
<?php
|
|
|
|
namespace App\Http\Services\vCenter;
|
|
|
|
use App\Support\TlsHttpClientFactory;
|
|
|
|
class TemplateService
|
|
{
|
|
protected Client $client;
|
|
|
|
public function __construct(Client $client)
|
|
{
|
|
$this->client = $client;
|
|
}
|
|
|
|
public function getAllTemplate()
|
|
{
|
|
if ($this->client->checkApiExits()) {
|
|
$response = TlsHttpClientFactory::vCenter()
|
|
->withHeaders([
|
|
'vmware-api-session-id' => $this->client->token
|
|
])
|
|
->get("https://{$this->client->apiUri}/rest/com/vmware/content/library")->json();
|
|
|
|
if (!isset($response['type'])) {
|
|
return $response['value'];
|
|
}
|
|
return false;
|
|
}
|
|
return "Login_Again";
|
|
}
|
|
}
|