VdsNodeEvent events
10 FeatherPanel plugin events on VdsNodeEvent (10 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 VdsNodeEvent 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\VdsNodeEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(VdsNodeEvent::onVdsNodeCreated(), function ($userUuid, $vmNodeId, $vmNode, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:create ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'vm_node' => $vmNode, 'context' => $context]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}VdsNodeEvent::onVdsNodeCreated()
Docblock: string|null user uuid, int vm node id, array node payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | vm_node | $vmNode | arrayfrom docblock |
| 4 | context | $context | array |
When it fires (1 site)
VmNodesController::createviaemitVdsEvent()PUT /api/admin/vm-nodes
$event->on(VdsNodeEvent::onVdsNodeCreated(), function ($userUuid, $vmNodeId, $vmNode, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:create ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'vm_node' => $vmNode, 'context' => $context]));
});VdsNodeEvent::onVdsNodeDeleted()
Docblock: string|null user uuid, int vm node id, array node payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | vm_node | $vmNode | arrayfrom docblock |
| 4 | context | $context | array |
When it fires (1 site)
VmNodesController::deleteviaemitVdsEvent()DELETE /api/admin/vm-nodes/{id}
$event->on(VdsNodeEvent::onVdsNodeDeleted(), function ($userUuid, $vmNodeId, $vmNode, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:delete ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'vm_node' => $vmNode, 'context' => $context]));
});VdsNodeEvent::onVdsNodeIpCreated()
Docblock: string|null user uuid, int vm node id, int ip id, array ip payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | ip_id | $ipId | int |
| 4 | ip | $ip | arrayfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
VmNodesController::createIpviaemitVdsEvent()PUT /api/admin/vm-nodes/{id}/ips
$event->on(VdsNodeEvent::onVdsNodeIpCreated(), function ($userUuid, $vmNodeId, $ipId, $ip, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:ip:create ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'ip_id' => $ipId, 'ip' => $ip, 'context' => $context]));
});VdsNodeEvent::onVdsNodeIpDeleted()
Docblock: string|null user uuid, int vm node id, int ip id, array ip payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | ip_id | $ipId | int |
| 4 | ip | $ip | arrayfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
VmNodesController::deleteIpviaemitVdsEvent()DELETE /api/admin/vm-nodes/{id}/ips/{ipId}
$event->on(VdsNodeEvent::onVdsNodeIpDeleted(), function ($userUuid, $vmNodeId, $ipId, $ip, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:ip:delete ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'ip_id' => $ipId, 'ip' => $ip, 'context' => $context]));
});VdsNodeEvent::onVdsNodeIpPrimarySet()
Docblock: string|null user uuid, int vm node id, int ip id, array ip payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | ip_id | $ipId | int |
| 4 | ip | $ip | arrayfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
$event->on(VdsNodeEvent::onVdsNodeIpPrimarySet(), function ($userUuid, $vmNodeId, $ipId, $ip, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:ip:primary ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'ip_id' => $ipId, 'ip' => $ip, 'context' => $context]));
});VdsNodeEvent::onVdsNodeIpUpdated()
Docblock: string|null user uuid, int vm node id, int ip id, array ip payload, array changed fields, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | ip_id | $ipId | int |
| 4 | ip | $ip | arrayfrom docblock |
| 5 | changed_fields | $changedFields | array |
| 6 | context | $context | array |
When it fires (1 site)
VmNodesController::updateIpviaemitVdsEvent()PATCH /api/admin/vm-nodes/{id}/ips/{ipId}
$event->on(VdsNodeEvent::onVdsNodeIpUpdated(), function ($userUuid, $vmNodeId, $ipId, $ip, $changedFields, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:ip:update ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'ip_id' => $ipId, 'ip' => $ip, 'changed_fields' => $changedFields, 'context' => $context]));
});VdsNodeEvent::onVdsNodeUpdated()
Docblock: string|null user uuid, int vm node id, array node payload, array changed fields, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | vm_node_id | $vmNodeId | int |
| 3 | vm_node | $vmNode | arrayfrom docblock |
| 4 | changed_fields | $changedFields | array |
| 5 | context | $context | array |
When it fires (1 site)
VmNodesController::updateviaemitVdsEvent()PATCH /api/admin/vm-nodes/{id}
$event->on(VdsNodeEvent::onVdsNodeUpdated(), function ($userUuid, $vmNodeId, $vmNode, $changedFields, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:node:update ' . json_encode(['user_uuid' => $userUuid, 'vm_node_id' => $vmNodeId, 'vm_node' => $vmNode, 'changed_fields' => $changedFields, 'context' => $context]));
});VdsNodeEvent::onVdsTemplateCreated()
Docblock: string|null user uuid, int template id, int vm node id, array template payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | template_id | $templateId | intfrom docblock |
| 3 | vm_node_id | $vmNodeId | int |
| 4 | template | $template | arrayfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
VmNodesController::createTemplateviaemitVdsEvent()POST /api/admin/vm-nodes/{id}/templates
$event->on(VdsNodeEvent::onVdsTemplateCreated(), function ($userUuid, $templateId, $vmNodeId, $template, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:template:create ' . json_encode(['user_uuid' => $userUuid, 'template_id' => $templateId, 'vm_node_id' => $vmNodeId, 'template' => $template, 'context' => $context]));
});VdsNodeEvent::onVdsTemplateDeleted()
Docblock: string|null user uuid, int template id, int vm node id, array template payload, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | template_id | $templateId | int |
| 3 | vm_node_id | $vmNodeId | intfrom docblock |
| 4 | template | $template | arrayfrom docblock |
| 5 | context | $context | array |
When it fires (1 site)
VmNodesController::deleteTemplateviaemitVdsEvent()DELETE /api/admin/vm-templates/{id}
$event->on(VdsNodeEvent::onVdsTemplateDeleted(), function ($userUuid, $templateId, $vmNodeId, $template, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:template:delete ' . json_encode(['user_uuid' => $userUuid, 'template_id' => $templateId, 'vm_node_id' => $vmNodeId, 'template' => $template, 'context' => $context]));
});VdsNodeEvent::onVdsTemplateUpdated()
Docblock: string|null user uuid, int template id, int vm node id, array template payload, array changed fields, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | string|nullfrom docblock |
| 2 | template_id | $templateId | int |
| 3 | vm_node_id | $vmNodeId | intfrom docblock |
| 4 | template | $template | arrayfrom docblock |
| 5 | changed_fields | $changedFields | array |
| 6 | context | $context | array |
When it fires (1 site)
VmNodesController::updateTemplateviaemitVdsEvent()PATCH /api/admin/vm-templates/{id}
$event->on(VdsNodeEvent::onVdsTemplateUpdated(), function ($userUuid, $templateId, $vmNodeId, $template, $changedFields, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:vds:template:update ' . json_encode(['user_uuid' => $userUuid, 'template_id' => $templateId, 'vm_node_id' => $vmNodeId, 'template' => $template, 'changed_fields' => $changedFields, 'context' => $context]));
});