using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Amazon.Lambda.AspNetCoreServer.Internal;
using Microsoft.AspNetCore.Hosting.Server;
namespace Microsoft.AspNetCore.Hosting
{
///
/// This class is a container for extensions methods to the IWebHostBuilder
///
public static class WebHostBuilderExtensions
{
///
/// Extension method for configuring API Gateway as the server for an ASP.NET Core application.
/// This is called instead of UseKestrel. If UseKestrel was called before this it will remove
/// the service description that was added to the IServiceCollection.
///
///
///
[Obsolete("Calls should be replaced with UseLambdaServer")]
public static IWebHostBuilder UseApiGateway(this IWebHostBuilder hostBuilder)
{
return UseLambdaServer(hostBuilder);
}
///
/// Extension method for configuring Lambda as the server for an ASP.NET Core application.
/// This is called instead of UseKestrel. If UseKestrel was called before this it will remove
/// the service description that was added to the IServiceCollection.
///
///
///
public static IWebHostBuilder UseLambdaServer(this IWebHostBuilder hostBuilder)
{
return hostBuilder.ConfigureServices(services =>
{
Utilities.EnsureLambdaServerRegistered(services);
});
}
}
}