use of com.microsoft.azure.toolkit.intellij.function.runner.deploy.FunctionDeployConfiguration 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.intellij.function.runner.deploy.FunctionDeployConfiguration in project azure-tools-for-java by Microsoft.
the class FunctionRunConfigurationProducer method setupConfigurationFromContext.
@Override
protected boolean setupConfigurationFromContext(AzureRunConfigurationBase runConfigurationBase, ConfigurationContext context, Ref ref) {
if (!(runConfigurationBase instanceof FunctionRunConfiguration || runConfigurationBase instanceof FunctionDeployConfiguration)) {
return false;
}
final Location contextLocation = context.getLocation();
assert contextLocation != null;
Location<PsiMethod> methodLocation = getAzureFunctionMethods(contextLocation);
if (methodLocation == null) {
return false;
}
AzureRunConfigurationBase configuration = runConfigurationBase;
if (configuration instanceof FunctionDeployConfiguration) {
final RunManagerEx manager = RunManagerEx.getInstanceEx(context.getProject());
// since deploy configuration doesn't support, we need to create a FunctionRunConfiguration
final RunnerAndConfigurationSettings settings = RunConfigurationUtils.getOrCreateRunConfigurationSettings(context.getModule(), manager, getConfigurationFactory());
configuration = (AzureRunConfigurationBase) settings.getConfiguration();
}
FunctionRunConfiguration runConfiguration = (FunctionRunConfiguration) configuration;
final RunnerAndConfigurationSettings template = context.getRunManager().getConfigurationTemplate(getConfigurationFactory());
final Module contextModule = context.getModule();
final Module predefinedModule = ((FunctionRunConfiguration) template.getConfiguration()).getModule();
if (predefinedModule != null) {
runConfiguration.initializeDefaults(predefinedModule);
} else {
final Module module = findModule(runConfiguration, contextModule);
if (module != null) {
runConfiguration.initializeDefaults(module);
} else {
return false;
}
}
if (StringUtils.isBlank(configuration.getName())) {
configuration.setName("Run Functions - " + runConfiguration.getModule().getName());
}
return true;
}
Aggregations