From 361971529d618deca7c4fbaca9d6470dffcb7b2c Mon Sep 17 00:00:00 2001 From: David Pine <7679720+IEvangelist@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:59:28 -0600 Subject: [PATCH] Align Go deployment UX and samples with the release SDK Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../src/components/AppHostBuilder.astro | 178 +++++----- .../components/SimpleAppHostCode.shared.ts | 4 +- .../docs/app-host/go-apphost-conventions.mdx | 31 +- .../src/content/docs/app-host/go-apphost.mdx | 8 +- .../get-started/add-aspire-existing-app.mdx | 32 +- .../docs/get-started/deploy-first-app.mdx | 307 ++++++++++-------- .../integrations/ai/ollama/ollama-host.mdx | 12 +- .../integrations/ai/openai/openai-host.mdx | 12 +- .../caching/garnet/garnet-host.mdx | 16 +- .../integrations/caching/redis/redis-host.mdx | 34 +- .../caching/valkey/valkey-host.mdx | 18 +- .../cloud/azure/ai-compatibility-matrix.mdx | 6 +- .../azure-ai-foundry-host.mdx | 32 +- .../azure-app-configuration-host.mdx | 36 +- .../azure-app-service-host.mdx | 26 +- .../azure-cache-redis-host.mdx | 2 +- .../azure-container-registry-host.mdx | 26 +- .../azure-cosmos-db/azure-cosmos-db-host.mdx | 34 +- .../cloud/azure/azure-data-explorer.mdx | 8 +- .../azure-event-hubs-host.mdx | 16 +- .../azure-key-vault/azure-key-vault-host.mdx | 6 +- .../azure/azure-openai/azure-openai-host.mdx | 2 +- .../azure-postgresql-host.mdx | 8 +- .../azure-service-bus-host.mdx | 16 +- .../azure-storage-blobs-host.mdx | 42 +-- .../cloud/azure/azure-storage-datalake.mdx | 8 +- .../azure-storage-queues-host.mdx | 38 +-- .../azure-storage-tables-host.mdx | 38 +-- .../cloud/azure/azure-virtual-network.mdx | 10 +- .../azure-web-pubsub-host.mdx | 12 +- .../cloud/azure/customize-resources.mdx | 2 +- .../docs/integrations/compute/docker.mdx | 22 +- .../docs/integrations/compute/floci.mdx | 36 +- .../content/docs/integrations/compute/k3s.mdx | 26 +- .../docs/integrations/compute/kubernetes.mdx | 36 +- .../efcore/azure-sql/azure-sql-host.mdx | 2 +- .../meilisearch/meilisearch-host.mdx | 4 +- .../databases/milvus/milvus-host.mdx | 4 +- .../databases/mongodb/mongodb-extensions.mdx | 6 +- .../databases/mongodb/mongodb-host.mdx | 24 +- .../databases/mysql/mysql-extensions.mdx | 6 +- .../databases/mysql/mysql-host.mdx | 20 +- .../databases/postgres/postgres-host.mdx | 30 +- .../postgres/postgresql-extensions.mdx | 6 +- .../databases/qdrant/qdrant-host.mdx | 4 +- .../databases/ravendb/ravendb-host.mdx | 2 +- .../sql-server/sql-server-extensions.mdx | 6 +- .../databases/sql-server/sql-server-host.mdx | 4 +- .../databases/sqlite/sqlite-host.mdx | 6 +- .../databases/surrealdb/surrealdb-host.mdx | 4 +- .../integrations/devtools/browser-logs.mdx | 6 +- .../integrations/devtools/dev-tunnels.mdx | 22 +- .../integrations/dotnet/project-resources.mdx | 28 +- .../frameworks/dotnet/dotnet-host.mdx | 18 +- .../integrations/frameworks/go/go-host.mdx | 33 +- .../apache-kafka/apache-kafka-host.mdx | 12 +- .../integrations/messaging/nats/nats-host.mdx | 12 +- .../messaging/rabbitmq/rabbitmq-host.mdx | 26 +- .../observability/seq/seq-host.mdx | 8 +- .../tests/e2e/custom-components.spec.ts | 28 ++ src/frontend/tests/e2e/pivot-selector.spec.ts | 44 +++ 61 files changed, 704 insertions(+), 801 deletions(-) diff --git a/src/frontend/src/components/AppHostBuilder.astro b/src/frontend/src/components/AppHostBuilder.astro index 8870dd326b..ef6d98d6fb 100644 --- a/src/frontend/src/components/AppHostBuilder.astro +++ b/src/frontend/src/components/AppHostBuilder.astro @@ -492,7 +492,7 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) app, err := builder.Build() if err != nil { @@ -518,11 +518,11 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -553,7 +553,7 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) app, err := builder.Build() if err != nil { @@ -584,11 +584,11 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -612,14 +612,13 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + // Add Go API + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api) app, err := builder.Build() @@ -644,19 +643,18 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + // Add Go API + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -685,15 +683,14 @@ func main() { WithDataVolume(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api) app, err := builder.Build() @@ -723,20 +720,19 @@ func main() { WithDataVolume(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -794,7 +790,7 @@ func main() { // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -818,10 +814,9 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + // Add Go API + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) app, err := builder.Build() if err != nil { @@ -845,14 +840,13 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + // Add Go API + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -881,10 +875,9 @@ func main() { WithDataVolume(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres) app, err := builder.Build() @@ -914,15 +907,14 @@ func main() { WithDataVolume(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -948,7 +940,7 @@ func main() { // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}) + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)) app, err := builder.Build() if err != nil { @@ -974,7 +966,7 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsDockerFile(func(container aspire.ContainerResource) {}) app, err := builder.Build() @@ -1001,12 +993,12 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsDockerFile(func(container aspire.ContainerResource) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1038,7 +1030,7 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsDockerFile(func(container aspire.ContainerResource) {}) app, err := builder.Build() @@ -1070,12 +1062,12 @@ func main() { // Add Vite frontend builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsDockerFile(func(container aspire.ContainerResource) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1100,15 +1092,14 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api). PublishAsDockerFile(func(container aspire.ContainerResource) {}) @@ -1134,21 +1125,20 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api). PublishAsDockerFile(func(container aspire.ContainerResource) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1178,16 +1168,15 @@ func main() { RunAsContainer(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api). PublishAsDockerFile(func(container aspire.ContainerResource) {}) @@ -1218,22 +1207,21 @@ func main() { RunAsContainer(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + api := builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add Vite frontend and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api). PublishAsDockerFile(func(container aspire.ContainerResource) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1292,7 +1280,7 @@ func main() { // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1317,10 +1305,9 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) app, err := builder.Build() @@ -1345,15 +1332,14 @@ func main() { log.Fatal(aspire.FormatError(err)) } - // Add Node.js API - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1383,10 +1369,9 @@ func main() { RunAsContainer(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) @@ -1417,16 +1402,15 @@ func main() { RunAsContainer(). AddDatabase("appdata") - // Add Node.js API and reference the database - api := builder.AddNodeApp("api", "../api", "src/index.ts"). - WithNpm(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + // Add Go API and reference the database + builder.AddGoApp("api", "../api"). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres). PublishAsAzureContainerApp(func(infra aspire.AzureResourceInfrastructure, app aspire.ContainerApp) {}) // Add custom container builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() @@ -1452,8 +1436,8 @@ func main() { } // Add custom container - customContainer := builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(8080)}). + builder.AddContainer("mycustomcontainer", "myregistry/myapp:latest"). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(8080)). PublishAsKubernetesService(func(service aspire.KubernetesResource) {}) app, err := builder.Build() diff --git a/src/frontend/src/components/SimpleAppHostCode.shared.ts b/src/frontend/src/components/SimpleAppHostCode.shared.ts index 7dae85f5df..6adb5e7ae8 100644 --- a/src/frontend/src/components/SimpleAppHostCode.shared.ts +++ b/src/frontend/src/components/SimpleAppHostCode.shared.ts @@ -282,7 +282,7 @@ ${apiResource} // Add frontend service and reference the API builder.AddViteApp("frontend", "../frontend"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(api) app, err := builder.Build() @@ -311,7 +311,7 @@ const nodejsGo = goAppHost(` api := builder.AddNodeApp("api", "../api", "server. WaitFor(postgres)`); const golangGo = goAppHost(` api := builder.AddGoApp("api", "../api"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithReference(postgres). WaitFor(postgres)`); diff --git a/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx b/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx index e0e0f9f153..98798d978a 100644 --- a/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx +++ b/src/frontend/src/content/docs/app-host/go-apphost-conventions.mdx @@ -1,7 +1,7 @@ --- title: Go AppHost API conventions seoTitle: Go AppHost API conventions for the Aspire SDK -description: Learn how the generated Aspire Go SDK names methods, passes optional parameters with options structs, reports errors through handles, and cancels a running AppHost. +description: Learn how the generated Aspire Go SDK names methods, passes typed options, reports errors through handles, and cancels a running AppHost. --- The Aspire CLI generates the Go SDK from the integrations in your `aspire.config.json` file, and every integration follows the same conventions. The examples on this page use a `builder` from `aspire.CreateBuilder()`, as in [Get started with the Go AppHost](/app-host/go-apphost/). @@ -14,19 +14,28 @@ Methods that add a resource, such as `AddRedis` and `AddGoApp`, return a _handle ## Optional parameters -Optional parameters go in a trailing variadic options argument. Leave it out to use the defaults. The argument is usually a struct named `Options`, such as `*aspire.WithHttpEndpointOptions`. Methods with the same name share one struct when their optional parameters match. If they don't match, or if another type already has the name, the name starts with the type that defines the method, such as `*aspire.ExecutableResourceWithVolumeOptions` for `WithVolume` on a Go app. A few methods take an existing type instead, such as `*aspire.DelveServerOptions` for `WithDelveServer`, and that type declares its own field types. - -In a `Options` struct, scalar fields (string, number, bool, and enum) are pointers, so a field that you don't set stays `nil`. Use `aspire.StringPtr`, `aspire.BoolPtr`, `aspire.IntPtr`, and `aspire.Float64Ptr` to create the values. Numeric fields use the type that matches the option: for example, ports are `*int` and durations expressed in milliseconds are `*float64`. Slice, map, callback, and `any` fields can already be `nil`, so they aren't pointers. For example, `AddGoAppOptions.BuildTags` is a `[]string`. +Optional parameters go in a trailing variadic options argument. Leave it out to use the defaults, or pass typed option values for the settings you want to change. You don't need an options struct or pointer helpers: ```go title="apphost.go" builder.AddGoApp("api", "./api"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ - Port: aspire.IntPtr(8080), - Env: aspire.StringPtr("PORT"), - }) + WithHttpEndpoint(aspire.HttpEndpointPort(8080), aspire.HttpEndpointEnv("PORT")) ``` -The [`WithHttpEndpoint` API reference](/reference/api/go/aspire.hosting/withhttpendpoint/) describes each field of `WithHttpEndpointOptions`. +Option names combine the method name without a leading `With` and the parameter name, such as `HttpEndpointPort`, `HttpEndpointEnv`, and `AddGoAppPackagePath`. Collection and callback options use the same pattern: + +```go title="apphost.go" +builder.AddGoApp("api", "./api", + aspire.AddGoAppPackagePath("./cmd/server"), + aspire.AddGoAppBuildTags([]string{"netgo", "integration"}), + aspire.AddGoAppRaceDetector(true), +) +``` + +Options are applied from left to right. Omitting an option preserves the default; passing `false`, `0`, or `""` explicitly sets that value. If you repeat an option, the last value wins. + +The generated SDK still accepts pointer-based options structs for compatibility. DTO inputs that aren't variadic options, such as `AddContainerOptions`, retain their declared field types. Check the generated SDK for the exact types and option names available for your installed integrations. + +The [`WithHttpEndpoint` API reference](/reference/api/go/aspire.hosting/withhttpendpoint/) describes the available endpoint settings. ## Errors @@ -59,7 +68,7 @@ log.Println("AppHost directory:", dir) ## Cancellation -A method that accepts a cancellation token takes it in its options struct. For example, `aspire.RunOptions` has a `CancellationToken` field. Create a token with `aspire.NewCancellationToken`, pass it in the options, and call its `Cancel` method to cancel the call: +A method that accepts a cancellation token exposes a typed option for it, such as `aspire.RunCancellationToken`. Create a token with `aspire.NewCancellationToken`, pass it in the options, and call its `Cancel` method to cancel the call: ```go title="apphost.go" app, err := builder.Build() @@ -71,7 +80,7 @@ if err != nil { token := aspire.NewCancellationToken() time.AfterFunc(time.Hour, token.Cancel) -if err := app.Run(&aspire.RunOptions{CancellationToken: token}); err != nil { +if err := app.Run(aspire.RunCancellationToken(token)); err != nil { log.Fatal(aspire.FormatError(err)) } ``` diff --git a/src/frontend/src/content/docs/app-host/go-apphost.mdx b/src/frontend/src/content/docs/app-host/go-apphost.mdx index 9d4a8cb2ec..d9ada5d4fb 100644 --- a/src/frontend/src/content/docs/app-host/go-apphost.mdx +++ b/src/frontend/src/content/docs/app-host/go-apphost.mdx @@ -247,13 +247,13 @@ func main() { cache := builder.AddRedis("cache") db := builder.AddPostgres("postgres").AddDatabase("postgresdb") - api := builder.AddGoApp("api", "./api"). + builder.AddGoApp("api", "./api"). WithModTidy(). WithReference(cache). WithReference(db). WaitFor(cache). WaitFor(db). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithExternalHttpEndpoints(). WithOtlpExporter() @@ -303,13 +303,13 @@ func main() { api := builder.AddGoApp("api", "./api"). WithReference(cache). WaitFor(cache). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) recommender := builder.AddUvicornApp("recommender", "./recommender", "main:app"). WithReference(cache). WaitFor(cache) - web := builder.AddViteApp("web", "./web"). + builder.AddViteApp("web", "./web"). WithReference(api). WithReference(recommender). WaitFor(api) diff --git a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx index b9b7f40250..2ec9b553d9 100644 --- a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx +++ b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx @@ -716,19 +716,15 @@ func main() { api := builder.AddContainer("api", "ghcr.io/contoso/orders-api:latest"). WithReference(db). WithReference(cache). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ - Port: aspire.IntPtr(8080), - TargetPort: aspire.IntPtr(8080), - Name: aspire.StringPtr("http"), - }) + WithHttpEndpoint(aspire.HttpEndpointPort(8080), + aspire.HttpEndpointTargetPort(8080), + aspire.HttpEndpointName("http")) builder.AddContainer("web", "ghcr.io/contoso/orders-web:latest"). WithReference(api). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ - Port: aspire.IntPtr(3000), - TargetPort: aspire.IntPtr(3000), - Name: aspire.StringPtr("http"), - }) + WithHttpEndpoint(aspire.HttpEndpointPort(3000), + aspire.HttpEndpointTargetPort(3000), + aspire.HttpEndpointName("http")) app, err := builder.Build() if err != nil { @@ -847,19 +843,15 @@ func main() { api := builder.AddDockerfile("api", "./api"). WithReference(db). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ - Port: aspire.IntPtr(8080), - TargetPort: aspire.IntPtr(8080), - Name: aspire.StringPtr("http"), - }) + WithHttpEndpoint(aspire.HttpEndpointPort(8080), + aspire.HttpEndpointTargetPort(8080), + aspire.HttpEndpointName("http")) builder.AddDockerfile("web", "./web"). WithReference(api). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ - Port: aspire.IntPtr(3000), - TargetPort: aspire.IntPtr(3000), - Name: aspire.StringPtr("http"), - }) + WithHttpEndpoint(aspire.HttpEndpointPort(3000), + aspire.HttpEndpointTargetPort(3000), + aspire.HttpEndpointName("http")) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/get-started/deploy-first-app.mdx b/src/frontend/src/content/docs/get-started/deploy-first-app.mdx index 04fe98c724..21788999d2 100644 --- a/src/frontend/src/content/docs/get-started/deploy-first-app.mdx +++ b/src/frontend/src/content/docs/get-started/deploy-first-app.mdx @@ -1,7 +1,7 @@ --- title: Deploy your first Aspire app category: tutorial -description: "Deploy your first Aspire application end to end — choose a target (Azure, Kubernetes, or Docker Compose), publish artifacts, and run `aspire deploy` from a C# or TypeScript AppHost." +description: "Deploy your first Aspire app to Docker Compose or Azure Container Apps from a C#, TypeScript, or Go AppHost, then verify your deployment." --- import { Aside, Steps, TabItem, Tabs } from '@astrojs/starlight/components'; @@ -834,108 +834,6 @@ Steps Summary: Additional information about this command can be found in the [`aspire deploy`](/reference/cli/commands/aspire-deploy/) reference docs. -### Post deployment output - -After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. This may include files such as Docker Compose files, Kubernetes manifests, or cloud provider-specific configuration files. - - - - - - - aspire-output - - .env - - .env.Production - - docker-compose.yaml - - - The `aspire-output` directory contains the generated environment variables and the Docker Compose configuration. The best part is, these files are opaque to you as a developer. You don't need to write them yourself. - - The `.env.Production` file contains the name of the app image: - - ```dotenv title="./aspire-output/.env.Production" - # Container image name for apiservice - APISERVICE_IMAGE=apiservice:latest - - # Default container port for apiservice - APISERVICE_PORT=8080 - - # Container image name for webfrontend - WEBFRONTEND_IMAGE=webfrontend:latest - - # Default container port for webfrontend - WEBFRONTEND_PORT=8080 - ``` - - Finally, the `docker-compose.yaml` file defines the services for both the API and frontend: - - ```yaml title="./aspire-output/docker-compose.yaml" - services: - env-dashboard: - image: "mcr.microsoft.com/aspire/nightly/dashboard:latest" - expose: - - "18888" - - "18889" - networks: - - "aspire" - restart: "always" - apiservice: - image: "${APISERVICE_IMAGE}" - environment: - OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" - OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" - OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" - ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" - HTTP_PORTS: "${APISERVICE_PORT}" - OTEL_EXPORTER_OTLP_ENDPOINT: "http://env-dashboard:18889" - OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" - OTEL_SERVICE_NAME: "apiservice" - expose: - - "${APISERVICE_PORT}" - networks: - - "aspire" - webfrontend: - image: "${WEBFRONTEND_IMAGE}" - environment: - OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" - OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" - OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" - ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" - HTTP_PORTS: "${WEBFRONTEND_PORT}" - APISERVICE_HTTP: "http://apiservice:${APISERVICE_PORT}" - services__apiservice__http__0: "http://apiservice:${APISERVICE_PORT}" - APISERVICE_HTTPS: "https://apiservice:${APISERVICE_PORT}" - OTEL_EXPORTER_OTLP_ENDPOINT: "http://env-dashboard:18889" - OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" - OTEL_SERVICE_NAME: "webfrontend" - ports: - - "${WEBFRONTEND_PORT}" - depends_on: - apiservice: - condition: "service_started" - networks: - - "aspire" - networks: - aspire: - driver: "bridge" - ``` - - - - - After deploying to Azure App Containers, the Aspire CLI saves the deployment state file to your local machine. - - - - %USERPROFILE% - - .aspire/deployments/[AppHost-Sha256]/production.json - - - - - - - @@ -1151,8 +1049,154 @@ Steps Summary: Additional information about this command can be found in the [`aspire deploy`](/reference/cli/commands/aspire-deploy/) reference docs. + + + + +Now that you've added the deployment package and updated your AppHost, you can deploy your Aspire app. + + + + + + Deploying to Docker Compose builds the container images and starts the services locally using Docker Compose. + + ```bash title="Aspire CLI — Deploy your app" + aspire deploy + ``` + + The deploy builds one image for the `app` resource. For a Go app, Aspire generates a multi-stage Dockerfile that builds the Go binary, then copies in the React build output from the `frontend` resource at `./static`. When the deployment finishes, the output includes a `print-app-summary` step with the local URL for the app. + + + + + + Deploying to Azure App Containers provisions the Azure resources, builds and pushes the container image, and deploys the app. + + ```bash title="Aspire CLI — Deploy your app" + aspire deploy + ``` + + The Aspire CLI prompts for the Azure subscription, location, and resource group if they aren't already configured. The deploy builds one image for the `app` resource (the Go API with the bundled React frontend), pushes it to an Azure Container Registry, and deploys it to an Azure Container Apps environment. + + + + + + + For more information, see [aspire deploy](/reference/cli/commands/aspire-deploy/) and [Deploy Go apps](/deployment/go-apps/). + + + + ### Post deployment output + + +After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. This may include files such as Docker Compose files, Kubernetes manifests, or cloud provider-specific configuration files. + + + + + + - aspire-output + - .env + - .env.Production + - docker-compose.yaml + + + The `aspire-output` directory contains the generated environment variables and the Docker Compose configuration. The best part is, these files are opaque to you as a developer. You don't need to write them yourself. + + The `.env.Production` file contains the name of the app image: + + ```dotenv title="./aspire-output/.env.Production" + # Container image name for apiservice + APISERVICE_IMAGE=apiservice:latest + + # Default container port for apiservice + APISERVICE_PORT=8080 + + # Container image name for webfrontend + WEBFRONTEND_IMAGE=webfrontend:latest + + # Default container port for webfrontend + WEBFRONTEND_PORT=8080 + ``` + + Finally, the `docker-compose.yaml` file defines the services for both the API and frontend: + + ```yaml title="./aspire-output/docker-compose.yaml" + services: + env-dashboard: + image: "mcr.microsoft.com/aspire/nightly/dashboard:latest" + expose: + - "18888" + - "18889" + networks: + - "aspire" + restart: "always" + apiservice: + image: "${APISERVICE_IMAGE}" + environment: + OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" + OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" + OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" + ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "${APISERVICE_PORT}" + OTEL_EXPORTER_OTLP_ENDPOINT: "http://env-dashboard:18889" + OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" + OTEL_SERVICE_NAME: "apiservice" + expose: + - "${APISERVICE_PORT}" + networks: + - "aspire" + webfrontend: + image: "${WEBFRONTEND_IMAGE}" + environment: + OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" + OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" + OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" + ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "${WEBFRONTEND_PORT}" + APISERVICE_HTTP: "http://apiservice:${APISERVICE_PORT}" + services__apiservice__http__0: "http://apiservice:${APISERVICE_PORT}" + APISERVICE_HTTPS: "https://apiservice:${APISERVICE_PORT}" + OTEL_EXPORTER_OTLP_ENDPOINT: "http://env-dashboard:18889" + OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" + OTEL_SERVICE_NAME: "webfrontend" + ports: + - "${WEBFRONTEND_PORT}" + depends_on: + apiservice: + condition: "service_started" + networks: + - "aspire" + networks: + aspire: + driver: "bridge" + ``` + + + + + After deploying to Azure App Containers, the Aspire CLI saves the deployment state file to your local machine. + + + - %USERPROFILE% + - .aspire/deployments/[AppHost-Sha256]/production.json + + + + + + + + + + + After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. This may include files such as Docker Compose files, Kubernetes manifests, or cloud provider-specific configuration files. @@ -1244,42 +1288,6 @@ After a deployment, the Aspire CLI writes to the provided output path (or the de -Now that you've added the deployment package and updated your AppHost, you can deploy your Aspire app. - - - - - - Deploying to Docker Compose builds the container images and starts the services locally using Docker Compose. - - ```bash title="Aspire CLI — Deploy your app" - aspire deploy - ``` - - The deploy builds one image for the `app` resource. For a Go app, Aspire generates a multi-stage Dockerfile that builds the Go binary, then copies in the React build output from the `frontend` resource at `./static`. When the deployment finishes, the output includes a `print-app-summary` step with the local URL for the app. - - - - - - Deploying to Azure App Containers provisions the Azure resources, builds and pushes the container image, and deploys the app. - - ```bash title="Aspire CLI — Deploy your app" - aspire deploy - ``` - - The Aspire CLI prompts for the Azure subscription, location, and resource group if they aren't already configured. The deploy builds one image for the `app` resource (the Go API with the bundled React frontend), pushes it to an Azure Container Registry, and deploys it to an Azure Container Apps environment. - - - - - - - For more information, see [aspire deploy](/reference/cli/commands/aspire-deploy/) and [Deploy Go apps](/deployment/go-apps/). - - -### Post deployment output - After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. @@ -1432,7 +1440,20 @@ To verify that your application is running as expected after deployment, follow When deploying to Docker Compose, the `aspire deploy` command displays the URLs where your services are running. Look for the `print-*-summary` steps in the deployment output, which show the localhost URLs for each service that has been configured with `WithExternalHttpEndpoints`. - For this app, look for the `print-app-summary` step, which reports the URL for the `app` resource. Open your web browser and navigate to that URL to see your deployed application. + In the deployment output, you'll see lines similar to the following: + + ```bash title="Aspire CLI - Deployment summary" + (print-env-dashboard-summary) i [INF] Successfully deployed env-dashboard to http://localhost:54633. + (print-app-summary) i [INF] Successfully deployed app to http://localhost:54463. + ``` + + Open your web browser and navigate to the URL shown for your app (for example, `http://localhost:54463`) to see your deployed application. + + The frontend displays the weather forecast data in a React template. Both the Go API and the React frontend are served from the same Docker container. @@ -1449,6 +1470,12 @@ To verify that your application is running as expected after deployment, follow Open your web browser and navigate to the provided URL to see your deployed application. + + The frontend displays the weather forecast data in a React template. Both the Go API and the React frontend are served from the same container. diff --git a/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx b/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx index c5228b2fc4..764ff1c145 100644 --- a/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/ollama/ollama-host.mdx @@ -152,7 +152,7 @@ func main() { ollama := builder.AddOllama("ollama") llama3 := ollama.AddModel("llama3") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(llama3) // After adding all resources, run the app... @@ -244,7 +244,7 @@ func main() { // Add with an explicit resource name llama3 := ollama.AddNamedModel("ollama-llama3", "llama3") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(phi35). WithReference(llama3) @@ -321,7 +321,7 @@ func main() { llama3 := ollama.AddModel("llama3") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(llama3) // After adding all resources, run the app... @@ -450,7 +450,7 @@ func main() { vendor := aspire.OllamaGpuVendorAMD ollama := builder.AddOllama("ollama"). - WithGPUSupport(&aspire.WithGPUSupportOptions{Vendor: &vendor}) + WithGPUSupport(aspire.GPUSupportVendor(vendor)) ollama.AddModel("llama3") @@ -524,7 +524,7 @@ func main() { "llama", "bartowski/Llama-3.2-1B-Instruct-GGUF:IQ4_XS") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(llama) // After adding all resources, run the app... @@ -580,7 +580,7 @@ func main() { log.Fatal(aspire.FormatError(err)) } - ollama := builder.AddOllama("ollama", &aspire.AddOllamaOptions{Port: aspire.IntPtr(11434)}) + ollama := builder.AddOllama("ollama", aspire.AddOllamaPort(11434)) ollama.AddModel("llama3") diff --git a/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx b/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx index 4411624238..8fd33b8677 100644 --- a/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx +++ b/src/frontend/src/content/docs/integrations/ai/openai/openai-host.mdx @@ -148,7 +148,7 @@ func main() { chat := openai.AddModel("chat", "gpt-4o-mini") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat) // After adding all resources, run the app... @@ -231,7 +231,7 @@ func main() { chat := openai.AddModel("chat", "gpt-4o-mini") embeddings := openai.AddModel("embeddings", "text-embedding-3-small") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat). WithReference(embeddings) @@ -313,14 +313,14 @@ func main() { log.Fatal(aspire.FormatError(err)) } - apiKey := builder.AddParameter("my-api-key", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) + apiKey := builder.AddParameter("my-api-key", aspire.AddParameterSecret(true)) openai := builder.AddOpenAI("openai"). WithApiKey(apiKey) chat := openai.AddModel("chat", "gpt-4o-mini") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat) // After adding all resources, run the app... @@ -389,7 +389,7 @@ func main() { chat := openai.AddModel("chat", "gpt-4o-mini") - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat) // After adding all resources, run the app... @@ -458,7 +458,7 @@ func main() { chat := openai.AddModel("chat", "gpt-4o-mini"). WithHealthCheck() - api := builder.AddNodeApp("api", "./api", "index.js"). + builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat) // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx b/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx index ecb83135da..e5b118a1d1 100644 --- a/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/garnet/garnet-host.mdx @@ -199,7 +199,7 @@ if err != nil { } cache := builder.AddGarnet("cache"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -254,7 +254,7 @@ if err != nil { } cache := builder.AddGarnet("cache"). - WithDataBindMount("/Garnet/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/Garnet/Data", aspire.DataBindMountIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -318,9 +318,7 @@ if err != nil { cache := builder.AddGarnet("cache"). WithDataVolume(). - WithPersistence(&aspire.WithPersistenceOptions{ - Interval: aspire.Float64Ptr(5 * 60 * 1000), - }) + WithPersistence(aspire.PersistenceInterval(5 * 60 * 1000)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -378,12 +376,10 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -cache := builder.AddGarnet("cache", &aspire.AddGarnetOptions{ - Port: aspire.IntPtr(6379), - Password: &password, -}) +cache := builder.AddGarnet("cache", aspire.AddGarnetPort(6379), + aspire.AddGarnetPassword(password)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) diff --git a/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx b/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx index fe559d5936..92ec55fec3 100644 --- a/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/redis/redis-host.mdx @@ -199,7 +199,7 @@ if err != nil { } cache := builder.AddRedis("cache"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -254,7 +254,7 @@ if err != nil { } cache := builder.AddRedis("cache"). - WithDataBindMount("C:\\Redis\\Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("C:\\Redis\\Data", aspire.DataBindMountIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -319,10 +319,8 @@ if err != nil { cache := builder.AddRedis("cache"). WithDataVolume(). - WithPersistence(&aspire.WithPersistenceOptions{ - Interval: aspire.Float64Ptr(5 * 60 * 1000), - KeysChangedThreshold: aspire.Int64Ptr(100), - }) + WithPersistence(aspire.PersistenceInterval(5*60*1000), + aspire.PersistenceKeysChangedThreshold(100)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -376,12 +374,10 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -cache := builder.AddRedis("cache", &aspire.AddRedisOptions{ - Port: aspire.IntPtr(6379), - Password: &password, -}) +cache := builder.AddRedis("cache", aspire.AddRedisPort(6379), + aspire.AddRedisPassword(password)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -493,11 +489,9 @@ if err != nil { } cache := builder.AddRedis("cache"). - WithRedisInsight(&aspire.WithRedisInsightOptions{ - ConfigureContainer: func(redisInsight aspire.RedisInsightResource) { - redisInsight.WithHostPort(aspire.IntPtr(8001)) - }, - }) + WithRedisInsight(aspire.RedisInsightConfigureContainer(func(redisInsight aspire.RedisInsightResource) { + redisInsight.WithHostPort(aspire.IntPtr(8001)) + })) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -609,11 +603,9 @@ if err != nil { } cache := builder.AddRedis("cache"). - WithRedisCommander(&aspire.WithRedisCommanderOptions{ - ConfigureContainer: func(redisCommander aspire.RedisCommanderResource) { - redisCommander.WithHostPort(aspire.IntPtr(8081)) - }, - }) + WithRedisCommander(aspire.RedisCommanderConfigureContainer(func(redisCommander aspire.RedisCommanderResource) { + redisCommander.WithHostPort(aspire.IntPtr(8081)) + })) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) diff --git a/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx b/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx index ffe634a063..529e7ecffb 100644 --- a/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx +++ b/src/frontend/src/content/docs/integrations/caching/valkey/valkey-host.mdx @@ -199,7 +199,7 @@ if err != nil { } cache := builder.AddValkey("cache"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -254,7 +254,7 @@ if err != nil { } cache := builder.AddValkey("cache"). - WithDataBindMount("/Valkey/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/Valkey/Data", aspire.DataBindMountIsReadOnly(false)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -319,10 +319,8 @@ if err != nil { cache := builder.AddValkey("cache"). WithDataVolume(). - WithPersistence(&aspire.WithPersistenceOptions{ - Interval: aspire.Float64Ptr(5 * 60 * 1000), - KeysChangedThreshold: aspire.Int64Ptr(100), - }) + WithPersistence(aspire.PersistenceInterval(5*60*1000), + aspire.PersistenceKeysChangedThreshold(100)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) @@ -376,12 +374,10 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -cache := builder.AddValkey("cache", &aspire.AddValkeyOptions{ - Port: aspire.IntPtr(6379), - Password: &password, -}) +cache := builder.AddValkey("cache", aspire.AddValkeyPort(6379), + aspire.AddValkeyPassword(password)) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(cache) diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx index 7ffcf9d3a0..9aecf717ec 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/ai-compatibility-matrix.mdx @@ -98,10 +98,8 @@ if err != nil { foundry := builder.AddFoundry("foundry"). RunAsFoundryLocal() -chat := foundry.AddDeployment("chat", "Phi-4", &aspire.AddDeploymentOptions{ - ModelVersion: aspire.StringPtr("1"), - Format: aspire.StringPtr("Microsoft"), -}) +chat := foundry.AddDeployment("chat", "Phi-4", aspire.AddDeploymentModelVersion("1"), + aspire.AddDeploymentFormat("Microsoft")) api := builder.AddNodeApp("api", "./api", "index.js"). WithReference(chat) diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx index 54438bf399..cff7ca4903 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-ai-foundry/azure-ai-foundry-host.mdx @@ -603,10 +603,8 @@ approvalMode := aspire.FoundryToolboxMcpGlobalApprovalModeAlways toolbox := project.AddToolbox("field-tools"). WithDescription("Tools for field technicians."). - WithWebSearchTool(&aspire.WithWebSearchToolOptions{ - Name: aspire.StringPtr("web-search"), - Description: aspire.StringPtr("Search the public web."), - }). + WithWebSearchTool(aspire.WebSearchToolName("web-search"), + aspire.WebSearchToolDescription("Search the public web.")). WithMcpTool("inventory", "https://inventory.example.com/mcp", aspire.McpToolOptions(&aspire.FoundryToolboxMcpToolOptions{ ServerDescription: aspire.StringPtr("Inventory MCP server."), ApprovalPolicy: &aspire.FoundryToolboxMcpApprovalPolicy{ @@ -750,7 +748,7 @@ agentPython := builder.AddPythonApp("agent-python", "../agent", "main:app"). agentPython.AsHostedAgent(project) agentDotnet := builder.AddDotnetProject("agent-dotnet", "../Agent/Agent.csproj"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(9000)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(9000)). WithReference(project). WithReference(chat) agentDotnet.AsHostedAgent(project) @@ -813,7 +811,7 @@ await dotnetWeatherAgent.asHostedAgent(project); ```go dotnetWeatherAgent := builder.AddDotnetProject("weather-agent-dotnet", "../WeatherAgent.Dotnet/WeatherAgent.Dotnet.csproj"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{TargetPort: aspire.IntPtr(9000)}). + WithHttpEndpoint(aspire.HttpEndpointTargetPort(9000)). WithReference(project). WaitFor(project). WithReference(chat). @@ -943,19 +941,15 @@ if err != nil { foundry := builder.AddFoundry("foundry") project := foundry.AddProject("my-project") -chat := project.AddModelDeployment("chat", "gpt-5-mini", &aspire.AddModelDeploymentOptions{ - ModelVersion: aspire.StringPtr("2025-06-01"), - Format: aspire.StringPtr("OpenAI"), -}) +chat := project.AddModelDeployment("chat", "gpt-5-mini", aspire.AddModelDeploymentModelVersion("2025-06-01"), + aspire.AddModelDeploymentFormat("OpenAI")) webSearch := project.AddWebSearchTool("web-search") -project.AddPromptAgent("web-researcher", chat, &aspire.AddPromptAgentOptions{ - Instructions: aspire.StringPtr(` +project.AddPromptAgent("web-researcher", chat, aspire.AddPromptAgentInstructions(` You are the Web Researcher. Use web search for current information, cite sources, summarize tradeoffs, and keep answers concise and practical. -`), -}). +`)). WithTool(webSearch) app, err := builder.Build() @@ -1058,7 +1052,7 @@ existingFoundryName := builder.AddParameter("existingFoundryName") existingFoundryResourceGroup := builder.AddParameter("existingFoundryResourceGroup") foundry := builder.AddFoundry("foundry"). - AsExisting(existingFoundryName, &aspire.AsExistingOptions{ResourceGroup: existingFoundryResourceGroup}) + AsExisting(existingFoundryName, aspire.AsExistingResourceGroup(existingFoundryResourceGroup)) api := builder.AddGoApp("api", "./api"). WithReference(foundry) @@ -1219,12 +1213,10 @@ const chat = await foundry ```go title="apphost.go" foundry := builder.AddFoundry("foundry"). - RunAsFoundryLocal(&aspire.RunAsFoundryLocalOptions{Endpoint: aspire.StringPtr("http://windows-host:5273")}) + RunAsFoundryLocal(aspire.RunAsFoundryLocalEndpoint("http://windows-host:5273")) -chat := foundry.AddDeployment("chat", "Phi-3.5-mini-instruct", &aspire.AddDeploymentOptions{ - ModelVersion: aspire.StringPtr("1"), - Format: aspire.StringPtr("Microsoft"), -}). +chat := foundry.AddDeployment("chat", "Phi-3.5-mini-instruct", aspire.AddDeploymentModelVersion("1"), + aspire.AddDeploymentFormat("Microsoft")). SetLocalModelId(aspire.StringPtr("Phi-3.5-mini-instruct-generic-gpu:1")) ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx index 5c107d3930..d4f278d2bd 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-configuration/azure-app-configuration-host.mdx @@ -397,11 +397,9 @@ if err != nil { } builder.AddAzureAppConfiguration("config"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureEmulator: func(emulator aspire.AzureAppConfigurationEmulatorResource) { - emulator.WithHostPort(aspire.IntPtr(28000)) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureEmulator(func(emulator aspire.AzureAppConfigurationEmulatorResource) { + emulator.WithHostPort(aspire.IntPtr(28000)) + })) // After adding all resources, run the app... ``` @@ -458,11 +456,9 @@ if err != nil { } builder.AddAzureAppConfiguration("config"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureEmulator: func(emulator aspire.AzureAppConfigurationEmulatorResource) { - emulator.WithLifetime(aspire.ContainerLifetimePersistent) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureEmulator(func(emulator aspire.AzureAppConfigurationEmulatorResource) { + emulator.WithLifetime(aspire.ContainerLifetimePersistent) + })) // After adding all resources, run the app... ``` @@ -517,11 +513,9 @@ if err != nil { } builder.AddAzureAppConfiguration("config"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureEmulator: func(emulator aspire.AzureAppConfigurationEmulatorResource) { - emulator.WithDataVolume() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureEmulator(func(emulator aspire.AzureAppConfigurationEmulatorResource) { + emulator.WithDataVolume() + })) // After adding all resources, run the app... ``` @@ -578,13 +572,9 @@ if err != nil { } builder.AddAzureAppConfiguration("config"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureEmulator: func(emulator aspire.AzureAppConfigurationEmulatorResource) { - emulator.WithDataBindMount(&aspire.WithDataBindMountOptions{ - Path: aspire.StringPtr("../Emulator/Data"), - }) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureEmulator(func(emulator aspire.AzureAppConfigurationEmulatorResource) { + emulator.WithDataBindMount(aspire.DataBindMountPath("../Emulator/Data")) + })) // After adding all resources, run the app... ``` @@ -651,7 +641,7 @@ configName := builder.AddParameter("configName") configResourceGroupName := builder.AddParameter("configResourceGroupName") builder.AddAzureAppConfiguration("config"). - AsExisting(configName, &aspire.AsExistingOptions{ResourceGroup: configResourceGroupName}) + AsExisting(configName, aspire.AsExistingResourceGroup(configResourceGroupName)) // After adding all resources, run the app... app, err := builder.Build() diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx index e07e64429e..d968314316 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-app-service/azure-app-service-host.mdx @@ -259,7 +259,7 @@ existingAppServicePlanName := builder.AddParameter("existingAppServicePlanName") existingResourceGroup := builder.AddParameter("existingResourceGroup") builder.AddAzureAppServiceEnvironment("app-service-env"). - AsExisting(existingAppServicePlanName, &aspire.AsExistingOptions{ResourceGroup: existingResourceGroup}) + AsExisting(existingAppServicePlanName, aspire.AsExistingResourceGroup(existingResourceGroup)) api := builder.AddGoApp("api", "./api") @@ -338,11 +338,9 @@ if err != nil { builder.AddAzureAppServiceEnvironment("app-service-env") api := builder.AddGoApp("api", "./api") -api.PublishAsAzureAppServiceWebsite(&aspire.PublishAsAzureAppServiceWebsiteOptions{ - Configure: func(infra aspire.AzureResourceInfrastructure, website aspire.WebSite) { - // Customize infrastructure here using Azure Provisioning APIs - }, -}) +api.PublishAsAzureAppServiceWebsite(aspire.PublishAsAzureAppServiceWebsiteConfigure(func(infra aspire.AzureResourceInfrastructure, website aspire.WebSite) { + // Customize infrastructure here using Azure Provisioning APIs +})) app, err := builder.Build() if err != nil { @@ -437,12 +435,12 @@ builder.AddAzureAppServiceEnvironment("appservice"). WithDeploymentSlot("staging") apiService := builder.AddGoApp("apiservice", "./apiservice"). - WithHttpHealthCheck(&aspire.WithHttpHealthCheckOptions{Path: aspire.StringPtr("/health")}). + WithHttpHealthCheck(aspire.HttpHealthCheckPath("/health")). WithExternalHttpEndpoints() web := builder.AddGoApp("webfrontend", "./web"). WithExternalHttpEndpoints(). - WithHttpHealthCheck(&aspire.WithHttpHealthCheckOptions{Path: aspire.StringPtr("/health")}). + WithHttpHealthCheck(aspire.HttpHealthCheckPath("/health")). WithReference(apiService). WaitFor(apiService) @@ -577,14 +575,12 @@ await api.publishAsAzureAppServiceWebsite({ ```go title="apphost.go" api := builder.AddGoApp("api", "./api") -api.PublishAsAzureAppServiceWebsite(&aspire.PublishAsAzureAppServiceWebsiteOptions{ - Configure: func(infra aspire.AzureResourceInfrastructure, website aspire.WebSite) { - // Production website customizations - }, - ConfigureSlot: func(infra aspire.AzureResourceInfrastructure, slot aspire.WebSiteSlot) { +api.PublishAsAzureAppServiceWebsite(aspire.PublishAsAzureAppServiceWebsiteConfigure(func(infra aspire.AzureResourceInfrastructure, website aspire.WebSite) { + // Production website customizations +}), + aspire.PublishAsAzureAppServiceWebsiteConfigureSlot(func(infra aspire.AzureResourceInfrastructure, slot aspire.WebSiteSlot) { // Deployment slot customizations - }, -}) + })) ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx index 8c48c2873c..2d7d47d30b 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx @@ -287,7 +287,7 @@ existingRedisName := builder.AddParameter("existingRedisName") existingRedisResourceGroup := builder.AddParameter("existingRedisResourceGroup") cache := builder.AddAzureManagedRedis("cache"). - AsExisting(existingRedisName, &aspire.AsExistingOptions{ResourceGroup: existingRedisResourceGroup}) + AsExisting(existingRedisName, aspire.AsExistingResourceGroup(existingRedisResourceGroup)) api := builder.AddGoApp("api", "./api"). WithReference(cache) diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx index 520124c66b..1806b8b1a8 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-container-registry/azure-container-registry-host.mdx @@ -303,7 +303,7 @@ registryName := builder.AddParameter("registryName") rgName := builder.AddParameter("rgName") acr := builder.AddAzureContainerRegistry("my-acr") -acr.PublishAsExisting(registryName, &aspire.PublishAsExistingOptions{ResourceGroup: rgName}) +acr.PublishAsExisting(registryName, aspire.PublishAsExistingResourceGroup(rgName)) env := builder.AddAzureContainerAppEnvironment("env") env.WithAzureContainerRegistry(acr) @@ -321,7 +321,7 @@ Use `AsExisting` to reference an existing registry in both run and publish modes ```go title="apphost.go" acr := builder.AddAzureContainerRegistry("my-acr") -acr.AsExisting(registryName, &aspire.AsExistingOptions{ResourceGroup: rgName}) +acr.AsExisting(registryName, aspire.AsExistingResourceGroup(rgName)) ``` @@ -437,10 +437,10 @@ if err != nil { } acr := builder.AddAzureContainerRegistry("my-acr") -acr.WithPurgeTask("0 1 * * *", &aspire.WithPurgeTaskOptions{ - Ago: aspire.Float64Ptr(7 * 24 * 60 * 60 * 1000), // 7 days in milliseconds - Keep: aspire.IntPtr(5), -}) +acr.WithPurgeTask("0 1 * * *", + aspire.PurgeTaskAgo(7*24*60*60*1000), // 7 days in milliseconds + aspire.PurgeTaskKeep(5), +) app, err := builder.Build() if err != nil { @@ -487,15 +487,11 @@ await acr.withPurgeTask("0 2 * * 0", { ```go title="Multiple purge tasks" acr := builder.AddAzureContainerRegistry("my-acr") -acr.WithPurgeTask("0 1 * * *", &aspire.WithPurgeTaskOptions{ - Filter: aspire.StringPtr("app1:.*"), - Keep: aspire.IntPtr(3), -}) -acr.WithPurgeTask("0 2 * * 0", &aspire.WithPurgeTaskOptions{ - Filter: aspire.StringPtr("app2:.*"), - Ago: aspire.Float64Ptr(30 * 24 * 60 * 60 * 1000), - Keep: aspire.IntPtr(10), -}) +acr.WithPurgeTask("0 1 * * *", aspire.PurgeTaskFilter("app1:.*"), + aspire.PurgeTaskKeep(3)) +acr.WithPurgeTask("0 2 * * 0", aspire.PurgeTaskFilter("app2:.*"), + aspire.PurgeTaskAgo(30*24*60*60*1000), + aspire.PurgeTaskKeep(10)) ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx index abe3c0538f..fba56e7b71 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-cosmos-db/azure-cosmos-db-host.mdx @@ -252,11 +252,9 @@ if err != nil { } cosmos := builder.AddAzureCosmosDB("cosmos-db"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureCosmosDBEmulatorResource) { - emulator.WithGatewayPort(aspire.IntPtr(7777)) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureCosmosDBEmulatorResource) { + emulator.WithGatewayPort(aspire.IntPtr(7777)) + })) // After adding all resources, run the app... ``` @@ -311,11 +309,9 @@ if err != nil { } cosmos := builder.AddAzureCosmosDB("cosmos-db"). - RunAsClassicEmulator(&aspire.RunAsClassicEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureCosmosDBEmulatorResource) { - emulator.WithPartitionCount(100) // Defaults to 25 - }, - }) + RunAsClassicEmulator(aspire.RunAsClassicEmulatorConfigureContainer(func(emulator aspire.AzureCosmosDBEmulatorResource) { + emulator.WithPartitionCount(100) // Defaults to 25 + })) // After adding all resources, run the app... ``` @@ -366,11 +362,9 @@ if err != nil { } cosmos := builder.AddAzureCosmosDB("cosmos-db"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureCosmosDBEmulatorResource) { - emulator.WithDataVolume() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureCosmosDBEmulatorResource) { + emulator.WithDataVolume() + })) // After adding all resources, run the app... ``` @@ -494,11 +488,9 @@ if err != nil { } cosmos := builder.AddAzureCosmosDB("cosmos-db"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureCosmosDBEmulatorResource) { - emulator.WithDataExplorer() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureCosmosDBEmulatorResource) { + emulator.WithDataExplorer() + })) // After adding all resources, run the app... ``` @@ -558,7 +550,7 @@ existingCosmosName := builder.AddParameter("existingCosmosName") existingCosmosRG := builder.AddParameter("existingCosmosResourceGroup") cosmos := builder.AddAzureCosmosDB("cosmos-db"). - AsExisting(existingCosmosName, &aspire.AsExistingOptions{ResourceGroup: existingCosmosRG}) + AsExisting(existingCosmosName, aspire.AsExistingResourceGroup(existingCosmosRG)) api := builder.AddGoApp("api", "./api"). WithReference(cosmos) diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx index bb7dc678d6..6cd153349d 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-data-explorer.mdx @@ -266,11 +266,9 @@ if err != nil { } kusto := builder.AddAzureKustoCluster("kusto"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureKustoEmulatorResource) { - emulator.WithHostPort(8080) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureKustoEmulatorResource) { + emulator.WithHostPort(8080) + })) // After adding all resources, run the app... ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx index a6bbf4e08d..983a2fa5f4 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-event-hubs/azure-event-hubs-host.mdx @@ -342,11 +342,9 @@ if err != nil { } eventHubs := builder.AddAzureEventHubs("event-hubs"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureEventHubsEmulatorResource) { - emulator.WithHostPort(aspire.IntPtr(7777)) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureEventHubsEmulatorResource) { + emulator.WithHostPort(aspire.IntPtr(7777)) + })) eventHubs.AddHub("messages") @@ -478,11 +476,9 @@ if err != nil { } eventHubs := builder.AddAzureEventHubs("event-hubs"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureEventHubsEmulatorResource) { - emulator.WithConfigurationFile("./messaging/custom-config.json") - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureEventHubsEmulatorResource) { + emulator.WithConfigurationFile("./messaging/custom-config.json") + })) eventHubs.AddHub("messages") diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx index 1762d16890..1ae6f602f1 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-key-vault/azure-key-vault-host.mdx @@ -229,7 +229,7 @@ existingKeyVaultName := builder.AddParameter("existingKeyVaultName") existingKeyVaultResourceGroup := builder.AddParameter("existingKeyVaultResourceGroup") keyVault := builder.AddAzureKeyVault("key-vault"). - AsExisting(existingKeyVaultName, &aspire.AsExistingOptions{ResourceGroup: existingKeyVaultResourceGroup}) + AsExisting(existingKeyVaultName, aspire.AsExistingResourceGroup(existingKeyVaultResourceGroup)) api := builder.AddGoApp("apiservice", "./api"). WithReference(keyVault) @@ -367,7 +367,7 @@ if err != nil { keyVault := builder.AddAzureKeyVault("key-vault") -apiKey := builder.AddParameter("api-key", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +apiKey := builder.AddParameter("api-key", aspire.AddParameterSecret(true)) keyVault.AddSecret("my-api-key", apiKey) app, err := builder.Build() @@ -441,7 +441,7 @@ existingKeyVaultName := builder.AddParameter("existingKeyVaultName") existingKeyVaultResourceGroup := builder.AddParameter("existingKeyVaultResourceGroup") keyVault := builder.AddAzureKeyVault("key-vault"). - AsExisting(existingKeyVaultName, &aspire.AsExistingOptions{ResourceGroup: existingKeyVaultResourceGroup}) + AsExisting(existingKeyVaultName, aspire.AsExistingResourceGroup(existingKeyVaultResourceGroup)) api := builder.AddGoApp("apiservice", "./api"). WithReference(keyVault). diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx index 1d111a06b1..2b14822b3e 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-openai/azure-openai-host.mdx @@ -405,7 +405,7 @@ existingOpenAIName := builder.AddParameter("existingOpenAIName") existingOpenAIResourceGroup := builder.AddParameter("existingOpenAIResourceGroup") openai := builder.AddAzureOpenAI("openai"). - AsExisting(existingOpenAIName, &aspire.AsExistingOptions{ResourceGroup: existingOpenAIResourceGroup}) + AsExisting(existingOpenAIName, aspire.AsExistingResourceGroup(existingOpenAIResourceGroup)) chat := openai.AddDeployment("chat", "gpt-4o", "2024-08-06") diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx index 087dfab6fc..698865c543 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-postgresql/azure-postgresql-host.mdx @@ -262,9 +262,7 @@ const postgresdb = await postgres.addDatabase("postgresdb", { databaseName: "app ```go title="apphost.go" -postgresdb := postgres.AddDatabase("postgresdb", &aspire.AddDatabaseOptions{ - DatabaseName: aspire.StringPtr("app_catalog"), -}) +postgresdb := postgres.AddDatabase("postgresdb", aspire.AddDatabaseDatabaseName("app_catalog")) ``` @@ -477,8 +475,8 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -username := builder.AddParameter("username", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +username := builder.AddParameter("username", aspire.AddParameterSecret(true)) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) postgres := builder.AddAzurePostgresFlexibleServer("postgres") postgres.WithPasswordAuthentication( diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx index cdcf31c696..4cdd37c66e 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-service-bus/azure-service-bus-host.mdx @@ -591,11 +591,9 @@ if err != nil { } serviceBus := builder.AddAzureServiceBus("messaging"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureServiceBusEmulatorResource) { - emulator.WithHostPort(aspire.IntPtr(7777)) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureServiceBusEmulatorResource) { + emulator.WithHostPort(aspire.IntPtr(7777)) + })) app, err := builder.Build() if err != nil { @@ -664,11 +662,9 @@ if err != nil { } serviceBus := builder.AddAzureServiceBus("messaging"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(emulator aspire.AzureServiceBusEmulatorResource) { - emulator.WithConfigurationFile("./messaging/custom-config.json") - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(emulator aspire.AzureServiceBusEmulatorResource) { + emulator.WithConfigurationFile("./messaging/custom-config.json") + })) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx index a5d3463c5c..5f73bf52d5 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-blobs/azure-storage-blobs-host.mdx @@ -265,9 +265,7 @@ if err != nil { } container := builder.AddAzureStorage("storage"). - AddBlobContainer("uploads", &aspire.AddBlobContainerOptions{ - BlobContainerName: aspire.StringPtr("upload-data"), - }) + AddBlobContainer("uploads", aspire.AddBlobContainerBlobContainerName("upload-data")) builder.AddGoApp("api", "./api"). WithReference(container). @@ -411,13 +409,11 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithBlobPort(27000). - WithQueuePort(27001). - WithTablePort(27002) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithBlobPort(27000). + WithQueuePort(27001). + WithTablePort(27002) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -475,11 +471,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithLifetime(aspire.ContainerLifetimePersistent) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithLifetime(aspire.ContainerLifetimePersistent) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -537,11 +531,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataVolume() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataVolume() + })) // After adding all resources, run the app... app, err := builder.Build() @@ -601,13 +593,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataBindMount(&aspire.WithDataBindMountOptions{ - Path: aspire.StringPtr("../azurite/data"), - }) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataBindMount(aspire.DataBindMountPath("../azurite/data")) + })) // After adding all resources, run the app... app, err := builder.Build() diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx index 0316f13da8..1515cd6457 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-datalake.mdx @@ -147,7 +147,7 @@ func main() { storage := builder.AddAzureStorage("storage") dataLake := storage.AddDataLake("datalake") - api := builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj"). + builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj"). WithReference(dataLake). WaitFor(dataLake) @@ -234,11 +234,9 @@ func main() { storage := builder.AddAzureStorage("storage") dataLake := storage.AddDataLake("datalake") dataLakeFileSystemName := "analytics-data" - fileSystem := storage.AddDataLakeFileSystem("analytics", &aspire.AddDataLakeFileSystemOptions{ - DataLakeFileSystemName: &dataLakeFileSystemName, - }) + fileSystem := storage.AddDataLakeFileSystem("analytics", aspire.AddDataLakeFileSystemDataLakeFileSystemName(dataLakeFileSystemName)) - api := builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj"). + builder.AddDotnetProject("api", "../ExampleProject/ExampleProject.csproj"). WithReference(dataLake). WithReference(fileSystem). WaitFor(dataLake) diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx index 585ef29e69..452f0b5ffe 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-queues/azure-storage-queues-host.mdx @@ -311,13 +311,11 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithBlobPort(27000). - WithQueuePort(27001). - WithTablePort(27002) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithBlobPort(27000). + WithQueuePort(27001). + WithTablePort(27002) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -389,11 +387,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithLifetime(aspire.ContainerLifetimePersistent) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithLifetime(aspire.ContainerLifetimePersistent) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -457,11 +453,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataVolume() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataVolume() + })) // After adding all resources, run the app... app, err := builder.Build() @@ -527,13 +521,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataBindMount(&aspire.WithDataBindMountOptions{ - Path: aspire.StringPtr("../azurite/data"), - }) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataBindMount(aspire.DataBindMountPath("../azurite/data")) + })) // After adding all resources, run the app... app, err := builder.Build() diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx index 12ba2c88b3..93bf04b410 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-storage-tables/azure-storage-tables-host.mdx @@ -307,13 +307,11 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithBlobPort(27000). - WithQueuePort(27001). - WithTablePort(27002) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithBlobPort(27000). + WithQueuePort(27001). + WithTablePort(27002) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -379,11 +377,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithLifetime(aspire.ContainerLifetimePersistent) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithLifetime(aspire.ContainerLifetimePersistent) + })) // After adding all resources, run the app... app, err := builder.Build() @@ -441,11 +437,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataVolume() - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataVolume() + })) // After adding all resources, run the app... app, err := builder.Build() @@ -505,13 +499,9 @@ if err != nil { } storage := builder.AddAzureStorage("storage"). - RunAsEmulator(&aspire.RunAsEmulatorOptions{ - ConfigureContainer: func(azurite aspire.AzureStorageEmulatorResource) { - azurite.WithDataBindMount(&aspire.WithDataBindMountOptions{ - Path: aspire.StringPtr("../azurite/data"), - }) - }, - }) + RunAsEmulator(aspire.RunAsEmulatorConfigureContainer(func(azurite aspire.AzureStorageEmulatorResource) { + azurite.WithDataBindMount(aspire.DataBindMountPath("../azurite/data")) + })) // After adding all resources, run the app... app, err := builder.Build() diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx index b2cb473cdd..663776ad05 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-virtual-network.mdx @@ -167,7 +167,7 @@ func main() { log.Fatal(aspire.FormatError(err)) } - vnet := builder.AddAzureVirtualNetwork("vnet") + builder.AddAzureVirtualNetwork("vnet") // After adding all resources, run the app... app, err := builder.Build() @@ -203,9 +203,7 @@ const vnet = await builder.addAzureVirtualNetwork('vnet', '10.1.0.0/16'); ```go title="apphost.go" -vnet := builder.AddAzureVirtualNetwork("vnet", &aspire.AddAzureVirtualNetworkOptions{ - AddressPrefix: "10.1.0.0/16", -}) +vnet := builder.AddAzureVirtualNetwork("vnet", aspire.AddAzureVirtualNetworkAddressPrefix("10.1.0.0/16")) ``` @@ -459,7 +457,7 @@ func main() { DestinationPortRange: "443", }) - subnet := vnet.AddSubnet("web-subnet", "10.0.1.0/24"). + vnet.AddSubnet("web-subnet", "10.0.1.0/24"). WithNetworkSecurityGroup(nsg) } @@ -766,7 +764,7 @@ func main() { log.Fatal(aspire.FormatError(err)) } - nsp := builder.AddNetworkSecurityPerimeter("my-nsp") + builder.AddNetworkSecurityPerimeter("my-nsp") // After adding all resources, run the app... app, err := builder.Build() diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx index 793f68c1d0..12cdaf3ebf 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/azure-web-pubsub/azure-web-pubsub-host.mdx @@ -195,9 +195,7 @@ if err != nil { } webPubSub := builder.AddAzureWebPubSub("web-pubsub") -messagesHub := webPubSub.AddHub("messages", &aspire.AddHubOptions{ - HubName: aspire.StringPtr("messageHub"), -}) +messagesHub := webPubSub.AddHub("messages", aspire.AddHubHubName("messageHub")) // After adding all resources, run the app... ``` @@ -261,13 +259,9 @@ worker := builder.AddGoApp("worker", "./worker"). workerEndpoint := worker.GetEndpoint("https") webPubSub := builder.AddAzureWebPubSub("web-pubsub") -messagesHub := webPubSub.AddHub("messages", &aspire.AddHubOptions{ - HubName: aspire.StringPtr("messageHub"), -}) +messagesHub := webPubSub.AddHub("messages", aspire.AddHubHubName("messageHub")) -messagesHub.AddEventHandler(aspire.RefExpr("{0}", workerEndpoint), &aspire.AddEventHandlerOptions{ - SystemEvents: []string{"connected"}, -}) +messagesHub.AddEventHandler(aspire.RefExpr("{0}", workerEndpoint), aspire.AddEventHandlerSystemEvents([]string{"connected"})) // After adding all resources, run the app... ``` diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx index 1a84154b37..d5b8088186 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx @@ -1084,7 +1084,7 @@ func main() { } secret := true - adminPassword := builder.AddParameter("adminPassword", &aspire.AddParameterOptions{Secret: &secret}) + adminPassword := builder.AddParameter("adminPassword", aspire.AddParameterSecret(secret)) sql := builder.AddBicepTemplate("sql", "./custom-sql.bicep") sql.WithParameter("administratorLoginPassword", aspire.ParameterValue(adminPassword)) diff --git a/src/frontend/src/content/docs/integrations/compute/docker.mdx b/src/frontend/src/content/docs/integrations/compute/docker.mdx index a06fc637b6..397bdef2a4 100644 --- a/src/frontend/src/content/docs/integrations/compute/docker.mdx +++ b/src/frontend/src/content/docs/integrations/compute/docker.mdx @@ -378,11 +378,11 @@ if err != nil { compose := builder.AddDockerComposeEnvironment("compose") compose.ConfigureDashboard(func(dashboard aspire.DockerComposeAspireDashboardResource) { - dashboard.WithHostPort(&aspire.WithHostPortOptions{Port: aspire.IntPtr(8080)}) - dashboard.WithForwardedHeaders(&aspire.WithForwardedHeadersOptions{Enabled: aspire.BoolPtr(true)}) + dashboard.WithHostPort(aspire.HostPortPort(8080)) + dashboard.WithForwardedHeaders(aspire.ForwardedHeadersEnabled(true)) }) -compose.WithDashboard(&aspire.WithDashboardOptions{Enabled: aspire.BoolPtr(false)}) +compose.WithDashboard(aspire.DashboardEnabled(false)) ``` @@ -434,7 +434,7 @@ if err != nil { compose := builder.AddDockerComposeEnvironment("compose") api := builder.AddContainer("api", "nginx:alpine") -api.WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Name: aspire.StringPtr("http"), TargetPort: aspire.IntPtr(80)}) +api.WithHttpEndpoint(aspire.HttpEndpointName("http"), aspire.HttpEndpointTargetPort(80)) apiEndpoint := api.GetEndpoint("http") apiHost := compose.GetHostAddressExpression(apiEndpoint) @@ -666,17 +666,17 @@ if err != nil { builder.AddDockerfileBuilder("frontend", "../frontend", func(context aspire.DockerfileBuilderCallbackContext) { dockerfile := context.Builder() - dockerfile.From("node:22-alpine", &aspire.FromOptions{StageName: aspire.StringPtr("build")}). + dockerfile.From("node:22-alpine", aspire.FromStageName("build")). WorkDir("/app"). Copy("package*.json", "./"). Run("npm ci"). Copy(".", "."). Run("npm run build") - dockerfile.From("nginx:alpine", &aspire.FromOptions{StageName: aspire.StringPtr("runtime")}). + dockerfile.From("nginx:alpine", aspire.FromStageName("runtime")). CopyFrom("build", "/app/dist", "/usr/share/nginx/html"). Expose(80) -}, &aspire.AddDockerfileBuilderOptions{Stage: aspire.StringPtr("runtime")}) +}, aspire.AddDockerfileBuilderStage("runtime")) ``` @@ -1051,9 +1051,7 @@ if err != nil { } // Add a container registry -registry := builder.AddContainerRegistry("ghcr", "ghcr.io", &aspire.AddContainerRegistryOptions{ - Repository: aspire.StringPtr("your-github-username/your-repo"), -}) +registry := builder.AddContainerRegistry("ghcr", "ghcr.io", aspire.AddContainerRegistryRepository("your-github-username/your-repo")) // Associate resources with the registry api := builder.AddDotnetProject("api", "../Api/Api.csproj") @@ -1136,9 +1134,7 @@ registryEndpoint := builder.AddParameterFromConfiguration("registryEndpoint", "R registryRepository := builder.AddParameterFromConfiguration("registryRepository", "REGISTRY_REPOSITORY") // Add registry with parameters -registry := builder.AddContainerRegistry("my-registry", registryEndpoint, &aspire.AddContainerRegistryOptions{ - Repository: registryRepository, -}) +registry := builder.AddContainerRegistry("my-registry", registryEndpoint, aspire.AddContainerRegistryRepository(registryRepository)) api := builder.AddDotnetProject("api", "../Api/Api.csproj") api.PublishAsDockerComposeService(func(resource aspire.DockerComposeServiceResource, service aspire.Service) { diff --git a/src/frontend/src/content/docs/integrations/compute/floci.mdx b/src/frontend/src/content/docs/integrations/compute/floci.mdx index 122b50ac53..8cacd7cdb5 100644 --- a/src/frontend/src/content/docs/integrations/compute/floci.mdx +++ b/src/frontend/src/content/docs/integrations/compute/floci.mdx @@ -234,9 +234,7 @@ await api.withFlociGcpReference(gcp).waitFor(gcp); ```go title="apphost.go" -gcp := builder.AddFlociGcp("floci-gcp", &aspire.AddFlociGcpOptions{ - DefaultProjectId: aspire.StringPtr("my-project"), -}) +gcp := builder.AddFlociGcp("floci-gcp", aspire.AddFlociGcpDefaultProjectId("my-project")) api := builder.AddDotnetProject("api", "../Api/Api.csproj") api.WithFlociGcpReference(gcp).WaitFor(gcp) @@ -285,10 +283,8 @@ const aws = await builder.addFlociAws('floci-aws', { ```go title="apphost.go" -aws := builder.AddFlociAws("floci-aws", &aspire.AddFlociAwsOptions{ - DefaultRegion: aspire.StringPtr("eu-west-1"), - DefaultAccountId: aspire.StringPtr("123456789012"), -}) +aws := builder.AddFlociAws("floci-aws", aspire.AddFlociAwsDefaultRegion("eu-west-1"), + aspire.AddFlociAwsDefaultAccountId("123456789012")) ``` @@ -322,9 +318,7 @@ const gcp = await builder.addFlociGcp('floci-gcp', { ```go title="apphost.go" -gcp := builder.AddFlociGcp("floci-gcp", &aspire.AddFlociGcpOptions{ - DefaultProjectId: aspire.StringPtr("my-project"), -}) +gcp := builder.AddFlociGcp("floci-gcp", aspire.AddFlociGcpDefaultProjectId("my-project")) ``` @@ -408,9 +402,7 @@ await aws.withDockerSocket({ socketPath: '/run/user/1000/podman/podman.sock' }); ```go title="apphost.go" aws := builder.AddFlociAws("floci-aws") -aws.WithDockerSocket(&aspire.WithDockerSocketOptions{ - SocketPath: aspire.StringPtr("/run/user/1000/podman/podman.sock"), -}) +aws.WithDockerSocket(aspire.DockerSocketSocketPath("/run/user/1000/podman/podman.sock")) ``` @@ -630,12 +622,10 @@ await floci.withFlociUI({ ```go title="apphost.go" floci := builder.AddFlociAws("floci") -floci.WithFlociUI(&aspire.WithFlociUIOptions{ - ContainerName: aspire.StringPtr("my-floci-ui"), - ConfigureContainer: func(ui aspire.FlociUIContainerResource) { +floci.WithFlociUI(aspire.FlociUIContainerName("my-floci-ui"), + aspire.FlociUIConfigureContainer(func(ui aspire.FlociUIContainerResource) { ui.WithHostPort(aspire.IntPtr(14500)) - }, -}) + })) ``` @@ -694,12 +684,10 @@ aws := builder.AddFlociAws("floci-aws") azure := builder.AddFlociAzure("floci-az") gcp := builder.AddFlociGcp("floci-gcp") -aws.WithFlociUI(&aspire.WithFlociUIOptions{ - ConfigureContainer: func(ui aspire.FlociUIContainerResource) { - ui.WithAzureReference(azure) - ui.WithGcpReference(gcp) - }, -}) +aws.WithFlociUI(aspire.FlociUIConfigureContainer(func(ui aspire.FlociUIContainerResource) { + ui.WithAzureReference(azure) + ui.WithGcpReference(gcp) +})) ``` diff --git a/src/frontend/src/content/docs/integrations/compute/k3s.mdx b/src/frontend/src/content/docs/integrations/compute/k3s.mdx index ff7c04a3c1..3fd96ddef8 100644 --- a/src/frontend/src/content/docs/integrations/compute/k3s.mdx +++ b/src/frontend/src/content/docs/integrations/compute/k3s.mdx @@ -257,18 +257,16 @@ const cluster = await builder ```go title="apphost.go" -cluster := builder.AddK3sCluster("k8s", &aspire.AddK3sClusterOptions{ - ApiServerPort: aspire.IntPtr(16443), - AgentCount: aspire.IntPtr(2), -}). +cluster := builder.AddK3sCluster("k8s", aspire.AddK3sClusterApiServerPort(16443), + aspire.AddK3sClusterAgentCount(2)). WithK3sVersion("v1.32.3-k3s1"). WithPodSubnet("10.42.0.0/16"). WithServiceSubnet("10.43.0.0/16"). WithDisabledComponent("traefik"). WithExtraArg("--write-kubeconfig-mode=644"). - WithDataVolume(&aspire.WithDataVolumeOptions{Name: aspire.StringPtr("k8s-data")}). - WithHelmImage(&aspire.WithHelmImageOptions{Tag: aspire.StringPtr("3.18.0")}). - WithKubectlImage(&aspire.WithKubectlImageOptions{Tag: aspire.StringPtr("1.37.0")}). + WithDataVolume(aspire.DataVolumeName("k8s-data")). + WithHelmImage(aspire.HelmImageTag("3.18.0")). + WithKubectlImage(aspire.KubectlImageTag("1.37.0")). WithLifetime(aspire.ContainerLifetimePersistent) ``` @@ -316,7 +314,7 @@ const cluster = await builder.addK3sCluster('k8s') ```go title="apphost.go" cluster := builder.AddK3sCluster("k8s"). - WithDataVolume(&aspire.WithDataVolumeOptions{Name: aspire.StringPtr("k8s-data")}). + WithDataVolume(aspire.DataVolumeName("k8s-data")). WithLifetime(aspire.ContainerLifetimePersistent) ``` @@ -372,11 +370,9 @@ await operator.withReference(cluster); ```go title="apphost.go" -podinfo := cluster.AddHelmRelease("podinfo", "podinfo", &aspire.AddHelmReleaseOptions{ - Repo: aspire.StringPtr("https://stefanprodan.github.io/podinfo"), - Version: aspire.StringPtr("6.7.1"), - Namespace: aspire.StringPtr("podinfo"), -}). +podinfo := cluster.AddHelmRelease("podinfo", "podinfo", aspire.AddHelmReleaseRepo("https://stefanprodan.github.io/podinfo"), + aspire.AddHelmReleaseVersion("6.7.1"), + aspire.AddHelmReleaseNamespace("podinfo")). WithHelmValue("replicaCount", "2"). WithHelmValuesFile("./deploy/podinfo-values.yaml") @@ -499,9 +495,7 @@ await builder ```go title="apphost.go" -podinfoWeb := cluster.AddServiceEndpoint("podinfo-web", "podinfo", 9898, &aspire.AddServiceEndpointOptions{ - Namespace: aspire.StringPtr("podinfo"), -}) +podinfoWeb := cluster.AddServiceEndpoint("podinfo-web", "podinfo", 9898, aspire.AddServiceEndpointNamespace("podinfo")) podinfoWeb.WaitForCompletion(podinfo) // Host processes receive http://localhost:{port} diff --git a/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx b/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx index c1d02b360f..b2fd3223b5 100644 --- a/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx +++ b/src/frontend/src/content/docs/integrations/compute/kubernetes.mdx @@ -151,7 +151,7 @@ func main() { builder.AddKubernetesEnvironment("k8s") builder.AddNodeApp("api", "./api", "src/index.ts"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")). WithExternalHttpEndpoints() app, err := builder.Build() @@ -241,15 +241,13 @@ await k8s.withHelm(async (helm) => { ```go title="apphost.go" k8s := builder.AddKubernetesEnvironment("k8s") -k8s.WithHelm(&aspire.WithHelmOptions{ - Configure: func(helm aspire.HelmChartOptions) { - helm.WithNamespace("my-namespace") - helm.WithReleaseName("my-release") - helm.WithChartName("my-aspire-app") - helm.WithChartVersion("1.0.0") - helm.WithChartDescription("My Aspire application deployed to Kubernetes") - }, -}) +k8s.WithHelm(aspire.HelmConfigure(func(helm aspire.HelmChartOptions) { + helm.WithNamespace("my-namespace") + helm.WithReleaseName("my-release") + helm.WithChartName("my-aspire-app") + helm.WithChartVersion("1.0.0") + helm.WithChartDescription("My Aspire application deployed to Kubernetes") +})) ``` @@ -351,7 +349,7 @@ pgData.WithStorageClass("managed-csi") pgData.WithCapacity("20Gi") pg := builder.AddPostgres("pg") -pg.WithDataVolume(&aspire.WithDataVolumeOptions{Name: aspire.StringPtr("pg-data")}) +pg.WithDataVolume(aspire.DataVolumeName("pg-data")) pg.WithKubernetesPersistentVolume(pgData) ``` @@ -580,15 +578,13 @@ await service.publishAsKubernetesService(async (resource) => { ```go title="apphost.go" service := builder.AddContainer("service", "nginx") service.PublishAsKubernetesService(func(resource aspire.KubernetesResource) { - resource.AddManifest("cert-manager.io/v1", "Certificate", "service-tls", &aspire.AddManifestOptions{ - Configure: func(manifest aspire.KubernetesManifestResource) { - manifest.WithLabel("example.com/managed-by", "aspire") - manifest.WithField("spec.secretName", "service-tls") - manifest.WithField("spec.dnsNames", []string{"service.example.com"}) - manifest.WithField("spec.issuerRef.name", "letsencrypt-prod") - manifest.WithField("spec.issuerRef.kind", "ClusterIssuer") - }, - }) + resource.AddManifest("cert-manager.io/v1", "Certificate", "service-tls", aspire.AddManifestConfigure(func(manifest aspire.KubernetesManifestResource) { + manifest.WithLabel("example.com/managed-by", "aspire") + manifest.WithField("spec.secretName", "service-tls") + manifest.WithField("spec.dnsNames", []string{"service.example.com"}) + manifest.WithField("spec.issuerRef.name", "letsencrypt-prod") + manifest.WithField("spec.issuerRef.kind", "ClusterIssuer") + })) }) ``` diff --git a/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx b/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx index f62a5e5c5e..3ae4aca15f 100644 --- a/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/efcore/azure-sql/azure-sql-host.mdx @@ -248,7 +248,7 @@ func main() { existingResourceGroup := builder.AddParameter("existingSqlServerResourceGroup") sql := builder.AddAzureSqlServer("sql") - sql.AsExisting(existingName, &aspire.AsExistingOptions{ResourceGroup: existingResourceGroup}) + sql.AsExisting(existingName, aspire.AsExistingResourceGroup(existingResourceGroup)) db := sql.AddDatabase("database") api := builder.AddNodeApp("api", "./api", "index.js") diff --git a/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx b/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx index aa8d595e70..bff8df8406 100644 --- a/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/meilisearch/meilisearch-host.mdx @@ -390,9 +390,9 @@ func main() { log.Fatal(aspire.FormatError(err)) } - masterKey := builder.AddParameter("masterKey", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) + masterKey := builder.AddParameter("masterKey", aspire.AddParameterSecret(true)) - meilisearch := builder.AddMeilisearch("meilisearch", &aspire.AddMeilisearchOptions{MasterKey: &masterKey}) + meilisearch := builder.AddMeilisearch("meilisearch", aspire.AddMeilisearchMasterKey(masterKey)) exampleProject := builder.AddDotnetProject("apiservice", "../ExampleProject/ExampleProject.csproj") exampleProject.WithReference(meilisearch) diff --git a/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx b/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx index 0a61118f74..c44530928b 100644 --- a/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/milvus/milvus-host.mdx @@ -247,9 +247,9 @@ func main() { log.Fatal(aspire.FormatError(err)) } - apiKey := builder.AddParameter("apiKey", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) + apiKey := builder.AddParameter("apiKey", aspire.AddParameterSecret(true)) - milvus := builder.AddMilvus("milvus", &aspire.AddMilvusOptions{ApiKey: &apiKey}) + milvus := builder.AddMilvus("milvus", aspire.AddMilvusApiKey(apiKey)) milvus.WithLifetime(aspire.ContainerLifetimePersistent) milvusdb := milvus.AddDatabase("milvusdb") diff --git a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx index 4ea6635188..c2014d3efb 100644 --- a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-extensions.mdx @@ -154,10 +154,8 @@ if err != nil { } builder.AddMongoDB("mongodb"). - WithDbx(&aspire.WithDbxOptions{ - ContainerName: aspire.StringPtr("mongodb-dbx"), - ImageTag: aspire.StringPtr("0.5.33"), - }) + WithDbx(aspire.DbxContainerName("mongodb-dbx"), + aspire.DbxImageTag("0.5.33")) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx index 12a0bfc458..105348ca5c 100644 --- a/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mongodb/mongodb-host.mdx @@ -288,7 +288,7 @@ if err != nil { mode := aspire.MongoDBTlsModePreferTls builder.AddMongoDB("mongo"). - WithTlsMode(&aspire.WithTlsModeOptions{Mode: &mode}) + WithTlsMode(aspire.TlsModeMode(mode)) app, err := builder.Build() if err != nil { @@ -383,12 +383,10 @@ if err != nil { } userName := builder.AddParameter("username") -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -mongo := builder.AddMongoDB("mongo", &aspire.AddMongoDBOptions{ - UserName: &userName, - Password: &password, -}) +mongo := builder.AddMongoDB("mongo", aspire.AddMongoDBUserName(userName), + aspire.AddMongoDBPassword(password)) mongodb := mongo.AddDatabase("mongodb") builder.AddGoApp("api", "./api"). @@ -426,7 +424,7 @@ const mongo = await builder.addMongoDB("mongo", { port: 27017 }); ```go title="apphost.go" -mongo := builder.AddMongoDB("mongo", &aspire.AddMongoDBOptions{Port: aspire.IntPtr(27017)}) +mongo := builder.AddMongoDB("mongo", aspire.AddMongoDBPort(27017)) ``` @@ -726,7 +724,7 @@ const mongo = await builder.addMongoDB("mongo").withReplicaSet({ name: "app-rs" ```go title="apphost.go" mongo := builder.AddMongoDB("mongo"). - WithReplicaSet(&aspire.WithReplicaSetOptions{Name: aspire.StringPtr("app-rs")}) + WithReplicaSet(aspire.ReplicaSetName("app-rs")) ``` @@ -758,7 +756,7 @@ const mongo = await builder.addMongoDB("mongo") ```go title="apphost.go" -keyfile := builder.AddParameter("mongo-keyfile", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +keyfile := builder.AddParameter("mongo-keyfile", aspire.AddParameterSecret(true)) mongo := builder.AddMongoDB("mongo"). WithKeyFile(keyfile). @@ -891,11 +889,9 @@ if err != nil { } mongo := builder.AddMongoDB("mongo"). - WithMongoExpress(&aspire.WithMongoExpressOptions{ - ConfigureContainer: func(c aspire.MongoExpressContainerResource) { - c.WithHostPort(aspire.IntPtr(8081)) - }, - }). + WithMongoExpress(aspire.MongoExpressConfigureContainer(func(c aspire.MongoExpressContainerResource) { + c.WithHostPort(aspire.IntPtr(8081)) + })). WithLifetime(aspire.ContainerLifetimePersistent) // After adding all resources, run the app... diff --git a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx index 29af91e9a1..1ff645ffe4 100644 --- a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-extensions.mdx @@ -286,10 +286,8 @@ if err != nil { } builder.AddMySql("mysql"). - WithDbx(&aspire.WithDbxOptions{ - ContainerName: aspire.StringPtr("mysql-dbx"), - ImageTag: aspire.StringPtr("0.5.33"), - }) + WithDbx(aspire.DbxContainerName("mysql-dbx"), + aspire.DbxImageTag("0.5.33")) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx index 89749eb00e..5cd5f3fce7 100644 --- a/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/mysql/mysql-host.mdx @@ -380,12 +380,10 @@ if err != nil { } mysql := builder.AddMySql("mysql"). - WithPhpMyAdmin(&aspire.WithPhpMyAdminOptions{ - ContainerName: aspire.StringPtr("phpmyadmin"), - ConfigureContainer: func(phpMyAdmin aspire.PhpMyAdminContainerResource) { + WithPhpMyAdmin(aspire.PhpMyAdminContainerName("phpmyadmin"), + aspire.PhpMyAdminConfigureContainer(func(phpMyAdmin aspire.PhpMyAdminContainerResource) { phpMyAdmin.WithHostPort(aspire.IntPtr(8080)) - }, - }) + })) mysqldb := mysql.AddDatabase("mysqldb") @@ -445,7 +443,7 @@ if err != nil { } mysql := builder.AddMySql("mysql"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) mysqldb := mysql.AddDatabase("mysqldb") @@ -519,7 +517,7 @@ if err != nil { } mysql := builder.AddMySql("mysql"). - WithDataBindMount("/MySQL/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/MySQL/Data", aspire.DataBindMountIsReadOnly(false)) mysqldb := mysql.AddDatabase("mysqldb") @@ -648,12 +646,10 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -mysql := builder.AddMySql("mysql", &aspire.AddMySqlOptions{ - Password: &password, - Port: aspire.IntPtr(3306), -}) +mysql := builder.AddMySql("mysql", aspire.AddMySqlPassword(password), + aspire.AddMySqlPort(3306)) mysqldb := mysql.AddDatabase("mysqldb") builder.AddGoApp("api", "./api"). diff --git a/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx b/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx index e908943571..7837581264 100644 --- a/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/postgres/postgres-host.mdx @@ -366,11 +366,9 @@ if err != nil { } postgres := builder.AddPostgres("postgres"). - WithPgAdmin(&aspire.WithPgAdminOptions{ - ConfigureContainer: func(pgAdmin aspire.PgAdminContainerResource) { - pgAdmin.WithHostPort(aspire.IntPtr(5050)) - }, - }) + WithPgAdmin(aspire.PgAdminConfigureContainer(func(pgAdmin aspire.PgAdminContainerResource) { + pgAdmin.WithHostPort(aspire.IntPtr(5050)) + })) postgresdb := postgres.AddDatabase("postgresdb") @@ -494,11 +492,9 @@ if err != nil { } postgres := builder.AddPostgres("postgres"). - WithPgWeb(&aspire.WithPgWebOptions{ - ConfigureContainer: func(pgWeb aspire.PgWebContainerResource) { - pgWeb.WithHostPort(aspire.IntPtr(5050)) - }, - }) + WithPgWeb(aspire.PgWebConfigureContainer(func(pgWeb aspire.PgWebContainerResource) { + pgWeb.WithHostPort(aspire.IntPtr(5050)) + })) postgresdb := postgres.AddDatabase("postgresdb") @@ -557,7 +553,7 @@ if err != nil { } postgres := builder.AddPostgres("postgres"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) postgresdb := postgres.AddDatabase("postgresdb") @@ -628,7 +624,7 @@ if err != nil { } postgres := builder.AddPostgres("postgres"). - WithDataBindMount("/PostgreSQL/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/PostgreSQL/Data", aspire.DataBindMountIsReadOnly(false)) postgresdb := postgres.AddDatabase("postgresdb") @@ -754,13 +750,11 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -userName := builder.AddParameter("username", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +userName := builder.AddParameter("username", aspire.AddParameterSecret(true)) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -postgres := builder.AddPostgres("postgres", &aspire.AddPostgresOptions{ - UserName: &userName, - Password: &password, -}) +postgres := builder.AddPostgres("postgres", aspire.AddPostgresUserName(userName), + aspire.AddPostgresPassword(password)) postgresdb := postgres.AddDatabase("postgresdb") builder.AddGoApp("api", "./api"). diff --git a/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx index 1baf0965ac..5e2f5b2277 100644 --- a/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/postgres/postgresql-extensions.mdx @@ -278,10 +278,8 @@ if err != nil { } builder.AddPostgres("postgres"). - WithDbx(&aspire.WithDbxOptions{ - ContainerName: aspire.StringPtr("postgres-dbx"), - ImageTag: aspire.StringPtr("0.5.33"), - }) + WithDbx(aspire.DbxContainerName("postgres-dbx"), + aspire.DbxImageTag("0.5.33")) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx b/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx index 03a721b000..18c5e4b496 100644 --- a/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/qdrant/qdrant-host.mdx @@ -213,9 +213,9 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -apiKey := builder.AddParameter("apiKey", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +apiKey := builder.AddParameter("apiKey", aspire.AddParameterSecret(true)) -qdrant := builder.AddQdrant("qdrant", &aspire.AddQdrantOptions{ApiKey: &apiKey}). +qdrant := builder.AddQdrant("qdrant", aspire.AddQdrantApiKey(apiKey)). WithLifetime(aspire.ContainerLifetimePersistent) builder.AddGoApp("api", "./api"). diff --git a/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx b/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx index edc7d641e4..e9c701a892 100644 --- a/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/ravendb/ravendb-host.mdx @@ -232,7 +232,7 @@ if err != nil { } ravenServer := builder.AddRavenDB("ravenServer") -ravendb := ravenServer.AddDatabase("ravendb", &aspire.AddDatabaseOptions{EnsureCreated: aspire.BoolPtr(true)}) +ravendb := ravenServer.AddDatabase("ravendb", aspire.AddDatabaseEnsureCreated(true)) builder.AddGoApp("apiservice", "./api"). WithReference(ravendb). diff --git a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx index 31a69a4504..3ab421ee1b 100644 --- a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-extensions.mdx @@ -286,10 +286,8 @@ if err != nil { } builder.AddSqlServer("sqlserver"). - WithDbx(&aspire.WithDbxOptions{ - ContainerName: aspire.StringPtr("sqlserver-dbx"), - ImageTag: aspire.StringPtr("0.5.33"), - }) + WithDbx(aspire.DbxContainerName("sqlserver-dbx"), + aspire.DbxImageTag("0.5.33")) app, err := builder.Build() if err != nil { diff --git a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx index 84c2bc2fe2..a48857ed4f 100644 --- a/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sql-server/sql-server-host.mdx @@ -518,9 +518,9 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -sql := builder.AddSqlServer("sql", &aspire.AddSqlServerOptions{Password: &password}) +sql := builder.AddSqlServer("sql", aspire.AddSqlServerPassword(password)) db := sql.AddDatabase("database") builder.AddGoApp("api", "./api"). diff --git a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx index fb3883db99..f6ecd5bade 100644 --- a/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/sqlite/sqlite-host.mdx @@ -218,10 +218,8 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -sqlite := builder.AddSqlite("sqlite", &aspire.AddSqliteOptions{ - DatabasePath: aspire.StringPtr(`C:\Database\Location`), - DatabaseFileName: aspire.StringPtr("my-database.db"), -}) +sqlite := builder.AddSqlite("sqlite", aspire.AddSqliteDatabasePath(`C:\Database\Location`), + aspire.AddSqliteDatabaseFileName("my-database.db")) builder.AddGoApp("apiservice", "./api"). WithReference(sqlite) diff --git a/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx b/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx index 44ee1c2a38..b3ce44da30 100644 --- a/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx +++ b/src/frontend/src/content/docs/integrations/databases/surrealdb/surrealdb-host.mdx @@ -383,9 +383,9 @@ if err != nil { log.Fatal(aspire.FormatError(err)) } -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -surreal := builder.AddSurrealServer("surreal", &aspire.AddSurrealServerOptions{Password: &password}) +surreal := builder.AddSurrealServer("surreal", aspire.AddSurrealServerPassword(password)) ns := surreal.AddNamespace("ns") db := ns.AddDatabase("db") diff --git a/src/frontend/src/content/docs/integrations/devtools/browser-logs.mdx b/src/frontend/src/content/docs/integrations/devtools/browser-logs.mdx index 96554be15a..ed253fdfe3 100644 --- a/src/frontend/src/content/docs/integrations/devtools/browser-logs.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/browser-logs.mdx @@ -192,10 +192,8 @@ builder.addViteApp("web", "../web") isolated := aspire.BrowserUserDataModeIsolated builder.AddViteApp("web", "../web"). - WithBrowserLogs(&aspire.WithBrowserLogsOptions{ - Browser: aspire.StringPtr("msedge"), - UserDataMode: &isolated, - }) + WithBrowserLogs(aspire.BrowserLogsBrowser("msedge"), + aspire.BrowserLogsUserDataMode(isolated)) ``` diff --git a/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx b/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx index ede719a1be..c36ca447c5 100644 --- a/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx +++ b/src/frontend/src/content/docs/integrations/devtools/dev-tunnels.mdx @@ -129,7 +129,7 @@ if err != nil { } web := builder.AddNodeApp("web", "../web", "index.js"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) tunnel := builder.AddDevTunnel("my-tunnel"). WithTunnelReferenceAll(web, false) @@ -176,7 +176,7 @@ if err != nil { } web := builder.AddNodeApp("web", "../web", "index.js"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) tunnel := builder.AddDevTunnel("public-api"). WithTunnelReferenceAll(web, true). @@ -227,14 +227,12 @@ if err != nil { } web := builder.AddNodeApp("web", "../web", "index.js"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) - -tunnel := builder.AddDevTunnel("qa", &aspire.AddDevTunnelOptions{ - TunnelId: aspire.StringPtr("my-tunnel-id"), - AllowAnonymous: aspire.BoolPtr(false), - Description: aspire.StringPtr("QA environment tunnel"), - Labels: []string{"qa", "testing"}, -}). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) + +tunnel := builder.AddDevTunnel("qa", aspire.AddDevTunnelTunnelId("my-tunnel-id"), + aspire.AddDevTunnelAllowAnonymous(false), + aspire.AddDevTunnelDescription("QA environment tunnel"), + aspire.AddDevTunnelLabels([]string{"qa", "testing"})). WithTunnelReferenceAll(web, false) ``` @@ -277,8 +275,8 @@ if err != nil { } api := builder.AddNodeApp("api", "../api", "index.js"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Name: aspire.StringPtr("public"), Env: aspire.StringPtr("PUBLIC_PORT")}). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Name: aspire.StringPtr("admin"), Env: aspire.StringPtr("ADMIN_PORT")}) + WithHttpEndpoint(aspire.HttpEndpointName("public"), aspire.HttpEndpointEnv("PUBLIC_PORT")). + WithHttpEndpoint(aspire.HttpEndpointName("admin"), aspire.HttpEndpointEnv("ADMIN_PORT")) tunnel := builder.AddDevTunnel("mixed-access"). WithTunnelReferenceAnonymous(api.GetEndpoint("public"), true). diff --git a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx index 1c2c999034..dc94a4ec12 100644 --- a/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx +++ b/src/frontend/src/content/docs/integrations/dotnet/project-resources.mdx @@ -224,9 +224,7 @@ await builder.build().run(); ```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", &aspire.AddDotnetProjectOptions{ - Options: &aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")}, -}) +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")})) ``` @@ -279,8 +277,8 @@ await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend ```go title="apphost.go" builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Port: aspire.IntPtr(5066)}). - WithHttpsEndpoint(&aspire.WithHttpsEndpointOptions{Port: aspire.IntPtr(7239)}) + WithHttpEndpoint(aspire.HttpEndpointPort(5066)). + WithHttpsEndpoint(aspire.HttpsEndpointPort(7239)) ``` @@ -341,12 +339,10 @@ await builder.build().run(); In a Go AppHost, pass `ExcludeLaunchProfile` and `ExcludeKestrelEndpoints` through `DotnetProjectOptions`: ```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", &aspire.AddDotnetProjectOptions{ - Options: &aspire.DotnetProjectOptions{ - ExcludeLaunchProfile: aspire.BoolPtr(true), - ExcludeKestrelEndpoints: aspire.BoolPtr(false), - }, -}). +builder.AddDotnetProject("inventoryservice", "../InventoryService/InventoryService.csproj", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{ + ExcludeLaunchProfile: aspire.BoolPtr(true), + ExcludeKestrelEndpoints: aspire.BoolPtr(false), +})). WithHttpsEndpoint() ``` @@ -413,7 +409,7 @@ await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend ```go title="apphost.go" builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Port: aspire.IntPtr(5066)}). + WithHttpEndpoint(aspire.HttpEndpointPort(5066)). WithReplicas(2) ``` @@ -451,7 +447,7 @@ await builder.addProject("frontend", "../Networking_Frontend/Networking_Frontend ```go title="apphost.go" builder.AddDotnetProject("frontend", "../Networking_Frontend/Networking_Frontend.csproj"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Port: aspire.IntPtr(5066)}) + WithHttpEndpoint(aspire.HttpEndpointPort(5066)) ``` @@ -532,10 +528,8 @@ await builder.build().run(); ```go title="apphost.go" builder.AddDotnetProject("apiservice", "../Networking.ApiService/Networking.ApiService.csproj"). WithHttpsEndpoint(). - WithHttpsEndpoint(&aspire.WithHttpsEndpointOptions{ - Port: aspire.IntPtr(19227), - Name: aspire.StringPtr("admin"), - }). + WithHttpsEndpoint(aspire.HttpsEndpointPort(19227), + aspire.HttpsEndpointName("admin")). WithEndpointsInEnvironment([]string{"https"}) // include only "https"; "admin" is excluded ``` diff --git a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx index 531f1e22b2..f150160d23 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/dotnet/dotnet-host.mdx @@ -160,7 +160,7 @@ if err != nil { } api := builder.AddDotnetProject("api", "../api/api.csproj") -api.WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Port: aspire.IntPtr(8080)}) +api.WithHttpEndpoint(aspire.HttpEndpointPort(8080)) api.WithExternalHttpEndpoints() app, err := builder.Build() @@ -249,9 +249,7 @@ await builder.build().run(); ```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", &aspire.AddDotnetProjectOptions{ - Options: &aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")}, -}) +builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{LaunchProfileName: aspire.StringPtr("https")})) ``` @@ -298,13 +296,11 @@ await builder.build().run(); ```go title="apphost.go" -builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", &aspire.AddDotnetProjectOptions{ - Options: &aspire.DotnetProjectOptions{ - LaunchProfileName: aspire.StringPtr("https"), - ExcludeLaunchProfile: aspire.BoolPtr(false), - ExcludeKestrelEndpoints: aspire.BoolPtr(false), - }, -}) +builder.AddDotnetProject("inventoryservice", "../InventoryService.cs", aspire.AddDotnetProjectOptionsValue(&aspire.DotnetProjectOptions{ + LaunchProfileName: aspire.StringPtr("https"), + ExcludeLaunchProfile: aspire.BoolPtr(false), + ExcludeKestrelEndpoints: aspire.BoolPtr(false), +})) ``` diff --git a/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx b/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx index d05390868d..20ce7cb7ec 100644 --- a/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx +++ b/src/frontend/src/content/docs/integrations/frameworks/go/go-host.mdx @@ -166,8 +166,8 @@ func main() { log.Fatal(aspire.FormatError(err)) } - api := builder.AddGoApp("api", "./api"). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Port: aspire.IntPtr(8080), Env: aspire.StringPtr("PORT")}). + builder.AddGoApp("api", "./api"). + WithHttpEndpoint(aspire.HttpEndpointPort(8080), aspire.HttpEndpointEnv("PORT")). WithExternalHttpEndpoints() app, err := builder.Build() @@ -270,10 +270,8 @@ await builder.build().run(); ```go title="apphost.go" -builder.AddGoApp("api", "./api", &aspire.AddGoAppOptions{ - PackagePath: aspire.StringPtr("./cmd/server"), -}). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) +builder.AddGoApp("api", "./api", aspire.AddGoAppPackagePath("./cmd/server")). + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) ``` @@ -326,13 +324,11 @@ await builder.build().run(); ```go title="apphost.go" -builder.AddGoApp("api", "./api", &aspire.AddGoAppOptions{ - PackagePath: aspire.StringPtr("./cmd/server"), - BuildTags: []string{"netgo", "integration"}, - LdFlags: aspire.StringPtr("-X main.version=1.2.3 -s -w"), - GcFlags: aspire.StringPtr("all=-N -l"), - RaceDetector: aspire.BoolPtr(true), -}) +builder.AddGoApp("api", "./api", aspire.AddGoAppPackagePath("./cmd/server"), + aspire.AddGoAppBuildTags([]string{"netgo", "integration"}), + aspire.AddGoAppLdFlags("-X main.version=1.2.3 -s -w"), + aspire.AddGoAppGcFlags("all=-N -l"), + aspire.AddGoAppRaceDetector(true)) ``` @@ -383,7 +379,7 @@ await builder.build().run(); ```go title="apphost.go" builder.AddGoApp("api", "./api"). WithAppArgs([]any{"--config", "dev.yaml"}). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) ``` @@ -438,7 +434,7 @@ builder.AddGoApp("api", "./api"). WithModVendor(). WithModDownload(). WithVetTool(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{Env: aspire.StringPtr("PORT")}) + WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")) ``` @@ -503,7 +499,8 @@ await builder.build().run(); ```go title="apphost.go" builder.AddGoApp("api", "./api"). WithDelveServer(). - WithHttpEndpoint(&aspire.WithHttpEndpointOptions{ Port: aspire.IntPtr(8080), Env: aspire.StringPtr("PORT")})``` + WithHttpEndpoint(aspire.HttpEndpointPort(8080), aspire.HttpEndpointEnv("PORT")) +``` @@ -545,12 +542,12 @@ await api.withDelveServer({ ```go title="apphost.go" builder.AddGoApp("api", "./api"). - WithDelveServer(&aspire.DelveServerOptions{ + WithDelveServer(aspire.DelveServerOptions2(&aspire.DelveServerOptions{ AcceptMultiClient: aspire.BoolPtr(true), ContinueOnStart: aspire.BoolPtr(true), Log: aspire.BoolPtr(true), LogOutput: aspire.StringPtr("rpc,dap,debugger"), - }) + })) ``` diff --git a/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx b/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx index 40fc8e32b2..94be9a331e 100644 --- a/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/apache-kafka/apache-kafka-host.mdx @@ -240,11 +240,9 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" kafka := builder.AddKafka("kafka"). - WithKafkaUI(&aspire.WithKafkaUIOptions{ - ConfigureContainer: func(kafkaUI aspire.KafkaUIContainerResource) { - kafkaUI.WithHostPort(aspire.IntPtr(9100)) - }, - }) + WithKafkaUI(aspire.KafkaUIConfigureContainer(func(kafkaUI aspire.KafkaUIContainerResource) { + kafkaUI.WithHostPort(aspire.IntPtr(9100)) + })) builder.AddNodeApp("api", "./api", "index.js"). WithReference(kafka) @@ -290,7 +288,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" kafka := builder.AddKafka("kafka"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(kafka) @@ -340,7 +338,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" kafka := builder.AddKafka("kafka"). - WithDataBindMount("/Kafka/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/Kafka/Data", aspire.DataBindMountIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(kafka) diff --git a/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx b/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx index 08ad7e51df..7b444a5029 100644 --- a/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/nats/nats-host.mdx @@ -238,7 +238,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" nats := builder.AddNats("nats"). WithJetStream(). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(nats) @@ -291,7 +291,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" nats := builder.AddNats("nats"). WithJetStream(). - WithDataBindMount("/Nats/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/Nats/Data", aspire.DataBindMountIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(nats) @@ -347,12 +347,10 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" userName := builder.AddParameter("natsUser") -password := builder.AddParameter("natsPass", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +password := builder.AddParameter("natsPass", aspire.AddParameterSecret(true)) -nats := builder.AddNats("nats", &aspire.AddNatsOptions{ - UserName: &userName, - Password: &password, -}) +nats := builder.AddNats("nats", aspire.AddNatsUserName(userName), + aspire.AddNatsPassword(password)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(nats) diff --git a/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx b/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx index 0dec0c09fe..a33bce38b1 100644 --- a/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx +++ b/src/frontend/src/content/docs/integrations/messaging/rabbitmq/rabbitmq-host.mdx @@ -193,7 +193,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" rabbitmq := builder.AddRabbitMQ("messaging"). - WithDataVolume(&aspire.WithDataVolumeOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataVolume(aspire.DataVolumeIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(rabbitmq) @@ -243,7 +243,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" rabbitmq := builder.AddRabbitMQ("messaging"). - WithDataBindMount("/RabbitMQ/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}) + WithDataBindMount("/RabbitMQ/Data", aspire.DataBindMountIsReadOnly(false)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(rabbitmq) @@ -298,13 +298,11 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" -userName := builder.AddParameter("username", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +userName := builder.AddParameter("username", aspire.AddParameterSecret(true)) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -rabbitmq := builder.AddRabbitMQ("messaging", &aspire.AddRabbitMQOptions{ - UserName: &userName, - Password: &password, -}) +rabbitmq := builder.AddRabbitMQ("messaging", aspire.AddRabbitMQUserName(userName), + aspire.AddRabbitMQPassword(password)) builder.AddNodeApp("api", "./api", "index.js"). WithReference(rabbitmq) @@ -357,13 +355,11 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" -userName := builder.AddParameter("username", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) -password := builder.AddParameter("password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +userName := builder.AddParameter("username", aspire.AddParameterSecret(true)) +password := builder.AddParameter("password", aspire.AddParameterSecret(true)) -rabbitmq := builder.AddRabbitMQ("messaging", &aspire.AddRabbitMQOptions{ - UserName: &userName, - Password: &password, -}).WithManagementPlugin() +rabbitmq := builder.AddRabbitMQ("messaging", aspire.AddRabbitMQUserName(userName), + aspire.AddRabbitMQPassword(password)).WithManagementPlugin() builder.AddNodeApp("api", "./api", "index.js"). WithReference(rabbitmq) @@ -392,7 +388,7 @@ await rabbitmq.withManagementPlugin({ port: 15672 }); ```go title="apphost.go" rabbitmq := builder.AddRabbitMQ("messaging"). - WithManagementPlugin(&aspire.WithManagementPluginOptions{Port: aspire.IntPtr(15672)}) + WithManagementPlugin(aspire.ManagementPluginPort(15672)) ``` diff --git a/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx b/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx index 49aae8d8c7..b34c592cc6 100644 --- a/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx +++ b/src/frontend/src/content/docs/integrations/observability/seq/seq-host.mdx @@ -134,7 +134,7 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" -adminPassword := builder.AddParameter("seq-admin-password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +adminPassword := builder.AddParameter("seq-admin-password", aspire.AddParameterSecret(true)) seq := builder.AddSeq("seq", adminPassword). WithLifetime(aspire.ContainerLifetimePersistent). WithEnvironment("ACCEPT_EULA", "Y") @@ -220,7 +220,7 @@ await myService ```go title="apphost.go" -adminPassword := builder.AddParameter("seq-admin-password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +adminPassword := builder.AddParameter("seq-admin-password", aspire.AddParameterSecret(true)) seq := builder.AddSeq("seq", adminPassword). WithDataVolume(). ExcludeFromManifest(). @@ -282,9 +282,9 @@ await builder.addNodeApp("api", "./api", "index.js") ```go title="apphost.go" -adminPassword := builder.AddParameter("seq-admin-password", &aspire.AddParameterOptions{Secret: aspire.BoolPtr(true)}) +adminPassword := builder.AddParameter("seq-admin-password", aspire.AddParameterSecret(true)) seq := builder.AddSeq("seq", adminPassword). - WithDataBindMount("/Seq/Data", &aspire.WithDataBindMountOptions{IsReadOnly: aspire.BoolPtr(false)}). + WithDataBindMount("/Seq/Data", aspire.DataBindMountIsReadOnly(false)). WithLifetime(aspire.ContainerLifetimePersistent). WithEnvironment("ACCEPT_EULA", "Y") diff --git a/src/frontend/tests/e2e/custom-components.spec.ts b/src/frontend/tests/e2e/custom-components.spec.ts index 43ec3b53bc..15580dec85 100644 --- a/src/frontend/tests/e2e/custom-components.spec.ts +++ b/src/frontend/tests/e2e/custom-components.spec.ts @@ -177,6 +177,34 @@ test('AppHost builder types additions and selects removals before deleting them' await expect(codeStage).not.toContainText('.addPostgres("db")'); }); +test('Go AppHost builder uses a Go API with typed options in every API variant', async ({ + page, +}) => { + await page.emulateMedia({ reducedMotion: 'reduce' }); + await page.goto('/'); + await dismissCookieConsentIfVisible(page); + + const builder = page.locator('[data-apphost-builder]').first(); + const stage = builder.locator('[data-code-stage]'); + await builder.locator('[data-lang="go"]').click(); + await builder.locator('[data-toggle="api"]').click(); + + const toggles = ['frontend', 'database', 'container', 'deployment']; + for (let mask = 0; mask < 16; mask++) { + for (const [bit, toggle] of toggles.entries()) { + const button = builder.locator(`[data-toggle="${toggle}"]`); + const enabled = String(Boolean(mask & (1 << bit))); + if ((await button.getAttribute('aria-pressed')) !== enabled) { + await button.click(); + } + } + await expect(stage).toContainText('builder.AddGoApp("api", "../api")'); + await expect(stage).toContainText('aspire.HttpEndpointEnv("PORT")'); + await expect(stage).not.toContainText('AddNodeApp'); + await expect(stage).not.toContainText('aspire.StringPtr'); + } +}); + test('AppHost builder applies code changes immediately when reduced motion is requested', async ({ page, }) => { diff --git a/src/frontend/tests/e2e/pivot-selector.spec.ts b/src/frontend/tests/e2e/pivot-selector.spec.ts index c6fe470afc..1eb33f8469 100644 --- a/src/frontend/tests/e2e/pivot-selector.spec.ts +++ b/src/frontend/tests/e2e/pivot-selector.spec.ts @@ -1,6 +1,50 @@ import { expect, test } from '@playwright/test'; import { dismissCookieConsentIfVisible } from '@tests/e2e/helpers'; +test('deployment pivots share one output heading and Go reuses the React verification images', async ({ + page, +}) => { + await page.goto('/get-started/deploy-first-app/?aspire-lang=typescript'); + await dismissCookieConsentIfVisible(page); + const selector = page.locator('#pivot-selector-aspire-lang'); + const verification = (language: string) => + page.locator(`[data-pivot-block="${language}"]`).filter({ + has: page.locator('img[alt^="Deployed"]'), + }); + + const typescriptImages = await verification('typescript') + .locator('img') + .evaluateAll((images) => images.map((image) => image.getAttribute('src'))); + expect(typescriptImages.length).toBeGreaterThan(0); + + for (const language of ['go', 'csharp', 'typescript', 'go']) { + await selector.locator(`[data-pivot-option="${language}"]`).click(); + await expect( + page.getByRole('heading', { name: 'Post deployment output', exact: true }) + ).toHaveCount(1); + for (const toc of await page.locator('starlight-toc, mobile-starlight-toc').all()) { + await expect(toc.locator('a[href="#post-deployment-output"]')).toHaveCount(1); + await expect(toc.locator('a[href^="#post-deployment-output-"]')).toHaveCount(0); + } + } + + const goVerification = verification('go'); + expect( + await goVerification + .locator('img') + .evaluateAll((images) => images.map((image) => image.getAttribute('src'))) + ).toEqual(typescriptImages); + + for (const target of ['Docker Compose', 'Azure']) { + await goVerification.getByRole('tab', { name: target, exact: true }).click(); + const panel = goVerification.getByRole('tabpanel', { name: target, exact: true }); + await expect(panel).toBeVisible(); + await expect(panel).toContainText('print-app-summary'); + await expect(panel).toContainText('weather forecast'); + await expect(panel.locator('img:visible')).toHaveCount(1); + } +}); + test('Dev Hub TypeScript quickstart overrides a saved C# preference', async ({ page }) => { await page.addInitScript(() => { localStorage.setItem('aspire-lang', 'csharp');