feat: Implement comprehensive vCenter integration with new services for VM configuration, power management, templates, snapshots, and resource management, alongside infrastructure management and synchronization job updates.

This commit is contained in:
pbao9
2026-02-12 17:23:01 +07:00
parent f3a679d7f3
commit 64c3182b00
16 changed files with 1979 additions and 223 deletions
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('infra_management', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('host')->unique()->comment('IP or Hostname');
$table->string('username');
$table->longText('password'); // Should be encrypted
$table->text('token')->nullable();
$table->string('type')->default('vcenter')->comment('vcenter, esxi, etc.');
$table->boolean('status')->default(true);
$table->text('description')->nullable();
$table->json('meta_data')->nullable(); // For extra config
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('infra_management');
}
};
@@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\InfraManagement;
use App\Http\Facade\SignRSA;
class InfraManagementSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
InfraManagement::updateOrCreate(
['host' => '10.10.10.173'],
[
'name' => 'Jumphost 173',
'username' => 'administrator',
'password' => SignRSA::EncryptFunc('Thegioiso@123**$$8899TgTk2'),
'type' => 'jumphost',
'status' => true,
'meta_data' => [
'port' => 22
],
'description' => 'Main Jumphost for vCenter PowerCLI operations'
]
);
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class ProvinceWardSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$path = database_path('province_ward_import.sql');
if (File::exists($path)) {
// Read and execute the SQL file
$sql = File::get($path);
// Execute the SQL commands
DB::unprepared($sql);
$this->command->info('Province/Ward data imported successfully from SQL file.');
} else {
$this->command->error('File database/province_ward_import.sql not found.');
}
}
}