-
Notifications
You must be signed in to change notification settings - Fork 856
Add ATS pipeline parity for polyglot AppHosts #15826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9d10ab8
a2794b9
b9467c3
87bb2f6
68fec9e
0b97781
1484b39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,45 @@ namespace Aspire.Hosting.Ats; | |
| /// </summary> | ||
| internal static class PipelineExports | ||
| { | ||
| /// <summary> | ||
| /// Adds an application-level pipeline step in a TypeScript-friendly shape. | ||
| /// </summary> | ||
| /// <param name="pipeline">The distributed application pipeline.</param> | ||
| /// <param name="stepName">The unique name of the pipeline step.</param> | ||
| /// <param name="callback">The callback to execute when the step runs.</param> | ||
| /// <param name="dependsOn">Optional step names that this step depends on.</param> | ||
| /// <param name="requiredBy">Optional step names that require this step.</param> | ||
| [AspireExport(Description = "Adds a pipeline step to the application")] | ||
| public static void AddStep( | ||
| this global::Aspire.Hosting.Pipelines.IDistributedApplicationPipeline pipeline, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why reference the type like this? |
||
| string stepName, | ||
| Func<PipelineStepContext, Task> callback, | ||
| string[]? dependsOn = null, | ||
| string[]? requiredBy = null) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(pipeline); | ||
| ArgumentException.ThrowIfNullOrEmpty(stepName); | ||
| ArgumentNullException.ThrowIfNull(callback); | ||
|
|
||
| pipeline.AddStep(stepName, callback, dependsOn, requiredBy); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Registers a pipeline configuration callback in a TypeScript-friendly shape. | ||
| /// </summary> | ||
| /// <param name="pipeline">The distributed application pipeline.</param> | ||
| /// <param name="callback">The callback to execute during pipeline configuration.</param> | ||
| [AspireExport(Description = "Configures the application pipeline via a callback")] | ||
| public static void Configure( | ||
| this global::Aspire.Hosting.Pipelines.IDistributedApplicationPipeline pipeline, | ||
| Func<PipelineConfigurationContext, Task> callback) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(pipeline); | ||
| ArgumentNullException.ThrowIfNull(callback); | ||
|
|
||
| pipeline.AddPipelineConfiguration(callback); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds a key-value pair to the pipeline summary with a Markdown-formatted value. | ||
| /// </summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9332,6 +9332,18 @@ func (s *IDistributedApplicationBuilder) ExecutionContext() (*DistributedApplica | |
| return result.(*DistributedApplicationExecutionContext), nil | ||
| } | ||
|
|
||
| // Pipeline gets the Pipeline property | ||
| func (s *IDistributedApplicationBuilder) Pipeline() (*IDistributedApplicationPipeline, error) { | ||
| reqArgs := map[string]any{ | ||
| "context": SerializeValue(s.Handle()), | ||
| } | ||
| result, err := s.Client().InvokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.pipeline", reqArgs) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return result.(*IDistributedApplicationPipeline), nil | ||
| } | ||
|
|
||
| // UserSecretsManager gets the UserSecretsManager property | ||
| func (s *IDistributedApplicationBuilder) UserSecretsManager() (*IUserSecretsManager, error) { | ||
| reqArgs := map[string]any{ | ||
|
|
@@ -9593,6 +9605,49 @@ func (s *IDistributedApplicationEventing) Unsubscribe(subscription *DistributedA | |
| return err | ||
| } | ||
|
|
||
| // IDistributedApplicationPipeline wraps a handle for Aspire.Hosting/Aspire.Hosting.Pipelines.IDistributedApplicationPipeline. | ||
| type IDistributedApplicationPipeline struct { | ||
| HandleWrapperBase | ||
| } | ||
|
|
||
| // NewIDistributedApplicationPipeline creates a new IDistributedApplicationPipeline. | ||
| func NewIDistributedApplicationPipeline(handle *Handle, client *AspireClient) *IDistributedApplicationPipeline { | ||
| return &IDistributedApplicationPipeline{ | ||
| HandleWrapperBase: NewHandleWrapperBase(handle, client), | ||
| } | ||
| } | ||
|
|
||
| // AddStep adds a pipeline step to the application | ||
| func (s *IDistributedApplicationPipeline) AddStep(stepName string, callback func(...any) any, dependsOn []string, requiredBy []string) error { | ||
| reqArgs := map[string]any{ | ||
| "pipeline": SerializeValue(s.Handle()), | ||
| } | ||
| reqArgs["stepName"] = SerializeValue(stepName) | ||
| if callback != nil { | ||
| reqArgs["callback"] = RegisterCallback(callback) | ||
| } | ||
| if dependsOn != nil { | ||
| reqArgs["dependsOn"] = SerializeValue(dependsOn) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-existing issue in the Go generator: |
||
| } | ||
| if requiredBy != nil { | ||
| reqArgs["requiredBy"] = SerializeValue(requiredBy) | ||
| } | ||
| _, err := s.Client().InvokeCapability("Aspire.Hosting/addStep", reqArgs) | ||
| return err | ||
| } | ||
|
|
||
| // Configure configures the application pipeline via a callback | ||
| func (s *IDistributedApplicationPipeline) Configure(callback func(...any) any) error { | ||
| reqArgs := map[string]any{ | ||
| "pipeline": SerializeValue(s.Handle()), | ||
| } | ||
| if callback != nil { | ||
| reqArgs["callback"] = RegisterCallback(callback) | ||
| } | ||
| _, err := s.Client().InvokeCapability("Aspire.Hosting/configure", reqArgs) | ||
| return err | ||
| } | ||
|
|
||
| // IDistributedApplicationResourceEvent wraps a handle for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent. | ||
| type IDistributedApplicationResourceEvent struct { | ||
| HandleWrapperBase | ||
|
|
@@ -18560,6 +18615,9 @@ func init() { | |
| RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder", func(h *Handle, c *AspireClient) any { | ||
| return NewIDistributedApplicationBuilder(h, c) | ||
| }) | ||
| RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.IDistributedApplicationPipeline", func(h *Handle, c *AspireClient) any { | ||
| return NewIDistributedApplicationPipeline(h, c) | ||
| }) | ||
| RegisterHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplication", func(h *Handle, c *AspireClient) any { | ||
| return NewDistributedApplication(h, c) | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would prefer an indent level, and then repeated the indent chars by the level.