From 2a59f356d4f6e8a349a0192b04700b925b408f9b Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Fri, 4 Oct 2024 14:12:56 +1000 Subject: [PATCH] Docs to cover 6006. --- .../ResourceBuilderExtensions.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Aspire.Hosting/ResourceBuilderExtensions.cs b/src/Aspire.Hosting/ResourceBuilderExtensions.cs index 3d4db84b349..5e7f2e2ac76 100644 --- a/src/Aspire.Hosting/ResourceBuilderExtensions.cs +++ b/src/Aspire.Hosting/ResourceBuilderExtensions.cs @@ -398,7 +398,29 @@ private static void ApplyEndpoints(this IResourceBuilder builder, IResourc /// Name of endpoint to change. /// Callback that modifies the endpoint. /// Create endpoint if it does not exist. - /// + /// The resource builder + /// + /// + /// The method allows + /// developers to mutate any aspect of an endpoint annotation. Note that changing one value does not automatically change + /// other values to compatable/consistent values. For example setting the property + /// of the endpoint annotation in the callback will not automatically change the . + /// All values should be set in the callback if the defaults are not acceptable. + /// + /// + /// + /// Configure an endpoint to use UDP. + /// + /// var builder = DistributedApplication.Create(args); + /// var container = builder.AddContainer("mycontainer", "myimage") + /// .WithEndpoint("myendpoint", e => { + /// e.Port = 9998; + /// e.TargetPort = 9999; + /// e.Protocol = ProtocolType.Udp; + /// e.UriScheme = "udp"; + /// }); + /// + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "")] public static IResourceBuilder WithEndpoint(this IResourceBuilder builder, [EndpointName] string endpointName, Action callback, bool createIfNotExists = true) where T : IResourceWithEndpoints {