View .md

CloudManagementEvent events

5 FeatherPanel plugin events on CloudManagementEvent (4 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. 1 of these events are declared but no code emits them yet; they are marked not emitted.

Setup

Import CloudManagementEvent 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\CloudManagementEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(CloudManagementEvent::onCloudCredentialsRetrieved(), function ($credentials): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:credentials:retrieved ' . json_encode(['credentials' => $credentials]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

CloudManagementEvent::onCloudCredentialsStored()

Name: featherpanel:admin:cloud:cloud:credentials:storedemitted at 2 sites2 payload shapesCancel or modify: nodefinition

Docblock: array credentials data. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1credentials$credentialsarray
2stored_by$storedBynot declared
Arguments passedEmitted from
credentials, stored_by
CloudManagementController::storeCloud
credentials, stored_by, source, team_uuid, mythic_user_id
CloudManagementController::saveOAuth2Callback
When it fires (2 sites)
$event->on(CloudManagementEvent::onCloudCredentialsStored(), function ($credentials, $storedBy, ...$rest): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:cloud:credentials:stored ' . json_encode(['credentials' => $credentials]));
});

CloudManagementEvent::onCloudCredentialsRetrieved()

Name: featherpanel:admin:cloud:credentials:retrievedemitted at 1 siteCancel or modify: nodefinition

Docblock: array credentials data.

#Payload keyListener parameterType
1credentials$credentialsarray
When it fires (1 site)
$event->on(CloudManagementEvent::onCloudCredentialsRetrieved(), function ($credentials): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:credentials:retrieved ' . json_encode(['credentials' => $credentials]));
});

CloudManagementEvent::onCloudCredentialsRotated()

Name: featherpanel:admin:cloud:credentials:rotatedemitted at 1 siteCancel or modify: nodefinition

Docblock: string credential type. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1credential_type$credentialTypestring
2rotated_by$rotatedBynot declared
When it fires (1 site)
$event->on(CloudManagementEvent::onCloudCredentialsRotated(), function ($credentialType, $rotatedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:credentials:rotated ' . json_encode(['credential_type' => $credentialType]));
});

CloudManagementEvent::onCloudManagementError()

Name: featherpanel:admin:cloud:errornot emittedCancel or modify: nodefinition

Docblock: string error message, array context.

$event->on(CloudManagementEvent::onCloudManagementError(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:error ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

CloudManagementEvent::onPanelCredentialsStored()

Name: featherpanel:admin:cloud:panel:credentials:storedemitted at 1 siteCancel or modify: nodefinition

Docblock: array credentials data. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1credentials$credentialsarray
2stored_by$storedBynot declared
When it fires (1 site)
$event->on(CloudManagementEvent::onPanelCredentialsStored(), function ($credentials, $storedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:cloud:panel:credentials:stored ' . json_encode(['credentials' => $credentials]));
});