Update source into github
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\VirtualMachine\Create;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckIPAddress implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
protected string $vmware_id;
|
||||
protected $serviceVCenter;
|
||||
protected $data;
|
||||
protected array $info;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($vmware_id, $data,$virtual_info,$service)
|
||||
{
|
||||
$this->vmware_id = $vmware_id;
|
||||
$this->serviceVCenter = $service;
|
||||
$this->data = $data;
|
||||
$this->info = $virtual_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$DetailVirtualMachine = $this->serviceVCenter->GetIPAddressVirtualMachine($this->vmware_id);
|
||||
|
||||
if ($DetailVirtualMachine['error']) {
|
||||
throw new \Exception(json_encode($DetailVirtualMachine['message']));
|
||||
}
|
||||
|
||||
if (!$DetailVirtualMachine['data']['ip_address'] === $this->data->IpAddress->ip) {
|
||||
throw new \Exception(json_encode($DetailVirtualMachine['message']));
|
||||
}
|
||||
$jobs_configDB = new ConfigDatabase($this->data,$this->info);
|
||||
dispatch($jobs_configDB)->delay(now()->addSeconds(5));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user