use of com.microsoft.azure.toolkit.lib.function.FunctionAppConfig in project azure-tools-for-java by Microsoft.
the class CreateFunctionAppAction method openDialog.
@AzureOperation(name = "function.open_creation_dialog", type = AzureOperation.Type.ACTION)
private void openDialog(final Project project, @Nullable final FunctionAppConfig data) {
final FunctionAppCreationDialog dialog = new FunctionAppCreationDialog(project);
if (Objects.nonNull(data)) {
dialog.setData(data);
}
dialog.setOkActionListener((config) -> {
dialog.close();
this.createFunctionApp(config).subscribe(functionApp -> {
}, (error) -> {
final String title = String.format("Reopen dialog \"%s\"", dialog.getTitle());
final Consumer<Object> act = t -> AzureTaskManager.getInstance().runLater("open dialog", () -> this.openDialog(project, config));
final Action<?> action = new Action<>(act, new ActionView.Builder(title));
AzureMessager.getMessager().error(error, null, action);
});
});
dialog.show();
}
use of com.microsoft.azure.toolkit.lib.function.FunctionAppConfig in project azure-tools-for-java by Microsoft.
the class DeployFunctionAppAction method getRunConfigurationSettings.
private RunnerAndConfigurationSettings getRunConfigurationSettings(RunManagerEx manager) {
final ConfigurationFactory factory = new FunctionDeploymentConfigurationFactory(functionType);
final String runConfigurationName = String.format("%s: %s:%s", factory.getName(), project.getName(), functionNode.getName());
RunnerAndConfigurationSettings settings = manager.findConfigurationByName(runConfigurationName);
if (settings == null) {
settings = manager.createConfiguration(runConfigurationName, factory);
}
final RunConfiguration runConfiguration = settings.getConfiguration();
if (runConfiguration instanceof FunctionDeployConfiguration) {
final IFunctionApp functionApp = Azure.az(AzureAppService.class).functionApp(functionNode.getId());
final FunctionAppConfig config = FunctionAppService.getInstance().getFunctionAppConfigFromExistingFunction(functionApp);
((FunctionDeployConfiguration) runConfiguration).saveConfig(config);
}
return settings;
}
use of com.microsoft.azure.toolkit.lib.function.FunctionAppConfig in project azure-tools-for-java by Microsoft.
the class FunctionDeploymentState method createFunctionApp.
private IFunctionApp createFunctionApp(@NotNull RunProcessHandler processHandler) {
IFunctionApp functionApp = Azure.az(AzureAppService.class).subscription(functionDeployConfiguration.getSubscriptionId()).functionApp(functionDeployConfiguration.getConfig().getResourceGroup().getName(), functionDeployConfiguration.getAppName());
if (functionApp.exists()) {
return functionApp;
}
processHandler.setText(message("function.create.hint.creating", functionDeployConfiguration.getAppName()));
// Load app settings from security storage
final FunctionAppConfig config = deployModel.getFunctionAppConfig();
config.setAppSettings(FunctionUtils.loadAppSettingsFromSecurityStorage(functionDeployConfiguration.getAppSettingsKey()));
// create function app
functionApp = FunctionAppService.getInstance().createFunctionApp(config);
// update run configuration
functionDeployConfiguration.setFunctionId(functionApp.id());
// Notify explorer refresh
AzureUIRefreshCore.execute(new AzureUIRefreshEvent(AzureUIRefreshEvent.EventType.REFRESH, functionApp));
processHandler.setText(message("function.create.hint.created", functionDeployConfiguration.getAppName()));
return functionApp;
}
use of com.microsoft.azure.toolkit.lib.function.FunctionAppConfig in project azure-tools-for-java by Microsoft.
the class FunctionAppConfigFormPanelAdvance method getData.
@Override
public FunctionAppConfig getData() {
final FunctionAppConfig data = appServiceConfigPanelAdvanced.getData();
data.setMonitorConfig(appServiceMonitorPanel.getData());
return data;
}
use of com.microsoft.azure.toolkit.lib.function.FunctionAppConfig in project azure-tools-for-java by Microsoft.
the class FunctionDeployConfiguration method validate.
@Override
public void validate() throws ConfigurationException {
checkAzurePreconditions();
if (this.module == null) {
throw new ConfigurationException(message("function.deploy.validate.noModule"));
}
final FunctionAppConfig functionAppConfig = functionDeployModel.getFunctionAppConfig();
if (StringUtils.isAllEmpty(functionAppConfig.getResourceId(), functionAppConfig.getName())) {
throw new ConfigurationException(message("function.deploy.validate.noTarget"));
}
}
Aggregations