VdsEvent events
17 FeatherPanel plugin events on VdsEvent (17 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.
Setup
Import VdsEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\VdsEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(VdsEvent::onVdsBackupCreated(), function ($userUuid, $vdsId, $vmid, $backupId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:backup:create ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'backup_id' => $backupId, 'context' => $context]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}VdsEvent::onVdsBackupCreated()
Docblock: string|null user uuid, int vds instance id, int vmid, string backup id, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | int |
| 4 | backup_id | $backupId | string |
| 5 | context | $context | array |
When it fires (3 sites)
$event->on(VdsEvent::onVdsBackupCreated(), function ($userUuid, $vdsId, $vmid, $backupId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:backup:create ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'backup_id' => $backupId, 'context' => $context]));
});VdsEvent::onVdsBackupDeleted()
Docblock: string|null user uuid, int vds instance id, int vmid, string volid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | volid | $volid | stringfrom docblock |
| 5 | context | $context | array |
When it fires (2 sites)
$event->on(VdsEvent::onVdsBackupDeleted(), function ($userUuid, $vdsId, $vmid, $volid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:backup:delete ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'volid' => $volid, 'context' => $context]));
});VdsEvent::onVdsBackupRestored()
Docblock: string|null user uuid, int vds instance id, int vmid, string restore id, string volid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | int |
| 4 | restore_id | $restoreId | string |
| 5 | volid | $volid | stringfrom docblock |
| 6 | context | $context | array |
When it fires (2 sites)
$event->on(VdsEvent::onVdsBackupRestored(), function ($userUuid, $vdsId, $vmid, $restoreId, $volid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:backup:restore ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'restore_id' => $restoreId, 'volid' => $volid, 'context' => $context]));
});VdsEvent::onVdsConsoleAccessed()
Docblock: string|null user uuid, int vds instance id, int vmid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | context | $context | array |
When it fires (2 sites)
$event->on(VdsEvent::onVdsConsoleAccessed(), function ($userUuid, $vdsId, $vmid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:console:access ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsCreated()
Docblock: string|null user uuid, int vds instance id, int vmid, array context. (the emitter passes 5 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | vds_id | $vdsId | null |
| 3 | vmid | $vmid | not declared |
| 4 | creation_id | $creationId | not declared |
| 5 | context | $context | array |
When it fires (1 site)
VmInstancesController::createviaemitVdsEvent()PUT /api/admin/vm-instances
$event->on(VdsEvent::onVdsCreated(), function ($userUuid, $vdsId, $vmid, $creationId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:created ' . json_encode(['context' => $context]));
});VdsEvent::onVdsDeleted()
Docblock: string|null user uuid, int vds instance id, int vmid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | int |
| 4 | context | $context | array |
When it fires (4 sites)
VmInstancesController::deleteviaemitVdsEvent()DELETE /api/admin/vm-instances/{id}VmInstancesController::deleteviaemitVdsEvent()DELETE /api/admin/vm-instances/{id}VmInstancesController::deleteviaemitVdsEvent()DELETE /api/admin/vm-instances/{id}VmInstancesController::hardDeleteviaemitVdsEvent()DELETE /api/admin/vm-instances/{id}/hard
$event->on(VdsEvent::onVdsDeleted(), function ($userUuid, $vdsId, $vmid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:deleted ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsIsoMounted()
Docblock: string|null user uuid, int vds instance id, int vmid, string volid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | int |
| 4 | volid | $volid | null |
| 5 | context | $context | array |
When it fires (2 sites)
$event->on(VdsEvent::onVdsIsoMounted(), function ($userUuid, $vdsId, $vmid, $volid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:iso:mount ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsIsoUnmounted()
Docblock: string|null user uuid, int vds instance id, int vmid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | intfrom docblock |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | context | $context | array |
When it fires (1 site)
$event->on(VdsEvent::onVdsIsoUnmounted(), function ($userUuid, $vdsId, $vmid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:iso:unmount ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsNetworkUpdated()
Docblock: string|null user uuid, int vds instance id, int vmid, array dns/network payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | changes | $changes | array |
| 5 | context | $context | array |
When it fires (1 site)
$event->on(VdsEvent::onVdsNetworkUpdated(), function ($userUuid, $vdsId, $vmid, $changes, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:network:update ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'changes' => $changes, 'context' => $context]));
});VdsEvent::onVdsPowerAction()
Docblock: string|null user uuid, int vds instance id, int vmid, string action, string task id, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | int |
| 4 | action | $action | bool |
| 5 | task_id | $taskId | string |
| 6 | context | $context | array |
When it fires (3 sites)
$event->on(VdsEvent::onVdsPowerAction(), function ($userUuid, $vdsId, $vmid, $action, $taskId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:power:action ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'action' => $action, 'task_id' => $taskId, 'context' => $context]));
});VdsEvent::onVdsQemuHardwareUpdated()
Docblock: string|null user uuid, int vds instance id, int vmid, array qemu payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | changes | $changes | array |
| 5 | context | $context | array |
When it fires (1 site)
$event->on(VdsEvent::onVdsQemuHardwareUpdated(), function ($userUuid, $vdsId, $vmid, $changes, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:qemu:hardware:update ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'changes' => $changes, 'context' => $context]));
});VdsEvent::onVdsReinstalled()
Docblock: string|null user uuid, int vds instance id, int vmid, string reinstall id, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | reinstall_id | $reinstallId | stringfrom docblock |
| 5 | context | $context | array |
When it fires (2 sites)
VmInstancesController::reinstallviaemitVdsEvent()POST /api/admin/vm-instances/{id}/reinstallVmUserInstanceController::reinstallviaemitVdsEvent()POST /api/user/vm-instances/{id}/reinstall
$event->on(VdsEvent::onVdsReinstalled(), function ($userUuid, $vdsId, $vmid, $reinstallId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:reinstall ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'reinstall_id' => $reinstallId, 'context' => $context]));
});VdsEvent::onVdsSubuserCreated()
Docblock: string|null user uuid, int vds instance id, int vmid, int subuser id, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | subuser_id | $subuserId | intfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
$event->on(VdsEvent::onVdsSubuserCreated(), function ($userUuid, $vdsId, $vmid, $subuserId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:subuser:create ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'subuser_id' => $subuserId, 'context' => $context]));
});VdsEvent::onVdsSubuserDeleted()
Docblock: string|null user uuid, int vds instance id, int vmid, int subuser id, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | subuser_id | $subuserId | int |
| 5 | context | $context | array |
When it fires (1 site)
$event->on(VdsEvent::onVdsSubuserDeleted(), function ($userUuid, $vdsId, $vmid, $subuserId, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:subuser:delete ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'subuser_id' => $subuserId, 'context' => $context]));
});VdsEvent::onVdsSuspended()
Docblock: string|null user uuid, int vds instance id, int vmid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | context | $context | array |
When it fires (1 site)
VmInstancesController::suspendviaemitVdsEvent()POST /api/admin/vm-instances/{id}/suspend
$event->on(VdsEvent::onVdsSuspended(), function ($userUuid, $vdsId, $vmid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:suspended ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsUnsuspended()
Docblock: string|null user uuid, int vds instance id, int vmid, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | context | $context | array |
When it fires (1 site)
VmInstancesController::unsuspendviaemitVdsEvent()POST /api/admin/vm-instances/{id}/unsuspend
$event->on(VdsEvent::onVdsUnsuspended(), function ($userUuid, $vdsId, $vmid, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:unsuspended ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'context' => $context]));
});VdsEvent::onVdsUpdated()
Docblock: string|null user uuid, int vds instance id, int vmid, array changed fields, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vds_id | $vdsId | int |
| 3 | vmid | $vmid | intfrom docblock |
| 4 | changed_fields | $changedFields | array |
| 5 | context | $context | array |
When it fires (2 sites)
VmInstancesController::updateviaemitVdsEvent()PATCH /api/admin/vm-instances/{id}VmInstancesController::setBackupLimitviaemitVdsEvent()PATCH /api/admin/vm-instances/{id}/backup-limit
$event->on(VdsEvent::onVdsUpdated(), function ($userUuid, $vdsId, $vmid, $changedFields, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:updated ' . json_encode(['user_uuid' => $userUuid, 'vds_id' => $vdsId, 'vmid' => $vmid, 'changed_fields' => $changedFields, 'context' => $context]));
});