update fix deadcode, security

This commit is contained in:
baodev0
2026-09-28 08:26:29 +07:00
parent 3af59bd9c5
commit 82080b5b84
452 changed files with 4857 additions and 26289 deletions
@@ -2,7 +2,6 @@
namespace App\Http\Services\vCenter;
use Illuminate\Support\Facades\Http;
use App\Support\TlsHttpClientFactory;
class TemplateService
@@ -30,76 +29,4 @@ class TemplateService
}
return "Login_Again";
}
public function getTemplatebyID($template = '')
{
$response = TlsHttpClientFactory::vCenter()
->withHeaders([
'vmware-api-session-id' => $this->client->token
])
->get("https://{$this->client->apiUri}/rest/com/vmware/content/library/id:{$template}")->json();
if (!isset($response['type'])) {
return $response['value']['storage_backings'][0]['datastore_id'];
}
return false;
}
public function getTemplateFromDatastore($datastore = '')
{
$allTemplate = $this->getAllTemplate();
if (!$allTemplate) {
return false;
}
foreach ($allTemplate as $template) {
$detailTemplate = $this->getTemplatebyID($template);
if ($detailTemplate && $detailTemplate === $datastore) {
return $template;
}
}
return false;
}
public function getVersionDetail($version_id = '')
{
$response = TlsHttpClientFactory::vCenter()
->withHeaders([
'vmware-api-session-id' => $this->client->token
])
->get("https://{$this->client->apiUri}/rest/com/vmware/content/library/item/id:{$version_id}")->json();
if (!isset($response['type'])) {
return $response['value'];
}
return false;
}
public function getAllVersion($library = ''): bool|array|string
{
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/item", [
'library_id' => $library
])->json();
if (!isset($response['type'])) {
$library_item = [];
foreach ($response['value'] as $value) {
$value_detail = $this->getVersionDetail($value);
if ($value_detail) {
$library_item[] = [
'name' => $value_detail['name'],
'id' => $value_detail['id']
];
}
}
return $library_item;
}
return false;
}
return "Login_Again";
}
}