From 57b29b5a093927400c5102992cfb9c11410ec3e5 Mon Sep 17 00:00:00 2001 From: Jonathan Richards <91483632+JonathanAtCenterEdge@users.noreply.github.com> Date: Thu, 25 Jun 2026 08:53:15 -0400 Subject: [PATCH 1/2] Expose Shawarma command names through `KnownShawarmaCommands` # Motivations In some scenarios consumers may want to trigger shawarma commands, by providing a static class of consts consumers won't need to make their own for Shawarma commands # Modifications - Expose both private const command names by adding `KnownShawarmaCommands` --- .../KnownShawarmaCommands.cs | 17 +++++++++++++++++ .../ShawarmaResourceBuilderExtensions.cs | 9 +++------ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs diff --git a/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs b/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs new file mode 100644 index 0000000..52cd173 --- /dev/null +++ b/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs @@ -0,0 +1,17 @@ +namespace Shawarma.Aspire.Hosting; + +/// +/// Known Aspire command names for Shawarma Aspire services. +/// +public static class KnownShawarmaCommands +{ + /// + /// The command name for enabling Shawarma services. + /// + public const string EnableShawarma = "enableShawarma"; + + /// + /// The command name for disabling Shawarma services. + /// + public const string DisableShawarma = "disableShawarma"; +} diff --git a/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs b/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs index e76c72c..7d241b9 100644 --- a/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs +++ b/src/Shawarma.Aspire.Hosting/ShawarmaResourceBuilderExtensions.cs @@ -11,9 +11,6 @@ namespace Shawarma.Aspire.Hosting; /// public static class ShawarmaResourceBuilderExtensions { - private const string EnableShawarmaCommandName = "enableShawarma"; - private const string DisableShawarmaCommandName = "disableShawarma"; - private static readonly string[] s_httpSchemes = ["https", "http"]; private static Func NamedEndpointSelector(IResourceBuilder builder, string endpointName) @@ -141,7 +138,7 @@ await notificationService.PublishUpdateAsync(builder.Resource, path: options.ApplicationStatePath, displayName: "Start Shawarma Services", endpointSelector: endpointSelector, - commandName: EnableShawarmaCommandName, + commandName: KnownShawarmaCommands.EnableShawarma, commandOptions: new HttpCommandOptions { Method = HttpMethod.Post, @@ -179,7 +176,7 @@ await notificationService.PublishUpdateAsync(builder.Resource, path: options.ApplicationStatePath, displayName: "Stop Shawarma Services", endpointSelector: endpointSelector, - commandName: DisableShawarmaCommandName, + commandName: KnownShawarmaCommands.DisableShawarma, commandOptions: new HttpCommandOptions { Method = HttpMethod.Post, @@ -224,7 +221,7 @@ await notificationService.PublishUpdateAsync(resource, { var commandService = e.Services.GetRequiredService(); - var result = await commandService.ExecuteCommandAsync(resource, EnableShawarmaCommandName, cancellationToken); + var result = await commandService.ExecuteCommandAsync(resource, KnownShawarmaCommands.EnableShawarma, cancellationToken); if (result is { Success: false, Canceled: false }) { throw new InvalidOperationException($"Failed to enable Shawarma services on startup: {result.ErrorMessage}"); From 4e62cc5a7941d8101f94edca8f9be07b98a49f95 Mon Sep 17 00:00:00 2001 From: Jonathan Richards <91483632+JonathanAtCenterEdge@users.noreply.github.com> Date: Thu, 25 Jun 2026 09:14:06 -0400 Subject: [PATCH 2/2] hyphens --- src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs b/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs index 52cd173..e7797b4 100644 --- a/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs +++ b/src/Shawarma.Aspire.Hosting/KnownShawarmaCommands.cs @@ -8,10 +8,10 @@ public static class KnownShawarmaCommands /// /// The command name for enabling Shawarma services. /// - public const string EnableShawarma = "enableShawarma"; + public const string EnableShawarma = "enable-shawarma"; /// /// The command name for disabling Shawarma services. /// - public const string DisableShawarma = "disableShawarma"; + public const string DisableShawarma = "disable-shawarma"; }