diff --git a/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs b/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs index 71e773f..e76c72c 100644 --- a/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs +++ b/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs @@ -40,17 +40,35 @@ private static Func NamedEndpointSelector(IResourc extension(IResourceBuilder builder) where T : IResourceWithEndpoints { + /// + /// Add commands to enable and disable Shawarma services for the resource. + /// + /// Automatically enable Shawarma services when the resource is ready. + /// The . + public IResourceBuilder WithShawarma(bool autoStart = false) => + builder.WithShawarma(null, autoStart); + + /// + /// Add commands to enable and disable Shawarma services for the resource. + /// + /// Optional configuration for Shawarma. + /// The . + public IResourceBuilder WithShawarma(ShawarmaOptions? options) => + builder.WithShawarma((Func?)null, options); + /// /// Add commands to enable and disable Shawarma services for the resource. /// /// The name of the HTTP endpoint on this resource to send the request to when the command is invoked. /// Automatically enable Shawarma services when the resource is ready. /// The . - public IResourceBuilder WithShawarma([EndpointName] string? endpointName = null, bool autoStart = false) => - builder.WithShawarma(endpointName, new ShawarmaOptions() - { - AutoStart = autoStart - }); + public IResourceBuilder WithShawarma([EndpointName] string? endpointName, bool autoStart = false) => + builder.WithShawarma(endpointName, autoStart + ? new ShawarmaOptions() + { + AutoStart = true + } + : ShawarmaOptions.Default); /// /// Add commands to enable and disable Shawarma services for the resource. @@ -58,7 +76,7 @@ public IResourceBuilder WithShawarma([EndpointName] string? endpointName = nu /// The name of the HTTP endpoint on this resource to send the request to when the command is invoked. /// Optional configuration for Shawarma. /// The . - public IResourceBuilder WithShawarma([EndpointName] string? endpointName = null, ShawarmaOptions? options = null) => + public IResourceBuilder WithShawarma([EndpointName] string? endpointName, ShawarmaOptions? options) => builder.WithShawarma( endpointSelector: endpointName is not null ? NamedEndpointSelector(builder, endpointName)