diff --git a/src/Aspire.Hosting/ApplicationModel/EndpointUpdateContext.cs b/src/Aspire.Hosting/ApplicationModel/EndpointUpdateContext.cs
new file mode 100644
index 00000000000..a5c28ee495e
--- /dev/null
+++ b/src/Aspire.Hosting/ApplicationModel/EndpointUpdateContext.cs
@@ -0,0 +1,110 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Net.Sockets;
+
+namespace Aspire.Hosting.ApplicationModel;
+
+///
+/// Provides a mutable callback context for updating an endpoint in polyglot app hosts.
+///
+[AspireExport(ExposeProperties = true)]
+internal sealed class EndpointUpdateContext(EndpointAnnotation endpointAnnotation)
+{
+ private readonly EndpointAnnotation _endpointAnnotation = endpointAnnotation ?? throw new ArgumentNullException(nameof(endpointAnnotation));
+
+ ///
+ /// Gets the endpoint name.
+ ///
+ public string Name => _endpointAnnotation.Name;
+
+ ///
+ /// Gets or sets the network protocol.
+ ///
+ public ProtocolType Protocol
+ {
+ get => _endpointAnnotation.Protocol;
+ set => _endpointAnnotation.Protocol = value;
+ }
+
+ ///
+ /// Gets or sets the desired host port.
+ ///
+ public int? Port
+ {
+ get => _endpointAnnotation.Port;
+ set => _endpointAnnotation.Port = value;
+ }
+
+ ///
+ /// Gets or sets the target port.
+ ///
+ public int? TargetPort
+ {
+ get => _endpointAnnotation.TargetPort;
+ set => _endpointAnnotation.TargetPort = value;
+ }
+
+ ///
+ /// Gets or sets the URI scheme.
+ ///
+ public string UriScheme
+ {
+ get => _endpointAnnotation.UriScheme;
+ set => _endpointAnnotation.UriScheme = value;
+ }
+
+ ///
+ /// Gets or sets the target host.
+ ///
+ public string TargetHost
+ {
+ get => _endpointAnnotation.TargetHost;
+ set => _endpointAnnotation.TargetHost = value;
+ }
+
+ ///
+ /// Gets or sets the transport.
+ ///
+ public string Transport
+ {
+ get => _endpointAnnotation.Transport;
+ set => _endpointAnnotation.Transport = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the endpoint is external.
+ ///
+ public bool IsExternal
+ {
+ get => _endpointAnnotation.IsExternal;
+ set => _endpointAnnotation.IsExternal = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the endpoint is proxied.
+ ///
+ public bool IsProxied
+ {
+ get => _endpointAnnotation.IsProxied;
+ set => _endpointAnnotation.IsProxied = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether the endpoint is excluded from the default reference set.
+ ///
+ public bool ExcludeReferenceEndpoint
+ {
+ get => _endpointAnnotation.ExcludeReferenceEndpoint;
+ set => _endpointAnnotation.ExcludeReferenceEndpoint = value;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether TLS is enabled.
+ ///
+ public bool TlsEnabled
+ {
+ get => _endpointAnnotation.TlsEnabled;
+ set => _endpointAnnotation.TlsEnabled = value;
+ }
+}
diff --git a/src/Aspire.Hosting/ResourceBuilderExtensions.cs b/src/Aspire.Hosting/ResourceBuilderExtensions.cs
index d6d836910e2..e30ae41f0e6 100644
--- a/src/Aspire.Hosting/ResourceBuilderExtensions.cs
+++ b/src/Aspire.Hosting/ResourceBuilderExtensions.cs
@@ -1210,9 +1210,9 @@ private static void ApplyEndpoints(this IResourceBuilder builder, IResourc
/// });
///
///
- /// This method is not available in polyglot app hosts. Use the parameter-based overload instead.
+ /// This method is not available in polyglot app hosts. Use the callback-based endpoint mutation export instead.
///
- [AspireExportIgnore(Reason = "EndpointAnnotation has read-only properties AllocatedEndpointSnapshot and AllAllocatedEndpoints that are not ATS-compatible. Callback-free variant is exported.")]
+ [AspireExportIgnore(Reason = "Polyglot app hosts use the internal withEndpointCallback export, which exposes EndpointUpdateContext instead of EndpointAnnotation.")]
[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
{
@@ -1247,6 +1247,33 @@ public static IResourceBuilder WithEndpoint(this IResourceBuilder build
return builder;
}
+ [AspireExport(Description = "Updates a named endpoint via callback")]
+ internal static IResourceBuilder WithEndpointCallback(this IResourceBuilder builder, [EndpointName] string endpointName, Action callback, bool createIfNotExists = true) where T : IResourceWithEndpoints
+ {
+ ArgumentNullException.ThrowIfNull(builder);
+ ArgumentNullException.ThrowIfNull(endpointName);
+ ArgumentNullException.ThrowIfNull(callback);
+
+ return builder.WithEndpoint(endpointName, endpoint => callback(new EndpointUpdateContext(endpoint)), createIfNotExists);
+ }
+
+ [AspireExport(Description = "Updates an HTTP endpoint via callback")]
+ internal static IResourceBuilder WithHttpEndpointCallback(this IResourceBuilder builder, Action callback, [EndpointName] string? name = null, bool createIfNotExists = true) where T : IResourceWithEndpoints
+ {
+ ArgumentNullException.ThrowIfNull(builder);
+ ArgumentNullException.ThrowIfNull(callback);
+
+ var endpointName = name ?? "http";
+
+ if (createIfNotExists &&
+ !builder.Resource.Annotations.OfType().Any(endpoint => string.Equals(endpoint.Name, endpointName, StringComparisons.EndpointAnnotationName)))
+ {
+ builder.WithHttpEndpoint(name: endpointName);
+ }
+
+ return builder.WithEndpoint(endpointName, endpoint => callback(new EndpointUpdateContext(endpoint)), createIfNotExists: false);
+ }
+
///
/// Exposes an endpoint on a resource. A reference to this endpoint can be retrieved using .
/// The endpoint name will be the scheme name if not specified.
@@ -1394,7 +1421,6 @@ public static IResourceBuilder WithExternalHttpEndpoints(this IResourceBui
return builder;
}
-
///
/// Gets an by name from the resource. These endpoints are declared either using or by launch settings (for project resources).
/// The can be used to resolve the address of the endpoint in .
diff --git a/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go b/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go
index 7890993632f..e82e2d5c27b 100644
--- a/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go
+++ b/tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go
@@ -755,6 +755,46 @@ func (s *CSharpAppResource) WithReferenceEndpoint(endpointReference *EndpointRef
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *CSharpAppResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *CSharpAppResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *CSharpAppResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -3901,6 +3941,46 @@ func (s *ContainerResource) WithReferenceEndpoint(endpointReference *EndpointRef
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *ContainerResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *ContainerResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *ContainerResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -5507,6 +5587,46 @@ func (s *DotnetToolResource) WithReferenceEndpoint(endpointReference *EndpointRe
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *DotnetToolResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *DotnetToolResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *DotnetToolResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -6777,6 +6897,280 @@ func (s *EndpointReferenceExpression) ValueExpression() (*string, error) {
return result.(*string), nil
}
+// EndpointUpdateContext wraps a handle for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext.
+type EndpointUpdateContext struct {
+ HandleWrapperBase
+}
+
+// NewEndpointUpdateContext creates a new EndpointUpdateContext.
+func NewEndpointUpdateContext(handle *Handle, client *AspireClient) *EndpointUpdateContext {
+ return &EndpointUpdateContext{
+ HandleWrapperBase: NewHandleWrapperBase(handle, client),
+ }
+}
+
+// Name gets the Name property
+func (s *EndpointUpdateContext) Name() (*string, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.name", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*string), nil
+}
+
+// Protocol gets the Protocol property
+func (s *EndpointUpdateContext) Protocol() (*ProtocolType, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.protocol", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*ProtocolType), nil
+}
+
+// SetProtocol sets the Protocol property
+func (s *EndpointUpdateContext) SetProtocol(value ProtocolType) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setProtocol", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// Port gets the Port property
+func (s *EndpointUpdateContext) Port() (*float64, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.port", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*float64), nil
+}
+
+// SetPort sets the Port property
+func (s *EndpointUpdateContext) SetPort(value float64) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setPort", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// TargetPort gets the TargetPort property
+func (s *EndpointUpdateContext) TargetPort() (*float64, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetPort", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*float64), nil
+}
+
+// SetTargetPort sets the TargetPort property
+func (s *EndpointUpdateContext) SetTargetPort(value float64) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetPort", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// UriScheme gets the UriScheme property
+func (s *EndpointUpdateContext) UriScheme() (*string, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.uriScheme", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*string), nil
+}
+
+// SetUriScheme sets the UriScheme property
+func (s *EndpointUpdateContext) SetUriScheme(value string) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setUriScheme", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// TargetHost gets the TargetHost property
+func (s *EndpointUpdateContext) TargetHost() (*string, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetHost", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*string), nil
+}
+
+// SetTargetHost sets the TargetHost property
+func (s *EndpointUpdateContext) SetTargetHost(value string) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetHost", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// Transport gets the Transport property
+func (s *EndpointUpdateContext) Transport() (*string, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.transport", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*string), nil
+}
+
+// SetTransport sets the Transport property
+func (s *EndpointUpdateContext) SetTransport(value string) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTransport", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// IsExternal gets the IsExternal property
+func (s *EndpointUpdateContext) IsExternal() (*bool, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isExternal", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*bool), nil
+}
+
+// SetIsExternal sets the IsExternal property
+func (s *EndpointUpdateContext) SetIsExternal(value bool) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsExternal", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// IsProxied gets the IsProxied property
+func (s *EndpointUpdateContext) IsProxied() (*bool, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isProxied", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*bool), nil
+}
+
+// SetIsProxied sets the IsProxied property
+func (s *EndpointUpdateContext) SetIsProxied(value bool) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsProxied", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// ExcludeReferenceEndpoint gets the ExcludeReferenceEndpoint property
+func (s *EndpointUpdateContext) ExcludeReferenceEndpoint() (*bool, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.excludeReferenceEndpoint", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*bool), nil
+}
+
+// SetExcludeReferenceEndpoint sets the ExcludeReferenceEndpoint property
+func (s *EndpointUpdateContext) SetExcludeReferenceEndpoint(value bool) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setExcludeReferenceEndpoint", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
+// TlsEnabled gets the TlsEnabled property
+func (s *EndpointUpdateContext) TlsEnabled() (*bool, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.tlsEnabled", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*bool), nil
+}
+
+// SetTlsEnabled sets the TlsEnabled property
+func (s *EndpointUpdateContext) SetTlsEnabled(value bool) (*EndpointUpdateContext, error) {
+ reqArgs := map[string]any{
+ "context": SerializeValue(s.Handle()),
+ }
+ reqArgs["value"] = SerializeValue(value)
+ result, err := s.Client().InvokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTlsEnabled", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*EndpointUpdateContext), nil
+}
+
// EnvironmentCallbackContext wraps a handle for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext.
type EnvironmentCallbackContext struct {
HandleWrapperBase
@@ -7189,6 +7583,46 @@ func (s *ExecutableResource) WithReferenceEndpoint(endpointReference *EndpointRe
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *ExecutableResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *ExecutableResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *ExecutableResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -11904,6 +12338,46 @@ func (s *ProjectResource) WithReferenceEndpoint(endpointReference *EndpointRefer
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *ProjectResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *ProjectResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *ProjectResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -14020,6 +14494,46 @@ func (s *TestDatabaseResource) WithReferenceEndpoint(endpointReference *Endpoint
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *TestDatabaseResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *TestDatabaseResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *TestDatabaseResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -15680,6 +16194,46 @@ func (s *TestRedisResource) WithReferenceEndpoint(endpointReference *EndpointRef
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *TestRedisResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *TestRedisResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *TestRedisResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -17483,6 +18037,46 @@ func (s *TestVaultResource) WithReferenceEndpoint(endpointReference *EndpointRef
return result.(*IResourceWithEnvironment), nil
}
+// WithEndpointCallback updates a named endpoint via callback
+func (s *TestVaultResource) WithEndpointCallback(endpointName string, callback func(...any) any, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ reqArgs["endpointName"] = SerializeValue(endpointName)
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
+// WithHttpEndpointCallback updates an HTTP endpoint via callback
+func (s *TestVaultResource) WithHttpEndpointCallback(callback func(...any) any, name *string, createIfNotExists *bool) (*IResourceWithEndpoints, error) {
+ reqArgs := map[string]any{
+ "builder": SerializeValue(s.Handle()),
+ }
+ if callback != nil {
+ reqArgs["callback"] = RegisterCallback(callback)
+ }
+ if name != nil {
+ reqArgs["name"] = SerializeValue(name)
+ }
+ if createIfNotExists != nil {
+ reqArgs["createIfNotExists"] = SerializeValue(createIfNotExists)
+ }
+ result, err := s.Client().InvokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs)
+ if err != nil {
+ return nil, err
+ }
+ return result.(*IResourceWithEndpoints), nil
+}
+
// WithEndpoint adds a network endpoint
func (s *TestVaultResource) WithEndpoint(port *float64, targetPort *float64, scheme *string, name *string, env *string, isProxied *bool, isExternal *bool, protocol *ProtocolType) (*IResourceWithEndpoints, error) {
reqArgs := map[string]any{
@@ -18695,6 +19289,9 @@ func init() {
RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression", func(h *Handle, c *AspireClient) any {
return NewEndpointReferenceExpression(h, c)
})
+ RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext", func(h *Handle, c *AspireClient) any {
+ return NewEndpointUpdateContext(h, c)
+ })
RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext", func(h *Handle, c *AspireClient) any {
return NewEnvironmentCallbackContext(h, c)
})
diff --git a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java
index 9c19bdd9406..c549f42c8cf 100644
--- a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java
+++ b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java
@@ -1078,6 +1078,7 @@ public class AspireRegistrations {
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent", (h, c) -> new ConnectionStringAvailableEvent(h, c));
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel", (h, c) -> new DistributedApplicationModel(h, c));
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression", (h, c) -> new EndpointReferenceExpression(h, c));
+ AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext", (h, c) -> new EndpointUpdateContext(h, c));
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext", (h, c) -> new EnvironmentCallbackContext(h, c));
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IExpressionValue", (h, c) -> new IExpressionValue(h, c));
AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent", (h, c) -> new InitializeResourceEvent(h, c));
@@ -1588,6 +1589,63 @@ public CSharpAppResource withReferenceEndpoint(EndpointReference endpointReferen
return this;
}
+ public CSharpAppResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public CSharpAppResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public CSharpAppResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public CSharpAppResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private CSharpAppResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public CSharpAppResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -4999,6 +5057,63 @@ public ContainerResource withReferenceEndpoint(EndpointReference endpointReferen
return this;
}
+ public ContainerResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public ContainerResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public ContainerResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public ContainerResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private ContainerResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public ContainerResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -6702,6 +6817,63 @@ public DotnetToolResource withReferenceEndpoint(EndpointReference endpointRefere
return this;
}
+ public DotnetToolResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public DotnetToolResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public DotnetToolResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public DotnetToolResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private DotnetToolResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public DotnetToolResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -7934,6 +8106,179 @@ public String valueExpression() {
}
+// ===== EndpointUpdateContext.java =====
+// EndpointUpdateContext.java - GENERATED CODE - DO NOT EDIT
+
+package aspire;
+
+import java.util.*;
+import java.util.function.*;
+
+/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext. */
+public class EndpointUpdateContext extends HandleWrapperBase {
+ EndpointUpdateContext(Handle handle, AspireClient client) {
+ super(handle, client);
+ }
+
+ /** Gets the Name property */
+ public String name() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.name", reqArgs);
+ }
+
+ /** Gets the Protocol property */
+ public ProtocolType protocol() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (ProtocolType) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.protocol", reqArgs);
+ }
+
+ /** Sets the Protocol property */
+ public EndpointUpdateContext setProtocol(ProtocolType value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setProtocol", reqArgs);
+ }
+
+ /** Gets the Port property */
+ public double port() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.port", reqArgs);
+ }
+
+ /** Sets the Port property */
+ public EndpointUpdateContext setPort(double value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setPort", reqArgs);
+ }
+
+ /** Gets the TargetPort property */
+ public double targetPort() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetPort", reqArgs);
+ }
+
+ /** Sets the TargetPort property */
+ public EndpointUpdateContext setTargetPort(double value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetPort", reqArgs);
+ }
+
+ /** Gets the UriScheme property */
+ public String uriScheme() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.uriScheme", reqArgs);
+ }
+
+ /** Sets the UriScheme property */
+ public EndpointUpdateContext setUriScheme(String value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setUriScheme", reqArgs);
+ }
+
+ /** Gets the TargetHost property */
+ public String targetHost() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetHost", reqArgs);
+ }
+
+ /** Sets the TargetHost property */
+ public EndpointUpdateContext setTargetHost(String value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetHost", reqArgs);
+ }
+
+ /** Gets the Transport property */
+ public String transport() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.transport", reqArgs);
+ }
+
+ /** Sets the Transport property */
+ public EndpointUpdateContext setTransport(String value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTransport", reqArgs);
+ }
+
+ /** Gets the IsExternal property */
+ public boolean isExternal() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isExternal", reqArgs);
+ }
+
+ /** Sets the IsExternal property */
+ public EndpointUpdateContext setIsExternal(boolean value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsExternal", reqArgs);
+ }
+
+ /** Gets the IsProxied property */
+ public boolean isProxied() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isProxied", reqArgs);
+ }
+
+ /** Sets the IsProxied property */
+ public EndpointUpdateContext setIsProxied(boolean value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsProxied", reqArgs);
+ }
+
+ /** Gets the ExcludeReferenceEndpoint property */
+ public boolean excludeReferenceEndpoint() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.excludeReferenceEndpoint", reqArgs);
+ }
+
+ /** Sets the ExcludeReferenceEndpoint property */
+ public EndpointUpdateContext setExcludeReferenceEndpoint(boolean value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setExcludeReferenceEndpoint", reqArgs);
+ }
+
+ /** Gets the TlsEnabled property */
+ public boolean tlsEnabled() {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.tlsEnabled", reqArgs);
+ }
+
+ /** Sets the TlsEnabled property */
+ public EndpointUpdateContext setTlsEnabled(boolean value) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("context", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("value", AspireClient.serializeValue(value));
+ return (EndpointUpdateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTlsEnabled", reqArgs);
+ }
+
+}
+
// ===== EnvironmentCallbackContext.java =====
// EnvironmentCallbackContext.java - GENERATED CODE - DO NOT EDIT
@@ -8344,6 +8689,63 @@ public ExecutableResource withReferenceEndpoint(EndpointReference endpointRefere
return this;
}
+ public ExecutableResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public ExecutableResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public ExecutableResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public ExecutableResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private ExecutableResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public ExecutableResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -13070,6 +13472,63 @@ public ProjectResource withReferenceEndpoint(EndpointReference endpointReference
return this;
}
+ public ProjectResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public ProjectResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public ProjectResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public ProjectResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private ProjectResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public ProjectResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -15438,6 +15897,63 @@ public TestDatabaseResource withReferenceEndpoint(EndpointReference endpointRefe
return this;
}
+ public TestDatabaseResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public TestDatabaseResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public TestDatabaseResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public TestDatabaseResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private TestDatabaseResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public TestDatabaseResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -17146,6 +17662,63 @@ public TestRedisResource withReferenceEndpoint(EndpointReference endpointReferen
return this;
}
+ public TestRedisResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public TestRedisResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public TestRedisResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public TestRedisResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private TestRedisResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public TestRedisResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -18943,6 +19516,63 @@ public TestVaultResource withReferenceEndpoint(EndpointReference endpointReferen
return this;
}
+ public TestVaultResource withEndpointCallback(String endpointName, AspireAction1 callback) {
+ return withEndpointCallback(endpointName, callback, null);
+ }
+
+ /** Updates a named endpoint via callback */
+ public TestVaultResource withEndpointCallback(String endpointName, AspireAction1 callback, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ reqArgs.put("endpointName", AspireClient.serializeValue(endpointName));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withEndpointCallback", reqArgs);
+ return this;
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ public TestVaultResource withHttpEndpointCallback(AspireAction1 callback, WithHttpEndpointCallbackOptions options) {
+ var name = options == null ? null : options.getName();
+ var createIfNotExists = options == null ? null : options.getCreateIfNotExists();
+ return withHttpEndpointCallbackImpl(callback, name, createIfNotExists);
+ }
+
+ public TestVaultResource withHttpEndpointCallback(AspireAction1 callback) {
+ return withHttpEndpointCallback(callback, null);
+ }
+
+ /** Updates an HTTP endpoint via callback */
+ private TestVaultResource withHttpEndpointCallbackImpl(AspireAction1 callback, String name, Boolean createIfNotExists) {
+ Map reqArgs = new HashMap<>();
+ reqArgs.put("builder", AspireClient.serializeValue(getHandle()));
+ var callbackId = getClient().registerCallback(args -> {
+ var obj = (EndpointUpdateContext) args[0];
+ callback.invoke(obj);
+ return null;
+ });
+ if (callbackId != null) {
+ reqArgs.put("callback", callbackId);
+ }
+ if (name != null) {
+ reqArgs.put("name", AspireClient.serializeValue(name));
+ }
+ if (createIfNotExists != null) {
+ reqArgs.put("createIfNotExists", AspireClient.serializeValue(createIfNotExists));
+ }
+ getClient().invokeCapability("Aspire.Hosting/withHttpEndpointCallback", reqArgs);
+ return this;
+ }
+
/** Adds a network endpoint */
public TestVaultResource withEndpoint(WithEndpointOptions options) {
var port = options == null ? null : options.getPort();
@@ -20277,6 +20907,33 @@ public WithExternalServiceHttpHealthCheckOptions statusCode(Double value) {
}
+// ===== WithHttpEndpointCallbackOptions.java =====
+// WithHttpEndpointCallbackOptions.java - GENERATED CODE - DO NOT EDIT
+
+package aspire;
+
+import java.util.*;
+import java.util.function.*;
+
+/** Options for WithHttpEndpointCallback. */
+public final class WithHttpEndpointCallbackOptions {
+ private String name;
+ private Boolean createIfNotExists;
+
+ public String getName() { return name; }
+ public WithHttpEndpointCallbackOptions name(String value) {
+ this.name = value;
+ return this;
+ }
+
+ public Boolean getCreateIfNotExists() { return createIfNotExists; }
+ public WithHttpEndpointCallbackOptions createIfNotExists(Boolean value) {
+ this.createIfNotExists = value;
+ return this;
+ }
+
+}
+
// ===== WithHttpEndpointOptions.java =====
// WithHttpEndpointOptions.java - GENERATED CODE - DO NOT EDIT
@@ -20730,6 +21387,7 @@ public WithVolumeOptions isReadOnly(Boolean value) {
.modules/EndpointProperty.java
.modules/EndpointReference.java
.modules/EndpointReferenceExpression.java
+.modules/EndpointUpdateContext.java
.modules/EnvironmentCallbackContext.java
.modules/ExecutableResource.java
.modules/ExecuteCommandContext.java
@@ -20810,6 +21468,7 @@ public WithVolumeOptions isReadOnly(Boolean value) {
.modules/WithDockerfileOptions.java
.modules/WithEndpointOptions.java
.modules/WithExternalServiceHttpHealthCheckOptions.java
+.modules/WithHttpEndpointCallbackOptions.java
.modules/WithHttpEndpointOptions.java
.modules/WithHttpHealthCheckOptions.java
.modules/WithHttpProbeOptions.java
diff --git a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py
index fcc8f4e2a7a..9e3f4882c4b 100644
--- a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py
+++ b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py
@@ -1599,6 +1599,18 @@ class ReferenceParameters(typing.TypedDict, total=False):
name: str
+class EndpointCallbackParameters(typing.TypedDict, total=False):
+ endpoint_name: typing.Required[str]
+ callback: typing.Required[typing.Callable[[EndpointUpdateContext], None]]
+ create_if_not_exists: bool
+
+
+class HttpEndpointCallbackParameters(typing.TypedDict, total=False):
+ callback: typing.Required[typing.Callable[[EndpointUpdateContext], None]]
+ name: str
+ create_if_not_exists: bool
+
+
class EndpointParameters(typing.TypedDict, total=False):
port: int
target_port: int
@@ -3225,6 +3237,201 @@ def value_expression(self) -> str:
return typing.cast(str, result)
+class EndpointUpdateContext:
+ """Type class for EndpointUpdateContext."""
+
+ def __init__(self, handle: Handle, client: AspireClient) -> None:
+ self._handle = handle
+ self._client = client
+
+ def __repr__(self) -> str:
+ return f"EndpointUpdateContext(handle={self._handle.handle_id})"
+
+ @_uncached_property
+ def handle(self) -> Handle:
+ """The underlying object reference handle."""
+ return self._handle
+
+ @_cached_property
+ def name(self) -> str:
+ """Gets the Name property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.name',
+ {'context': self._handle}
+ )
+ return typing.cast(str, result)
+
+ @_uncached_property
+ def protocol(self) -> ProtocolType:
+ """Gets the Protocol property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.protocol',
+ {'context': self._handle}
+ )
+ return typing.cast(ProtocolType, result)
+
+ @protocol.setter
+ def protocol(self, value: ProtocolType) -> None:
+ """Sets the Protocol property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setProtocol',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def port(self) -> int:
+ """Gets the Port property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.port',
+ {'context': self._handle}
+ )
+ return typing.cast(int, result)
+
+ @port.setter
+ def port(self, value: int) -> None:
+ """Sets the Port property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setPort',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def target_port(self) -> int:
+ """Gets the TargetPort property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetPort',
+ {'context': self._handle}
+ )
+ return typing.cast(int, result)
+
+ @target_port.setter
+ def target_port(self, value: int) -> None:
+ """Sets the TargetPort property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetPort',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def uri_scheme(self) -> str:
+ """Gets the UriScheme property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.uriScheme',
+ {'context': self._handle}
+ )
+ return typing.cast(str, result)
+
+ @uri_scheme.setter
+ def uri_scheme(self, value: str) -> None:
+ """Sets the UriScheme property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setUriScheme',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def target_host(self) -> str:
+ """Gets the TargetHost property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetHost',
+ {'context': self._handle}
+ )
+ return typing.cast(str, result)
+
+ @target_host.setter
+ def target_host(self, value: str) -> None:
+ """Sets the TargetHost property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetHost',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def transport(self) -> str:
+ """Gets the Transport property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.transport',
+ {'context': self._handle}
+ )
+ return typing.cast(str, result)
+
+ @transport.setter
+ def transport(self, value: str) -> None:
+ """Sets the Transport property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTransport',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def is_external(self) -> bool:
+ """Gets the IsExternal property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isExternal',
+ {'context': self._handle}
+ )
+ return typing.cast(bool, result)
+
+ @is_external.setter
+ def is_external(self, value: bool) -> None:
+ """Sets the IsExternal property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsExternal',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def is_proxied(self) -> bool:
+ """Gets the IsProxied property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isProxied',
+ {'context': self._handle}
+ )
+ return typing.cast(bool, result)
+
+ @is_proxied.setter
+ def is_proxied(self, value: bool) -> None:
+ """Sets the IsProxied property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsProxied',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def exclude_reference_endpoint(self) -> bool:
+ """Gets the ExcludeReferenceEndpoint property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.excludeReferenceEndpoint',
+ {'context': self._handle}
+ )
+ return typing.cast(bool, result)
+
+ @exclude_reference_endpoint.setter
+ def exclude_reference_endpoint(self, value: bool) -> None:
+ """Sets the ExcludeReferenceEndpoint property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setExcludeReferenceEndpoint',
+ {'context': self._handle, 'value': value}
+ )
+
+ @_uncached_property
+ def tls_enabled(self) -> bool:
+ """Gets the TlsEnabled property"""
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.tlsEnabled',
+ {'context': self._handle}
+ )
+ return typing.cast(bool, result)
+
+ @tls_enabled.setter
+ def tls_enabled(self, value: bool) -> None:
+ """Sets the TlsEnabled property"""
+ self._client.invoke_capability(
+ 'Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTlsEnabled',
+ {'context': self._handle, 'value': value}
+ )
+
+
class EnvironmentCallbackContext:
"""Type class for EnvironmentCallbackContext."""
@@ -4832,6 +5039,14 @@ class AbstractResourceWithEndpoints(AbstractResource):
def with_mcp_server(self, *, path: str = "/mcp", endpoint_name: str | None = None) -> typing.Self:
"""Configures an MCP server endpoint on the resource"""
+ @abc.abstractmethod
+ def with_endpoint_callback(self, endpoint_name: str, callback: typing.Callable[[EndpointUpdateContext], None], *, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates a named endpoint via callback"""
+
+ @abc.abstractmethod
+ def with_http_endpoint_callback(self, callback: typing.Callable[[EndpointUpdateContext], None], *, name: str | None = None, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates an HTTP endpoint via callback"""
+
@abc.abstractmethod
def with_endpoint(self, *, port: int | None = None, target_port: int | None = None, scheme: str | None = None, name: str | None = None, env: str | None = None, is_proxied: bool = True, is_external: bool | None = None, protocol: ProtocolType | None = None) -> typing.Self:
"""Adds a network endpoint"""
@@ -6126,6 +6341,8 @@ class ContainerResourceKwargs(_BaseResourceKwargs, total=False):
reference_uri: tuple[str, str]
reference_external_service: ExternalServiceResource
reference_endpoint: EndpointReference
+ endpoint_callback: tuple[str, typing.Callable[[EndpointUpdateContext], None]] | EndpointCallbackParameters
+ http_endpoint_callback: typing.Callable[[EndpointUpdateContext], None] | HttpEndpointCallbackParameters
endpoint: EndpointParameters | typing.Literal[True]
http_endpoint: HttpEndpointParameters | typing.Literal[True]
https_endpoint: HttpsEndpointParameters | typing.Literal[True]
@@ -6521,6 +6738,35 @@ def with_reference_endpoint(self, endpoint_reference: EndpointReference) -> typi
self._handle = self._wrap_builder(result)
return self
+ def with_endpoint_callback(self, endpoint_name: str, callback: typing.Callable[[EndpointUpdateContext], None], *, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates a named endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['endpointName'] = endpoint_name
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
+ def with_http_endpoint_callback(self, callback: typing.Callable[[EndpointUpdateContext], None], *, name: str | None = None, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates an HTTP endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if name is not None:
+ rpc_args['name'] = name
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withHttpEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
def with_endpoint(self, *, port: int | None = None, target_port: int | None = None, scheme: str | None = None, name: str | None = None, env: str | None = None, is_proxied: bool = True, is_external: bool | None = None, protocol: ProtocolType | None = None) -> typing.Self:
"""Adds a network endpoint"""
rpc_args: dict[str, typing.Any] = {'builder': self._handle}
@@ -7081,6 +7327,33 @@ def __init__(self, handle: Handle, client: AspireClient, **kwargs: typing.Unpack
handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withReferenceEndpoint', rpc_args))
else:
raise TypeError("Invalid type for option 'reference_endpoint'. Expected: EndpointReference")
+ if _endpoint_callback := kwargs.pop("endpoint_callback", None):
+ if _validate_tuple_types(_endpoint_callback, (str, typing.Callable[[EndpointUpdateContext], None])):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[0]
+ rpc_args["callback"] = client.register_callback(typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[1])
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ elif _validate_dict_types(_endpoint_callback, EndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(EndpointCallbackParameters, _endpoint_callback)["endpoint_name"]
+ rpc_args["callback"] = client.register_callback(typing.cast(EndpointCallbackParameters, _endpoint_callback)["callback"])
+ rpc_args["createIfNotExists"] = typing.cast(EndpointCallbackParameters, _endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'endpoint_callback'. Expected: (str, Callable[[EndpointUpdateContext], None]) or EndpointCallbackParameters")
+ if _http_endpoint_callback := kwargs.pop("http_endpoint_callback", None):
+ if _validate_type(_http_endpoint_callback, typing.Callable[[EndpointUpdateContext], None]):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(typing.Callable[[EndpointUpdateContext], None], _http_endpoint_callback))
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ elif _validate_dict_types(_http_endpoint_callback, HttpEndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback)["callback"])
+ rpc_args["name"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("name")
+ rpc_args["createIfNotExists"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'http_endpoint_callback'. Expected: Callable[[EndpointUpdateContext], None] or HttpEndpointCallbackParameters")
if _endpoint := kwargs.pop("endpoint", None):
if _validate_dict_types(_endpoint, EndpointParameters):
rpc_args: dict[str, typing.Any] = {"builder": handle}
@@ -7313,6 +7586,8 @@ class ProjectResourceKwargs(_BaseResourceKwargs, total=False):
reference_uri: tuple[str, str]
reference_external_service: ExternalServiceResource
reference_endpoint: EndpointReference
+ endpoint_callback: tuple[str, typing.Callable[[EndpointUpdateContext], None]] | EndpointCallbackParameters
+ http_endpoint_callback: typing.Callable[[EndpointUpdateContext], None] | HttpEndpointCallbackParameters
endpoint: EndpointParameters | typing.Literal[True]
http_endpoint: HttpEndpointParameters | typing.Literal[True]
https_endpoint: HttpsEndpointParameters | typing.Literal[True]
@@ -7545,6 +7820,35 @@ def with_reference_endpoint(self, endpoint_reference: EndpointReference) -> typi
self._handle = self._wrap_builder(result)
return self
+ def with_endpoint_callback(self, endpoint_name: str, callback: typing.Callable[[EndpointUpdateContext], None], *, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates a named endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['endpointName'] = endpoint_name
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
+ def with_http_endpoint_callback(self, callback: typing.Callable[[EndpointUpdateContext], None], *, name: str | None = None, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates an HTTP endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if name is not None:
+ rpc_args['name'] = name
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withHttpEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
def with_endpoint(self, *, port: int | None = None, target_port: int | None = None, scheme: str | None = None, name: str | None = None, env: str | None = None, is_proxied: bool = True, is_external: bool | None = None, protocol: ProtocolType | None = None) -> typing.Self:
"""Adds a network endpoint"""
rpc_args: dict[str, typing.Any] = {'builder': self._handle}
@@ -7988,6 +8292,33 @@ def __init__(self, handle: Handle, client: AspireClient, **kwargs: typing.Unpack
handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withReferenceEndpoint', rpc_args))
else:
raise TypeError("Invalid type for option 'reference_endpoint'. Expected: EndpointReference")
+ if _endpoint_callback := kwargs.pop("endpoint_callback", None):
+ if _validate_tuple_types(_endpoint_callback, (str, typing.Callable[[EndpointUpdateContext], None])):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[0]
+ rpc_args["callback"] = client.register_callback(typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[1])
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ elif _validate_dict_types(_endpoint_callback, EndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(EndpointCallbackParameters, _endpoint_callback)["endpoint_name"]
+ rpc_args["callback"] = client.register_callback(typing.cast(EndpointCallbackParameters, _endpoint_callback)["callback"])
+ rpc_args["createIfNotExists"] = typing.cast(EndpointCallbackParameters, _endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'endpoint_callback'. Expected: (str, Callable[[EndpointUpdateContext], None]) or EndpointCallbackParameters")
+ if _http_endpoint_callback := kwargs.pop("http_endpoint_callback", None):
+ if _validate_type(_http_endpoint_callback, typing.Callable[[EndpointUpdateContext], None]):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(typing.Callable[[EndpointUpdateContext], None], _http_endpoint_callback))
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ elif _validate_dict_types(_http_endpoint_callback, HttpEndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback)["callback"])
+ rpc_args["name"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("name")
+ rpc_args["createIfNotExists"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'http_endpoint_callback'. Expected: Callable[[EndpointUpdateContext], None] or HttpEndpointCallbackParameters")
if _endpoint := kwargs.pop("endpoint", None):
if _validate_dict_types(_endpoint, EndpointParameters):
rpc_args: dict[str, typing.Any] = {"builder": handle}
@@ -8229,6 +8560,8 @@ class ExecutableResourceKwargs(_BaseResourceKwargs, total=False):
reference_uri: tuple[str, str]
reference_external_service: ExternalServiceResource
reference_endpoint: EndpointReference
+ endpoint_callback: tuple[str, typing.Callable[[EndpointUpdateContext], None]] | EndpointCallbackParameters
+ http_endpoint_callback: typing.Callable[[EndpointUpdateContext], None] | HttpEndpointCallbackParameters
endpoint: EndpointParameters | typing.Literal[True]
http_endpoint: HttpEndpointParameters | typing.Literal[True]
https_endpoint: HttpsEndpointParameters | typing.Literal[True]
@@ -8462,6 +8795,35 @@ def with_reference_endpoint(self, endpoint_reference: EndpointReference) -> typi
self._handle = self._wrap_builder(result)
return self
+ def with_endpoint_callback(self, endpoint_name: str, callback: typing.Callable[[EndpointUpdateContext], None], *, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates a named endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['endpointName'] = endpoint_name
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
+ def with_http_endpoint_callback(self, callback: typing.Callable[[EndpointUpdateContext], None], *, name: str | None = None, create_if_not_exists: bool = True) -> typing.Self:
+ """Updates an HTTP endpoint via callback"""
+ rpc_args: dict[str, typing.Any] = {'builder': self._handle}
+ rpc_args['callback'] = self._client.register_callback(callback)
+ if name is not None:
+ rpc_args['name'] = name
+ if create_if_not_exists is not None:
+ rpc_args['createIfNotExists'] = create_if_not_exists
+ result = self._client.invoke_capability(
+ 'Aspire.Hosting/withHttpEndpointCallback',
+ rpc_args,
+ )
+ self._handle = self._wrap_builder(result)
+ return self
+
def with_endpoint(self, *, port: int | None = None, target_port: int | None = None, scheme: str | None = None, name: str | None = None, env: str | None = None, is_proxied: bool = True, is_external: bool | None = None, protocol: ProtocolType | None = None) -> typing.Self:
"""Adds a network endpoint"""
rpc_args: dict[str, typing.Any] = {'builder': self._handle}
@@ -8894,6 +9256,33 @@ def __init__(self, handle: Handle, client: AspireClient, **kwargs: typing.Unpack
handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withReferenceEndpoint', rpc_args))
else:
raise TypeError("Invalid type for option 'reference_endpoint'. Expected: EndpointReference")
+ if _endpoint_callback := kwargs.pop("endpoint_callback", None):
+ if _validate_tuple_types(_endpoint_callback, (str, typing.Callable[[EndpointUpdateContext], None])):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[0]
+ rpc_args["callback"] = client.register_callback(typing.cast(tuple[str, typing.Callable[[EndpointUpdateContext], None]], _endpoint_callback)[1])
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ elif _validate_dict_types(_endpoint_callback, EndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["endpointName"] = typing.cast(EndpointCallbackParameters, _endpoint_callback)["endpoint_name"]
+ rpc_args["callback"] = client.register_callback(typing.cast(EndpointCallbackParameters, _endpoint_callback)["callback"])
+ rpc_args["createIfNotExists"] = typing.cast(EndpointCallbackParameters, _endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'endpoint_callback'. Expected: (str, Callable[[EndpointUpdateContext], None]) or EndpointCallbackParameters")
+ if _http_endpoint_callback := kwargs.pop("http_endpoint_callback", None):
+ if _validate_type(_http_endpoint_callback, typing.Callable[[EndpointUpdateContext], None]):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(typing.Callable[[EndpointUpdateContext], None], _http_endpoint_callback))
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ elif _validate_dict_types(_http_endpoint_callback, HttpEndpointCallbackParameters):
+ rpc_args: dict[str, typing.Any] = {"builder": handle}
+ rpc_args["callback"] = client.register_callback(typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback)["callback"])
+ rpc_args["name"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("name")
+ rpc_args["createIfNotExists"] = typing.cast(HttpEndpointCallbackParameters, _http_endpoint_callback).get("create_if_not_exists")
+ handle = self._wrap_builder(client.invoke_capability('Aspire.Hosting/withHttpEndpointCallback', rpc_args))
+ else:
+ raise TypeError("Invalid type for option 'http_endpoint_callback'. Expected: Callable[[EndpointUpdateContext], None] or HttpEndpointCallbackParameters")
if _endpoint := kwargs.pop("endpoint", None):
if _validate_dict_types(_endpoint, EndpointParameters):
rpc_args: dict[str, typing.Any] = {"builder": handle}
@@ -9738,6 +10127,7 @@ def create_builder(
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel", DistributedApplicationModel)
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference", EndpointReference)
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression", EndpointReferenceExpression)
+_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext", EndpointUpdateContext)
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext", EnvironmentCallbackContext)
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext", ExecuteCommandContext)
_register_handle_wrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent", InitializeResourceEvent)
diff --git a/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs b/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs
index 8a31aa3be48..21a43fe9489 100644
--- a/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs
+++ b/tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs
@@ -1020,6 +1020,38 @@ impl CSharpAppResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -3565,6 +3597,38 @@ impl ContainerResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -4943,6 +5007,38 @@ impl DotnetToolResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -5958,6 +6054,220 @@ impl EndpointReferenceExpression {
}
}
+/// Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointUpdateContext
+pub struct EndpointUpdateContext {
+ handle: Handle,
+ client: Arc,
+}
+
+impl HasHandle for EndpointUpdateContext {
+ fn handle(&self) -> &Handle {
+ &self.handle
+ }
+}
+
+impl EndpointUpdateContext {
+ pub fn new(handle: Handle, client: Arc) -> Self {
+ Self { handle, client }
+ }
+
+ pub fn handle(&self) -> &Handle {
+ &self.handle
+ }
+
+ pub fn client(&self) -> &Arc {
+ &self.client
+ }
+
+ /// Gets the Name property
+ pub fn name(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.name", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Gets the Protocol property
+ pub fn protocol(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.protocol", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the Protocol property
+ pub fn set_protocol(&self, value: ProtocolType) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setProtocol", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the Port property
+ pub fn port(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.port", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the Port property
+ pub fn set_port(&self, value: f64) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setPort", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the TargetPort property
+ pub fn target_port(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetPort", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the TargetPort property
+ pub fn set_target_port(&self, value: f64) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetPort", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the UriScheme property
+ pub fn uri_scheme(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.uriScheme", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the UriScheme property
+ pub fn set_uri_scheme(&self, value: &str) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setUriScheme", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the TargetHost property
+ pub fn target_host(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.targetHost", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the TargetHost property
+ pub fn set_target_host(&self, value: &str) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTargetHost", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the Transport property
+ pub fn transport(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.transport", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the Transport property
+ pub fn set_transport(&self, value: &str) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTransport", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the IsExternal property
+ pub fn is_external(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isExternal", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the IsExternal property
+ pub fn set_is_external(&self, value: bool) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsExternal", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the IsProxied property
+ pub fn is_proxied(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.isProxied", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the IsProxied property
+ pub fn set_is_proxied(&self, value: bool) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setIsProxied", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the ExcludeReferenceEndpoint property
+ pub fn exclude_reference_endpoint(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.excludeReferenceEndpoint", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the ExcludeReferenceEndpoint property
+ pub fn set_exclude_reference_endpoint(&self, value: bool) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setExcludeReferenceEndpoint", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+
+ /// Gets the TlsEnabled property
+ pub fn tls_enabled(&self) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.tlsEnabled", args)?;
+ Ok(serde_json::from_value(result)?)
+ }
+
+ /// Sets the TlsEnabled property
+ pub fn set_tls_enabled(&self, value: bool) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("context".to_string(), self.handle.to_json());
+ args.insert("value".to_string(), serde_json::to_value(&value).unwrap_or(Value::Null));
+ let result = self.client.invoke_capability("Aspire.Hosting.ApplicationModel/EndpointUpdateContext.setTlsEnabled", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(EndpointUpdateContext::new(handle, self.client.clone()))
+ }
+}
+
/// Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext
pub struct EnvironmentCallbackContext {
handle: Handle,
@@ -6309,6 +6619,38 @@ impl ExecutableResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -10610,6 +10952,38 @@ impl ProjectResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -12449,6 +12823,38 @@ impl TestDatabaseResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -13786,6 +14192,38 @@ impl TestRedisResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, name: Option<&str>, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = name {
+ args.insert("name".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withHttpEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
/// Adds a network endpoint
pub fn with_endpoint(&self, port: Option, target_port: Option, scheme: Option<&str>, name: Option<&str>, env: Option<&str>, is_proxied: Option, is_external: Option, protocol: Option) -> Result> {
let mut args: HashMap = HashMap::new();
@@ -15234,6 +15672,38 @@ impl TestVaultResource {
Ok(IResourceWithEnvironment::new(handle, self.client.clone()))
}
+ /// Updates a named endpoint via callback
+ pub fn with_endpoint_callback(&self, endpoint_name: &str, callback: impl Fn(Vec) -> Value + Send + Sync + 'static, create_if_not_exists: Option) -> Result> {
+ let mut args: HashMap = HashMap::new();
+ args.insert("builder".to_string(), self.handle.to_json());
+ args.insert("endpointName".to_string(), serde_json::to_value(&endpoint_name).unwrap_or(Value::Null));
+ let callback_id = register_callback(callback);
+ args.insert("callback".to_string(), Value::String(callback_id));
+ if let Some(ref v) = create_if_not_exists {
+ args.insert("createIfNotExists".to_string(), serde_json::to_value(v).unwrap_or(Value::Null));
+ }
+ let result = self.client.invoke_capability("Aspire.Hosting/withEndpointCallback", args)?;
+ let handle: Handle = serde_json::from_value(result)?;
+ Ok(IResourceWithEndpoints::new(handle, self.client.clone()))
+ }
+
+ /// Updates an HTTP endpoint via callback
+ pub fn with_http_endpoint_callback(&self, callback: impl Fn(Vec