in Utils/azure-toolkit-ide-libs/azure-toolkit-ide-appservice-lib/src/main/java/com/microsoft/azure/toolkit/ide/appservice/function/FunctionAppActionsContributor.java [145:241]
public void registerActions(AzureActionManager am) {
new Action<>(SWAP_DEPLOYMENT_SLOT)
.visibleWhen(s -> s instanceof FunctionAppDeploymentSlot)
.enableWhen(s -> s.getFormalStatus().isRunning())
.withLabel("Swap with Production")
.withIdParam(AbstractAzResource::getName)
.register(am);
new Action<>(REFRESH_FUNCTIONS)
.withLabel("Refresh")
.withIcon(AzureIcons.Action.REFRESH.getIconPath())
.withIdParam(AbstractAzResource::getName)
.visibleWhen(s -> s instanceof FunctionApp)
.withShortcut(am.getIDEDefaultShortcuts().refresh())
.withHandler(s -> AzureEventBus.emit("appservice|function.functions.refresh", s))
.register(am);
new Action<>(TRIGGER_FUNCTION)
.withLabel("Trigger Function")
.withIdParam(FunctionEntity::getName)
.visibleWhen(s -> s instanceof FunctionEntity && !AzureFunctionsUtils.isHttpTrigger((FunctionEntity) s))
.register(am);
new Action<>(TRIGGER_FUNCTION_IN_BROWSER)
.withLabel("Trigger Function In Browser")
.withIdParam(FunctionEntity::getName)
.visibleWhen(s -> s instanceof FunctionEntity && AzureFunctionsUtils.isHttpTrigger((FunctionEntity) s))
.withHandler(s -> new TriggerFunctionInBrowserAction(s).trigger())
.register(am);
new Action<>(TRIGGER_FUNCTION_WITH_HTTP_CLIENT)
.withLabel("Trigger Function with Http Client")
.withIdParam(FunctionEntity::getName)
.visibleWhen(s -> s instanceof FunctionEntity)
.register(am);
new Action<>(DOWNLOAD_CORE_TOOLS)
.withLabel("Download")
.withAuthRequired(false)
.register(am);
new Action<>(CONFIG_CORE_TOOLS)
.withLabel("Configure")
.withHandler((v, e) -> am.getAction(OPEN_AZURE_SETTINGS).handle(null, e))
.withAuthRequired(false)
.register(am);
new Action<>(FOCUS_CONTAINER_ENVIRONMENT)
.withLabel(s -> "Navigate to Environment")
.withIcon(AzureIcons.ContainerApps.MODULE.getIconPath())
.visibleWhen(s -> s instanceof FunctionApp app && StringUtils.isNotBlank(app.getEnvironmentId()))
.withHandler((r) -> {
final AzResource resource = Azure.az().getById(r.getEnvironmentId());
if (Objects.isNull(resource)) {
final String environment = ResourceId.fromString(r.getEnvironmentId()).name();
AzureMessager.getMessager().info(AzureString.format("Cannot find Azure Container Apps environment (%s).", environment));
return;
}
AzureEventBus.emit("azure.explorer.select_resource", resource);
})
.withAuthRequired(false)
.register(am);
new Action<>(GROUP_CREATE_FUNCTION)
.withLabel("Function App")
.withIdParam(AzResource::getName)
.visibleWhen(s -> s instanceof ResourceGroup)
.enableWhen(s -> s.getFormalStatus().isConnected())
.register(am);
new Action<>(ENVIRONMENT_CREATE_FUNCTION)
.withLabel("Function App")
.withIdParam(AzResource::getName)
.visibleWhen(resource -> resource instanceof ContainerAppsEnvironment)
.enableWhen(resource -> resource.getFormalStatus().isConnected())
.register(am);
new Action<>(ENABLE_REMOTE_DEBUGGING)
.withLabel("Enable Remote Debugging")
.withIdParam(AzResource::getName)
.visibleWhen(s -> false)
.register(am);
new Action<>(DISABLE_REMOTE_DEBUGGING)
.withLabel("Disable Remote Debugging")
.withIdParam(AzResource::getName)
.visibleWhen(s -> false)
.register(am);
new Action<>(REMOTE_DEBUGGING)
.withLabel("Attach Debugger")
.withIcon(AzureIcons.Action.ATTACH_DEBUGGER.getIconPath())
.withIdParam(AzResource::getName)
.visibleWhen(s -> false)
.enableWhen(s -> s.getFormalStatus().isRunning())
.register(am);
}