use of com.microsoft.azuretools.telemetry.TelemetryConstants.FUNCTION in project azure-tools-for-java by Microsoft.
the class FunctionNode method trigger.
@AzureOperation(name = "function|trigger.start.detail", params = { "this.functionApp.name()" }, type = AzureOperation.Type.SERVICE)
private void trigger() {
final FunctionEntity.BindingEntity trigger = functionEntity.getTrigger();
final String triggerType = Optional.ofNullable(trigger).map(functionTrigger -> functionTrigger.getProperty("type")).orElse(null);
if (StringUtils.isEmpty(triggerType)) {
final String error = String.format("failed to get trigger type of function[%s].", functionApp.name());
final String action = "confirm trigger type is configured.";
throw new AzureToolkitRuntimeException(error, action);
}
switch(triggerType.toLowerCase()) {
case "httptrigger":
triggerHttpTrigger(trigger);
break;
case "timertrigger":
// no input for timer trigger
functionApp.triggerFunction(this.name, new Object());
break;
default:
final String input = DefaultLoader.getUIHelper().showInputDialog(tree.getParent(), "Please set the input value: ", String.format("Trigger function %s", this.name), null);
functionApp.triggerFunction(this.name, new TriggerRequest(input));
break;
}
}
Aggregations