public static IResourceBuilder WithSQSEventSource()

in src/Aspire.Hosting.AWS/Lambda/SQSEventSourceExtensions.cs [63:82]


    public static IResourceBuilder<LambdaProjectResource> WithSQSEventSource(this IResourceBuilder<LambdaProjectResource> lambdaFunction, StackOutputReference queueCfnOutputReference, SQSEventSourceOptions? options = null)
    {
        Func<ValueTask<string>> resolver = async () =>
        {
            var queueUrl = await queueCfnOutputReference.GetValueAsync();
            if (string.IsNullOrEmpty(queueUrl))
            {
                throw new InvalidOperationException("Output parameter for queue url failed to resolve");
            }

            if (!Uri.TryCreate(queueUrl, UriKind.Absolute, out _))
            {
                throw new InvalidOperationException($"Output parameter value {queueUrl} is not a SQS queue url.");
            }

            return queueUrl;
        };

        return WithSQSEventSource(lambdaFunction, resolver, options);
    }