private static DurableFunctionType GetDurableFunctionType(MapField <string, BindingInfo> bindings) { var inputBindings = bindings.Where(binding => binding.Value.Direction == BindingInfo.Types.Direction.In); foreach (var(_, value) in inputBindings) { if (DurableBindings.IsOrchestrationTrigger(value.Type)) { return(DurableFunctionType.OrchestrationFunction); } if (DurableBindings.IsActivityTrigger(value.Type)) { return(DurableFunctionType.ActivityFunction); } } return(DurableFunctionType.None); }
private static void ValidateActivityFunction(string functionName, IEnumerable <AzFunctionInfo> loadedFunctions) { var functionInfo = loadedFunctions.FirstOrDefault(fi => fi.FuncName == functionName); if (functionInfo == null) { var message = string.Format(PowerShellWorkerStrings.FunctionNotFound, functionName); throw new InvalidOperationException(message); } var activityTriggerBinding = functionInfo.InputBindings.FirstOrDefault( entry => DurableBindings.IsActivityTrigger(entry.Value.Type) && entry.Value.Direction == BindingInfo.Types.Direction.In); if (activityTriggerBinding.Key == null) { var message = string.Format(PowerShellWorkerStrings.FunctionDoesNotHaveProperActivityFunctionBinding, functionName); throw new InvalidOperationException(message); } }