generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
feature-requestA feature should be added or improved.A feature should be added or improved.p2This is a standard priority issueThis is a standard priority issue
Description
When Lambda functions are running, they are children of the LambdaServiceEmulator inside Aspire. However, the LambdaProjectResource itself doesn't have the parent relationship.
The use case here is to get the Lambda Test Tool Endpoint as part of running Aspire tests.
Currently, to do this you need to:
var lambdaServiceEmulatorResource = builder.Resources.FirstOrDefault(resource => resource.Name == "LambdaServiceEmulator")!;
var endpoints = lambdaServiceEmulatorResource.TryGetEndpoints(out var endpointsList)
? endpointsList
: throw new InvalidOperationException("Lambda service emulator does not have an HTTP endpoint configured.");
var connectionString = endpoints.FirstOrDefault()!.AllocatedEndpoint!.UriString;
return new AmazonLambdaClient(new BasicAWSCredentials("dummykey", "dummysecret"), new AmazonLambdaConfig()
{
ServiceURL = connectionString
});But it would be great to be able to call lambdaResource.Parent.GetEndpoint().
Example Implementations
The Azure Service Bus resources do support this
public class AzureServiceBusQueueResource(string name, string queueName, AzureServiceBusResource parent)
: Resource(name), IResourceWithParent<AzureServiceBusResource>, IResourceWithConnectionString, IResourceWithAzureFunctionsConfig
{
}which then allows you to write code like this to get the connection string for service bus:
var connectionString = await builder.Resource.Parent.ConnectionStringExpression
.GetValueAsync(CancellationToken.None)baynezy
Metadata
Metadata
Assignees
Labels
feature-requestA feature should be added or improved.A feature should be added or improved.p2This is a standard priority issueThis is a standard priority issue