in src/DotNetWorker.Grpc/GrpcWorker.cs [145:202]
private async Task<FunctionMetadataResponse> GetFunctionMetadataAsync(string functionAppDirectory)
{
var response = new FunctionMetadataResponse
{
Result = StatusResult.Success,
UseDefaultMetadataIndexing = false
};
try
{
var functionMetadataList = await _functionMetadataProvider.GetFunctionMetadataAsync(functionAppDirectory);
foreach (var func in functionMetadataList)
{
if (func is null)
{
continue;
}
if (func.RawBindings?.Any() != true)
{
throw new InvalidOperationException($"Functions must declare at least one binding. No bindings were found in the function ${nameof(func)}.");
}
var rpcFuncMetadata = func switch
{
RpcFunctionMetadata rpc => rpc,
_ => BuildRpc(func),
};
if (func.Retry != null)
{
rpcFuncMetadata.RetryOptions = func.Retry switch
{
RpcRetryOptions retry => retry,
_ => BuildRpcRetry(func.Retry)
};
}
// add BindingInfo here instead of in the providers
// because we need access to gRPC types in proto-file and source-gen won't have access
rpcFuncMetadata.Bindings.Add(func.GetBindingInfoList());
response.FunctionMetadataResults.Add(rpcFuncMetadata);
}
}
catch (Exception ex)
{
response.Result = new StatusResult
{
Status = StatusResult.Types.Status.Failure,
Exception = ex.ToRpcException()
};
}
return response;
}