public void registerActions()

in Utils/azure-toolkit-ide-libs/azure-toolkit-ide-containerapps-lib/src/main/java/com/microsoft/azure/toolkit/ide/containerapps/ContainerAppsActionsContributor.java [67:235]


    public void registerActions(AzureActionManager am) {
        new Action<>(CREATE_CONTAINER_APP)
            .withLabel("Container App")
            .register(am);

        new Action<>(SERVICE_CREATE_CONTAINER_APP)
            .withLabel("Create Container App")
            .withIcon(AzureIcons.Action.CREATE.getIconPath())
            .register(am);

        new Action<>(START_ENV_LOG_STREAM)
                .withLabel("Start Streaming Logs")
                .withIcon(AzureIcons.Action.LOG.getIconPath())
                .withIdParam(AbstractAzResource::getName)
                .register(am);

        new Action<>(STOP_ENV_LOG_STREAM)
                .withLabel("Stop Streaming Logs")
                .withIcon(AzureIcons.Action.LOG.getIconPath())
                .withIdParam(AbstractAzResource::getName)
                .register(am);

        new Action<>(CREATE_CONTAINER_APPS_ENVIRONMENT)
                .withLabel("Create Container Apps Environment")
                .withIcon(AzureIcons.Action.CREATE.getIconPath())
                .register(am);

        new Action<>(BROWSE)
            .withLabel("Open In Browser")
            .withIcon(AzureIcons.Action.BROWSER.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .withHandler((s, e) -> {
                if (!s.isIngressEnabled() || StringUtils.isBlank(s.getIngressFqdn())) {
                    final Action<AzResource> action = new Action<>(SHOW_PROPERTIES)
                        .withLabel("Open Properties Editor")
                        .withHandler(r -> am.getAction(ResourceCommonActionsContributor.SHOW_PROPERTIES).handle(s, e));
                    AzureMessager.getMessager().warning("Ingress is not enabled for this container app.", null, action);
                } else {
                    am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle("https://" + s.getIngressFqdn(), e);
                }
            })
            .register(am);

        new Action<>(ACTIVATE_LATEST_REVISION)
            .withLabel("Activate Latest Revision")
            .withIcon(AzureIcons.Action.START.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp &&
                ((ContainerApp) s).getFormalStatus().isConnected() &&
                Objects.nonNull(((ContainerApp) s).getCachedLatestRevision()) &&
                !((ContainerApp) s).getCachedLatestRevision().isActive())
            .withHandler(ContainerApp::activate)
            .register(am);

        new Action<>(DEACTIVATE_LATEST_REVISION)
            .withLabel("Deactivate Latest Revision")
            .withIcon(AzureIcons.Action.STOP.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp &&
                ((ContainerApp) s).getFormalStatus().isConnected() &&
                Objects.nonNull(((ContainerApp) s).getCachedLatestRevision()) &&
                ((ContainerApp) s).getCachedLatestRevision().isActive())
            .withHandler(ContainerApp::deactivate)
            .register(am);

        new Action<>(RESTART_LATEST_REVISION)
            .withLabel("Restart Latest Revision")
            .withIcon(AzureIcons.Action.RESTART.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp &&
                ((ContainerApp) s).getFormalStatus().isConnected() &&
                Objects.nonNull(((ContainerApp) s).getCachedLatestRevision()) &&
                ((ContainerApp) s).getCachedLatestRevision().isActive())
            .withHandler(ContainerApp::restart)
            .register(am);

        new Action<>(UPDATE_IMAGE)
            .withLabel("Update Deployment")
            .withIcon(AzureIcons.Action.DEPLOY.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .register(am);

        new Action<>(START_CONSOLE_LOG_STREAMS)
            .withLabel("Console")
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof ContainerApp)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .register(am);

        new Action<>(START_SYSTEM_LOG_STREAMS)
                .withLabel("System")
                .withIdParam(AbstractAzResource::getName)
                .visibleWhen(s -> s instanceof ContainerApp)
                .enableWhen(s -> s.getFormalStatus().isConnected())
                .register(am);

        new Action<>(STOP_APP_LOG_STREAMS)
                .withLabel("Stop Streaming Logs")
                .withIcon(AzureIcons.Action.LOG.getIconPath())
                .withIdParam(AbstractAzResource::getName)
                .enableWhen(s -> s.getFormalStatus().isConnected())
                .register(am);

        new Action<>(OPEN_LOGS_IN_MONITOR)
                .withLabel("Open Logs with Azure Monitor")
                .withIcon(AzureIcons.Common.AZURE_MONITOR.getIconPath())
                .withIdParam(AzResource::getName)
                .visibleWhen(s -> s instanceof ContainerApp)
                .enableWhen(s -> s.getFormalStatus().isConnected())
                .register(am);

        new Action<>(ACTIVATE)
            .withLabel("Activate")
            .withIcon(AzureIcons.Action.START.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof Revision && ((Revision) s).getFormalStatus().isConnected() && !((Revision) s).isActive())
            .withHandler(Revision::activate)
            .register(am);

        new Action<>(DEACTIVATE)
            .withLabel("Deactivate")
            .withIcon(AzureIcons.Action.STOP.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof Revision && ((Revision) s).getFormalStatus().isConnected() && ((Revision) s).isActive())
            .withHandler(Revision::deactivate)
            .register(am);

        new Action<>(RESTART)
            .withLabel("Restart")
            .withIcon(AzureIcons.Action.RESTART.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof Revision)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .visibleWhen(s -> s instanceof Revision && ((Revision) s).getFormalStatus().isConnected() && ((Revision) s).isActive())
            .withHandler(Revision::restart)
            .register(am);

        new Action<>(OPEN_IN_BROWSER)
            .withLabel("Open In Browser")
            .withIcon(AzureIcons.Action.BROWSER.getIconPath())
            .withIdParam(AbstractAzResource::getName)
            .visibleWhen(s -> s instanceof Revision)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .withHandler((s, e) -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle("https://" + s.getFqdn(), e))
            .register(am);

        new Action<>(GROUP_CREATE_CONTAINER_APP)
            .withLabel("Container App")
            .withIdParam(AzResource::getName)
            .visibleWhen(s -> s instanceof ResourceGroup)
            .enableWhen(s -> s.getFormalStatus().isConnected())
            .withHandler((s, e) -> {
                final IAccount account = Azure.az(IAzureAccount.class).account();
                final String url = String.format("%s/#create/Microsoft.ContainerApp", account.getPortalUrl());
                am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(url, e);
            })
            .register(am);

        new Action<>(GROUP_CREATE_CONTAINER_APPS_ENVIRONMENT)
                .withLabel("Container Apps Environment")
                .withIdParam(AzResource::getName)
                .visibleWhen(s-> s instanceof ResourceGroup)
                .enableWhen(s -> s != null && s.getFormalStatus().isConnected())
                .register(am);
    }